org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest Java Examples

The following examples show how to use org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ToggleShowDocumentationCommand.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public static void toggleDocumentation(List<View> views) {
	CompositeCommand command = new CompositeCommand("toggle documentation");
	for (View view : views) {
		StringValueStyle style = GMFNotationUtil.getStringValueStyle(view, FEATURE_TO_SHOW);
		if (style == null) {
			style = createInitialStyle(view);
		}
		String featureName = style.getStringValue()
				.equals(SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION.getName())
						? BasePackage.Literals.DOCUMENTED_ELEMENT__DOCUMENTATION.getName()
						: SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION.getName();
		command.add(new SetValueCommand(
				new SetRequest(style, NotationPackage.Literals.STRING_VALUE_STYLE__STRING_VALUE, featureName)));
	}
	executeCommand(command);
}
 
Example #2
Source File: SetEntryKindCommand.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public Object execute(ExecutionEvent event) throws ExecutionException {
	entry = unwrap(HandlerUtil.getCurrentSelection(event));
	
	if (entry == null)
		return null;
	SetValueCommand setCommand = new SetValueCommand(new SetRequest(entry,
			SGraphPackage.Literals.ENTRY__KIND, getEntryKind()));
	IOperationHistory history = OperationHistoryFactory
			.getOperationHistory();
	try {
		history.execute(setCommand, new NullProgressMonitor(), null);
	} catch (ExecutionException e) {
		e.printStackTrace();
	}
	
	return null;
}
 
Example #3
Source File: EntryEditHelper.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Set the right {@link EntryKind} for the given {@link ElementType}
 */
@Override
protected ICommand getConfigureCommand(ConfigureRequest req) {
	if (StatechartElementTypes.SHALLOWHISTORY.equals(req
			.getTypeToConfigure())) {
		return new SetValueCommand(new SetRequest(
				req.getElementToConfigure(),
				SGraphPackage.eINSTANCE.getEntry_Kind(),
				EntryKind.SHALLOW_HISTORY));
	} else if (StatechartElementTypes.DEEPHISTORY.equals(req
			.getTypeToConfigure())) {
		return new SetValueCommand(new SetRequest(
				req.getElementToConfigure(),
				SGraphPackage.eINSTANCE.getEntry_Kind(),
				EntryKind.DEEP_HISTORY));
	} else if (StatechartElementTypes.ENTRY
			.equals(req.getTypeToConfigure())) {
		return new SetValueCommand(new SetRequest(
				req.getElementToConfigure(),
				SGraphPackage.eINSTANCE.getEntry_Kind(), EntryKind.INITIAL));
	}
	return super.getConfigureCommand(req);
}
 
Example #4
Source File: CrossflowBaseItemSemanticEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
	if (req instanceof CreateRelationshipRequest) {
		return getCreateRelationshipCommand((CreateRelationshipRequest) req);
	} else if (req instanceof CreateElementRequest) {
		return getCreateCommand((CreateElementRequest) req);
	} else if (req instanceof ConfigureRequest) {
		return getConfigureCommand((ConfigureRequest) req);
	} else if (req instanceof DestroyElementRequest) {
		return getDestroyElementCommand((DestroyElementRequest) req);
	} else if (req instanceof DestroyReferenceRequest) {
		return getDestroyReferenceCommand((DestroyReferenceRequest) req);
	} else if (req instanceof DuplicateElementsRequest) {
		return getDuplicateCommand((DuplicateElementsRequest) req);
	} else if (req instanceof GetEditContextRequest) {
		return getEditContextCommand((GetEditContextRequest) req);
	} else if (req instanceof MoveRequest) {
		return getMoveCommand((MoveRequest) req);
	} else if (req instanceof ReorientReferenceRelationshipRequest) {
		return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
	} else if (req instanceof ReorientRelationshipRequest) {
		return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
	} else if (req instanceof SetRequest) {
		return getSetCommand((SetRequest) req);
	}
	return null;
}
 
Example #5
Source File: ToggleShowDocumentationCommand.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public static StringValueStyle createInitialStyle(View view) {
	StringValueStyle style = NotationFactory.eINSTANCE.createStringValueStyle();
	style.setName(FEATURE_TO_SHOW);
	style.setStringValue(SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION.getName());
	SetValueCommand cmd = new SetValueCommand(new SetRequest(view, NotationPackage.Literals.VIEW__STYLES, style));
	executeCommand(cmd);
	return style;
}
 
Example #6
Source File: DocumentationDropDownAction.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private void show(List<View> views){
	CompositeCommand command = new CompositeCommand("toggle documentation");
	for (View view : views) {
		StringValueStyle style = GMFNotationUtil.getStringValueStyle(view, ToggleShowDocumentationCommand.FEATURE_TO_SHOW);
		if (style == null) {
			style = ToggleShowDocumentationCommand.createInitialStyle(view);
		}
		command.add(new SetValueCommand(new SetRequest(style,
				NotationPackage.Literals.STRING_VALUE_STYLE__STRING_VALUE, typeLiteral)));
	}
	ToggleShowDocumentationCommand.executeCommand(command);
}
 
Example #7
Source File: StateEditHelper.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
private ICommand createOrthogonalState(ConfigureRequest req) {
	Region region = SGraphFactory.eINSTANCE.createRegion();
	region.setName("r1");
	Region region2 = SGraphFactory.eINSTANCE.createRegion();
	region2.setName("r2");
	return new SetValueCommand(new SetRequest(req.getElementToConfigure(),
			SGraphPackage.Literals.COMPOSITE_ELEMENT__REGIONS, com.google.common.collect.Lists.newArrayList(region,
					region2)));
}
 
Example #8
Source File: TransitionEditHelper.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected ICommand getReorientRelationshipCommand(
		ReorientRelationshipRequest req) {
	switch (req.getDirection()) {
	case ReorientRelationshipRequest.REORIENT_SOURCE:
		return new SetValueCommand(new SetRequest(req.getRelationship(),
				SGraphPackage.Literals.TRANSITION__SOURCE,
				req.getNewRelationshipEnd()));
	case ReorientRelationshipRequest.REORIENT_TARGET:
		return new SetValueCommand(new SetRequest(req.getRelationship(),
				SGraphPackage.Literals.TRANSITION__TARGET,
				req.getNewRelationshipEnd()));
	}
	return super.getReorientRelationshipCommand(req);
}
 
Example #9
Source File: EAttributeDirectEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
	Object value = request.getCellEditor().getValue();
	if (value == null)
		return null;
	SetRequest setRequest = new SetRequest(getHost().resolveSemanticElement(), provider.getAttribute(), value);
	SetValueCommand setCommand = new SetValueCommand(setRequest);
	return new ICommandProxy(setCommand);
}
 
Example #10
Source File: TransitionExpressionComponentEditPolicy.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Command createDeleteSemanticCommand(GroupRequest deleteRequest) {
	SetRequest request = new SetRequest(getHost().resolveSemanticElement(),
			SGraphPackage.Literals.SPECIFICATION_ELEMENT__SPECIFICATION,
			null);
	SetValueCommand result = new SetValueCommand(request);
	return new ICommandProxy(result);
}
 
Example #11
Source File: StringAttributeParser.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public ICommand getParseCommand(IAdaptable adapter, String newString,
		int flags) {
	if (newString == null) {
		return UnexecutableCommand.INSTANCE;
	}
	EObject element = (EObject) adapter.getAdapter(EObject.class);
	TransactionalEditingDomain editingDomain = TransactionUtil
			.getEditingDomain(element);
	if (editingDomain == null) {
		return UnexecutableCommand.INSTANCE;
	}
	SetRequest request = new SetRequest(element, provider.getAttribute(),
			newString);
	return new SetValueCommand(request);
}
 
Example #12
Source File: ExtractAsCallActivityTransactionalCommand.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected DeferredSetValueCommand createSetCommand(final CreateViewAndElementRequest req, EStructuralFeature feature, Object value,
        EObject anEObjectInSameDomain) {
    return new DeferredSetValueCommand(new SetRequest(
            anEObjectInSameDomain,
            feature,
            value))
    {

        @Override
        public EObject getElementToEdit() {
            return (EObject) req.getViewAndElementDescriptor().getElementAdapter().getAdapter(EObject.class);
        }
    };
}
 
Example #13
Source File: ProcessBaseItemSemanticEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
	if (req instanceof CreateRelationshipRequest) {
		return getCreateRelationshipCommand((CreateRelationshipRequest) req);
	} else if (req instanceof CreateElementRequest) {
		return getCreateCommand((CreateElementRequest) req);
	} else if (req instanceof ConfigureRequest) {
		return getConfigureCommand((ConfigureRequest) req);
	} else if (req instanceof DestroyElementRequest) {
		return getDestroyElementCommand((DestroyElementRequest) req);
	} else if (req instanceof DestroyReferenceRequest) {
		return getDestroyReferenceCommand((DestroyReferenceRequest) req);
	} else if (req instanceof DuplicateElementsRequest) {
		return getDuplicateCommand((DuplicateElementsRequest) req);
	} else if (req instanceof GetEditContextRequest) {
		return getEditContextCommand((GetEditContextRequest) req);
	} else if (req instanceof MoveRequest) {
		return getMoveCommand((MoveRequest) req);
	} else if (req instanceof ReorientReferenceRelationshipRequest) {
		return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
	} else if (req instanceof ReorientRelationshipRequest) {
		return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
	} else if (req instanceof SetRequest) {
		return getSetCommand((SetRequest) req);
	}
	return null;
}
 
Example #14
Source File: CrossflowBaseItemSemanticEditPolicy.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
* @generated
*/
protected Command getSetCommand(SetRequest req) {
	return null;
}
 
Example #15
Source File: StateEditHelper.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
private ICommand createCompositeStateCommand(ConfigureRequest req) {
	Region region = SGraphFactory.eINSTANCE.createRegion();
	region.setName("r1");
	return new SetValueCommand(new SetRequest(req.getElementToConfigure(),
			SGraphPackage.Literals.COMPOSITE_ELEMENT__REGIONS, region));
}
 
Example #16
Source File: ProcessBaseItemSemanticEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
* @generated
*/
protected Command getSetCommand(SetRequest req) {
	return null;
}