Java Code Examples for org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#resolveSemanticElement()

The following examples show how to use org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#resolveSemanticElement() . 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: GroupStatesIntoCompositeRefactoring.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void setContextStates() {
	contextStates = Lists.newArrayList();
	List<GraphicalEditPart> contextObjects = getContextObjects();
	for (GraphicalEditPart editPart : contextObjects) {
		EObject element = editPart.resolveSemanticElement();
		contextStates.add((State) element);
	}
}
 
Example 2
Source File: CustomProcessEditPolicyProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public boolean provides(IOperation operation) {
	if (operation instanceof CreateEditPoliciesOperation && ((CreateEditPoliciesOperation)operation).getEditPart() instanceof GraphicalEditPart) {
		GraphicalEditPart editPart = (GraphicalEditPart) ((CreateEditPoliciesOperation)operation).getEditPart();
		if(editPart.getRoot().getContents() instanceof MainProcessEditPart)
			return editPart.resolveSemanticElement() instanceof Element;
	}
	return false;
}
 
Example 3
Source File: ProcessTextNonResizableEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void showPrimarySelection() {
	if (getHostFigure() instanceof WrappingLabel) {
		final GraphicalEditPart ep = (GraphicalEditPart) getHost();
		if (ep.resolveSemanticElement() instanceof Activity) {
			final CustomTextDirectEditManager manager = new CustomTextDirectEditManager(ep,
					CustomTextDirectEditManager.getTextCellEditorClass(ep),
					ProcessEditPartFactory.getTextCellEditorLocator((ITextAwareEditPart) ep));
			manager.show();
			manager.getCellEditor().addListener(new ICellEditorListener() {

				@Override
				public void editorValueChanged(boolean oldValidState, boolean newValidState) {
				}

				@Override
				public void cancelEditor() {
					ep.getViewer().select(getHost().getParent());
				}

				@Override
				public void applyEditorValue() {
					ep.getViewer().select(getHost().getParent());
				}
			});
		} else {
			((WrappingLabel) getHostFigure()).setSelected(true);
		}
	} else {
		showSelection();
		showFocus();
	}
}
 
Example 4
Source File: ProcessTextSelectionEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
protected void showPrimarySelection() {
	if (getHostFigure() instanceof WrappingLabel) {
		final GraphicalEditPart ep = (GraphicalEditPart) getHost();
		if (ep.resolveSemanticElement() instanceof Activity) {
			final CustomTextDirectEditManager manager = new CustomTextDirectEditManager(ep,
					CustomTextDirectEditManager.getTextCellEditorClass(ep),
					ProcessEditPartFactory.getTextCellEditorLocator((ITextAwareEditPart) ep));
			manager.show();
			manager.getCellEditor().addListener(new ICellEditorListener() {

				@Override
				public void editorValueChanged(boolean oldValidState, boolean newValidState) {
				}

				@Override
				public void cancelEditor() {
					ep.getViewer().select(getHost().getParent());
				}

				@Override
				public void applyEditorValue() {
					ep.getViewer().select(getHost().getParent());
				}
			});
		} else {
			((WrappingLabel) getHostFigure()).setSelected(true);
		}
	} else {
		showSelection();
		showFocus();
	}
}