org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy Java Examples

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy. 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: CrossflowDiagramUpdateCommand.java    From scava with Eclipse Public License 2.0 6 votes vote down vote up
/**
* @generated
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
	ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
			.getSelection();
	if (selection instanceof IStructuredSelection) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		if (structuredSelection.size() != 1) {
			return null;
		}
		if (structuredSelection.getFirstElement() instanceof EditPart
				&& ((EditPart) structuredSelection.getFirstElement()).getModel() instanceof View) {
			EObject modelElement = ((View) ((EditPart) structuredSelection.getFirstElement()).getModel())
					.getElement();
			List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
			for (Iterator it = editPolicies.iterator(); it.hasNext();) {
				CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
				nextEditPolicy.refresh();
			}

		}
	}
	return null;
}
 
Example #2
Source File: ProcessDiagramUpdateCommand.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
/**
* @generated
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
	ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
			.getSelection();
	if (selection instanceof IStructuredSelection) {
		IStructuredSelection structuredSelection = (IStructuredSelection) selection;
		if (structuredSelection.size() != 1) {
			return null;
		}
		if (structuredSelection.getFirstElement() instanceof EditPart
				&& ((EditPart) structuredSelection.getFirstElement()).getModel() instanceof View) {
			EObject modelElement = ((View) ((EditPart) structuredSelection.getFirstElement()).getModel())
					.getElement();
			List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
			for (Iterator it = editPolicies.iterator(); it.hasNext();) {
				CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
				nextEditPolicy.refresh();
			}

		}
	}
	return null;
}