Java Code Examples for org.eclipse.gmf.runtime.diagram.core.util.ViewUtil#APPEND

The following examples show how to use org.eclipse.gmf.runtime.diagram.core.util.ViewUtil#APPEND . 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: CompartmentLayoutEditPolicy.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
		IAdaptable info) throws ExecutionException {

	View childView = (View) child.getAdapter(View.class);
	View parentView = (View) parent.getAdapter(View.class);

	if (parentView.getPersistedChildren().contains(childView)
			&& index != ViewUtil.APPEND) {
		parentView.getPersistedChildren().move(index, childView);
	} else if (index == ViewUtil.APPEND) {
		parentView.insertChild(childView);
	} else {
		parentView.insertChildAt(childView, index);
	}
	return CommandResult.newOKCommandResult();
}
 
Example 2
Source File: WorkflowCanonicalEditPolicy.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
private Collection<IAdaptable> createConnections(Collection<CrossflowLinkDescriptor> linkDescriptors,
		Domain2Notation domain2NotationMap) {
	LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
	for (CrossflowLinkDescriptor nextLinkDescriptor : linkDescriptors) {
		EditPart sourceEditPart = getSourceEditPart(nextLinkDescriptor, domain2NotationMap);
		EditPart targetEditPart = getTargetEditPart(nextLinkDescriptor, domain2NotationMap);
		if (sourceEditPart == null || targetEditPart == null) {
			continue;
		}
		CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(
				nextLinkDescriptor.getSemanticAdapter(),
				CrossflowVisualIDRegistry.getType(nextLinkDescriptor.getVisualID()), ViewUtil.APPEND, false,
				((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
		CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
		ccr.setType(RequestConstants.REQ_CONNECTION_START);
		ccr.setSourceEditPart(sourceEditPart);
		sourceEditPart.getCommand(ccr);
		ccr.setTargetEditPart(targetEditPart);
		ccr.setType(RequestConstants.REQ_CONNECTION_END);
		Command cmd = targetEditPart.getCommand(ccr);
		if (cmd != null && cmd.canExecute()) {
			executeCommand(cmd);
			IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
			if (viewAdapter != null) {
				adapters.add(viewAdapter);
			}
		}
	}
	return adapters;
}
 
Example 3
Source File: MainProcessCanonicalEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
private Collection<IAdaptable> createConnections(Collection<ProcessLinkDescriptor> linkDescriptors,
		Domain2Notation domain2NotationMap) {
	LinkedList<IAdaptable> adapters = new LinkedList<IAdaptable>();
	for (ProcessLinkDescriptor nextLinkDescriptor : linkDescriptors) {
		EditPart sourceEditPart = getSourceEditPart(nextLinkDescriptor, domain2NotationMap);
		EditPart targetEditPart = getTargetEditPart(nextLinkDescriptor, domain2NotationMap);
		if (sourceEditPart == null || targetEditPart == null) {
			continue;
		}
		CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(
				nextLinkDescriptor.getSemanticAdapter(),
				ProcessVisualIDRegistry.getType(nextLinkDescriptor.getVisualID()), ViewUtil.APPEND, false,
				((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
		CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
		ccr.setType(RequestConstants.REQ_CONNECTION_START);
		ccr.setSourceEditPart(sourceEditPart);
		sourceEditPart.getCommand(ccr);
		ccr.setTargetEditPart(targetEditPart);
		ccr.setType(RequestConstants.REQ_CONNECTION_END);
		Command cmd = targetEditPart.getCommand(ccr);
		if (cmd != null && cmd.canExecute()) {
			executeCommand(cmd);
			IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
			if (viewAdapter != null) {
				adapters.add(viewAdapter);
			}
		}
	}
	return adapters;
}