use of org.eclipse.gmf.runtime.notation.BooleanValueStyle in project statecharts by Yakindu.
the class ExtractSubdiagramRefactoring method isExecutable.
@Override
public boolean isExecutable() {
EObject element = getContextObject().getElement();
if (!(element instanceof State)) {
return false;
}
State state = (State) element;
BooleanValueStyle inlineStyle = getInlineStyle(getContextObject());
return super.isExecutable() && state.isComposite() && (inlineStyle == null || inlineStyle.isBooleanValue());
}
use of org.eclipse.gmf.runtime.notation.BooleanValueStyle in project statecharts by Yakindu.
the class CreateSubdiagramCommand method isEnabled.
@Override
public boolean isEnabled() {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null)
return false;
ISelection selection = activeWorkbenchWindow.getActivePage().getSelection();
if (selection == null)
return false;
Node unwrap = unwrap(selection);
if (unwrap == null) {
return false;
}
State state = (State) unwrap.getElement();
if (state == null || state.isComposite())
return false;
BooleanValueStyle inlineStyle = DiagramPartitioningUtil.getInlineStyle(unwrap);
if (inlineStyle != null && !inlineStyle.isBooleanValue())
return false;
return super.isEnabled();
}
use of org.eclipse.gmf.runtime.notation.BooleanValueStyle in project statecharts by Yakindu.
the class DiagramPartitioningUtil method createInlineDefinitionSectionStyle.
/**
* creates a new style for diagam inlining
*/
public static BooleanValueStyle createInlineDefinitionSectionStyle() {
BooleanValueStyle result = NotationFactory.eINSTANCE.createBooleanValueStyle();
result.setName(INLINE_DEFINITION_SECTION_STYLE);
result.setBooleanValue(false);
return result;
}
use of org.eclipse.gmf.runtime.notation.BooleanValueStyle in project statecharts by Yakindu.
the class DiagramPartitioningUtil method createInlineStyle.
/**
* creates a new style for diagam inlining
*/
public static BooleanValueStyle createInlineStyle() {
BooleanValueStyle result = NotationFactory.eINSTANCE.createBooleanValueStyle();
result.setName(INLINE_STYLE);
result.setBooleanValue(true);
return result;
}
use of org.eclipse.gmf.runtime.notation.BooleanValueStyle in project statecharts by Yakindu.
the class StateCompartmentCreationEditPolicy method getCreateCommand.
@Override
protected Command getCreateCommand(CreateViewRequest request) {
StateEditPart parent = (StateEditPart) getHost().getParent();
BooleanValueStyle isInline = GMFNotationUtil.getBooleanValueStyle(parent.getNotationView(), DiagramPartitioningUtil.INLINE_STYLE);
if (isInline != null && !isInline.isBooleanValue())
return UnexecutableCommand.INSTANCE;
List<? extends ViewDescriptor> viewDescriptors = request.getViewDescriptors();
for (ViewDescriptor viewDescriptor : viewDescriptors) {
String semanticHint = viewDescriptor.getSemanticHint();
if (ViewType.NOTE.equals(semanticHint) || ViewType.NOTEATTACHMENT.equals(semanticHint) || ViewType.TEXT.equals(semanticHint)) {
return UnexecutableCommand.INSTANCE;
}
}
return super.getCreateCommand(request);
}
Aggregations