/*******************************************************************************
* Copyright (c) 2012 VMware, Inc.
* 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:
* VMware, Inc. - initial API and implementation
*******************************************************************************/
package org.springframework.ide.eclipse.config.graph.policies;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.springframework.ide.eclipse.config.graph.figures.SimpleActivityLabel;
import org.springframework.ide.eclipse.config.graph.parts.SimpleActivityPart;
/**
* Handles selection of SimpleActivites. Primary selection is denoted by
* highlight and a focus rectangle. Normal selection is denoted by highlight
* only.
* @author Leo Dos Santos
* @author Christian Dupuis
*/
public class SimpleActivitySelectionEditPolicy extends NonResizableEditPolicy {
private SimpleActivityLabel getLabel() {
SimpleActivityPart part = (SimpleActivityPart) getHost();
return ((SimpleActivityLabel) part.getFigure());
}
/**
* @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#hideFocus()
*/
@Override
protected void hideFocus() {
getLabel().setFocus(false);
}
/**
* @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#hideSelection()
*/
@Override
protected void hideSelection() {
getLabel().setSelected(false);
getLabel().setFocus(false);
}
/**
* @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#showFocus()
*/
@Override
protected void showFocus() {
getLabel().setFocus(true);
}
/**
* @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
*/
@Override
protected void showPrimarySelection() {
getLabel().setSelected(true);
getLabel().setFocus(true);
}
/**
* @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
*/
@Override
protected void showSelection() {
getLabel().setSelected(true);
getLabel().setFocus(false);
}
}