当前位置: 首页>>代码示例>>Java>>正文


Java View.getType方法代码示例

本文整理汇总了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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:26,代码来源:SheetLabelProvider.java

示例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);
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:32,代码来源:RotativeImageEditPartProvider.java

示例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;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:39,代码来源:SheetLabelProvider.java

示例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$
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:7,代码来源:StatemachineNavigatorLabelProvider.java

示例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$
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:7,代码来源:StatemachineNavigatorLabelProvider.java


注:本文中的org.eclipse.gmf.runtime.notation.View.getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。