blob: d0dfb54355c9f5733bf51bf8deb72762f33e5885 [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2005, 2019 SAP SE
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* SAP SE - initial API, implementation and documentation
* mwenz - Bug 327669 - removed dependencies to GEF internal stuff
* mwenz - Bug 352440 - Fixed deprecation warnings - contributed by Felix Velasco
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.graphiti.ui.internal.editor;
import org.eclipse.gef.SharedImages;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gef.tools.MarqueeSelectionTool;
import org.eclipse.graphiti.ui.internal.Messages;
/**
* A palette ToolEntry for a {@link org.eclipse.gef.tools.MarqueeSelectionTool}.
*
* @author hudsonr
* @since 2.1
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
*/
public class GFMarqueeToolEntry extends ToolEntry {
/**
* Creates a new MarqueeToolEntry that can select nodes.
*/
public GFMarqueeToolEntry() {
this(null, null);
}
/**
* Constructor for MarqueeToolEntry.
*
* @param label
* the label
*/
public GFMarqueeToolEntry(String label) {
this(label, null);
}
/**
* Constructor for MarqueeToolEntry.
*
* @param label
* the label; can be <code>null</code>
* @param description
* the description (can be <code>null</code>)
*/
public GFMarqueeToolEntry(String label, String description) {
super(label, description, SharedImages.DESC_MARQUEE_TOOL_16, SharedImages.DESC_MARQUEE_TOOL_24, GFMarqueeSelectionTool.class);
if (label == null || label.length() == 0)
setLabel(Messages.GFMarqueeToolEntry_Marquee);
setUserModificationPermission(PERMISSION_NO_MODIFICATION);
}
/**
* Gets the description.
*
* @return the description
*
* @see org.eclipse.gef.palette.PaletteEntry#getDescription()
*/
@Override
public String getDescription() {
String description = super.getDescription();
if (description != null)
return description;
Object value = getToolProperty(MarqueeSelectionTool.PROPERTY_MARQUEE_BEHAVIOR);
if (value instanceof Integer) {
int selectionType = ((Integer) value).intValue();
if (selectionType == MarqueeSelectionTool.BEHAVIOR_NODES_CONTAINED_AND_RELATED_CONNECTIONS)
return Messages.GFMarqueeToolEntry_MarqueeBothNodesAndRelatedConnections;
if (selectionType == MarqueeSelectionTool.BEHAVIOR_CONNECTIONS_TOUCHED)
return Messages.GFMarqueeToolEntry_MarqueeSelectionTouched;
}
return Messages.GFMarqueeToolEntry_MarqueeNodesTouched;
}
}