本文整理汇总了Java中org.eclipse.gmf.runtime.notation.View.getType方法的典型用法代码示例。如果您正苦于以下问题:Java View.getType方法的具体用法?Java View.getType怎么用?Java View.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.gmf.runtime.notation.View
的用法示例。
在下文中一共展示了View.getType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getText
import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
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;
}
示例2: getNodeEditPartClass
import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
@Override
protected Class<?> getNodeEditPartClass(final View view) {
String type = view.getType();
if (type != null) {
EObject resolvedSemanticElement = ViewUtil.resolveSemanticElement(view);
if (resolvedSemanticElement != null) {
if (String.valueOf(WorkspaceImageEditPart.VISUAL_ID).equals(type)) {
if (resolvedSemanticElement instanceof WorkspaceImage) {
final WorkspaceImage customStyle = (WorkspaceImage) resolvedSemanticElement;
if (isRotative(customStyle)) {
return RotativeImageEditPart.class;
}
}
} else if (String.valueOf(DNode4EditPart.VISUAL_ID).equals(type)) {
if (resolvedSemanticElement instanceof DNode) {
DNode spec = (DNode) resolvedSemanticElement;
if (spec.getOwnedStyle() != null && spec.getOwnedStyle() instanceof WorkspaceImage) {
if (isRotative((WorkspaceImage) spec.getOwnedStyle())) {
return RotativeDNode4EditPart.class;
}
}
}
}
}
}
return super.getNodeEditPartClass(view);
}
示例3: getImage
import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
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;
}
示例4: getUnknownElementText
import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
* @generated
*/
private String getUnknownElementText(View view) {
return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
}
示例5: getUnresolvedDomainElementProxyText
import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
* @generated
*/
private String getUnresolvedDomainElementProxyText(View view) {
return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
}