Java Code Examples for org.eclipse.gmf.runtime.notation.View#getType()

The following examples show how to use org.eclipse.gmf.runtime.notation.View#getType() . 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: SheetLabelProvider.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public String getText(Object element) {
	element = unwrap(element);
	if (element instanceof IGraphicalEditPart) {
		EObject semanticElement = ((IGraphicalEditPart) element)
				.resolveSemanticElement();

		if (semanticElement == null) {
			View view = ((IGraphicalEditPart) element).getNotationView();
			return view.getType();
		} else {

			IElementType elementType = ElementTypeRegistry.getInstance()
					.getElementType(semanticElement);
			StringBuilder builder = new StringBuilder();
			builder.append(elementType.getDisplayName());
			if (semanticElement instanceof NamedElement
					&& ((NamedElement) semanticElement).getName() != null) {
				builder.append(' ');
				builder.append(((NamedElement) semanticElement).getName());
			}
			return builder.toString();
		}
	}
	return null;
}
 
Example 2
Source File: SheetLabelProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public Image getImage(Object element) {
	element = unwrap(element);
	if (element instanceof IGraphicalEditPart) {
		EObject semanticElement = ((IGraphicalEditPart) element)
				.resolveSemanticElement();

		if (semanticElement == null) {
			// Default images
			View view = ((IGraphicalEditPart) element).getNotationView();
			String viewType = view.getType();
			if (ViewType.NOTE.equals(viewType)) {
				return SharedImages.get(SharedImages.IMG_NOTE);
			} else if (ViewType.TEXT.equals(viewType)) {
				return SharedImages.get(SharedImages.IMG_TEXT);
			}
		} else {
			// custom images
			IElementType elementType = ElementTypeRegistry.getInstance()
					.getElementType(semanticElement);
			Image image = DiagramActivator.getDefault().getImageRegistry()
					.get(elementType.getIconURL().toString());
			if (image == null) {
				ImageDescriptor desc = ImageDescriptor
						.createFromURL(elementType.getIconURL());
				DiagramActivator
						.getDefault()
						.getImageRegistry()
						.put(elementType.getIconURL().toString(),
								desc.createImage());
				return DiagramActivator.getDefault().getImageRegistry()
						.get(elementType.getIconURL().toString());
			}
			return image;

		}
	}
	return null;
}
 
Example 3
Source File: CrossflowNavigatorLabelProvider.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
* @generated
*/
private String getUnknownElementText(View view) {
	return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
}
 
Example 4
Source File: CrossflowNavigatorLabelProvider.java    From scava with Eclipse Public License 2.0 4 votes vote down vote up
/**
* @generated
*/
private String getUnresolvedDomainElementProxyText(View view) {
	return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
}
 
Example 5
Source File: StateTemplatesModification.java    From statecharts with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected boolean check(EObject semanticObject, View view) {
	return semanticObject instanceof State && view.getType() == SemanticHints.STATE;
}
 
Example 6
Source File: ProcessNavigatorLabelProvider.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
* @generated
*/
private String getUnknownElementText(View view) {
	return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
}
 
Example 7
Source File: ProcessNavigatorLabelProvider.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
/**
* @generated
*/
private String getUnresolvedDomainElementProxyText(View view) {
	return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$  //$NON-NLS-2$
}