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


Java View类代码示例

本文整理汇总了Java中org.eclipse.gmf.runtime.notation.View的典型用法代码示例。如果您正苦于以下问题:Java View类的具体用法?Java View怎么用?Java View使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


View类属于org.eclipse.gmf.runtime.notation包,在下文中一共展示了View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCrossReferencingViews

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
public static Set<View> getCrossReferencingViews(EObject referencedObject) {
	Set<View> referencingObjects = new HashSet<>();
	CrossReferenceAdapter crossReferenceAdapter = getCrossReferenceAdapter(referencedObject);
	if (crossReferenceAdapter != null) {
		// Retrieve all views referencing the referencedObject
		Iterator<?> views = crossReferenceAdapter.getInverseReferencers(referencedObject,
				NotationPackage.eINSTANCE.getView_Element(), NotationPackage.eINSTANCE.getView()).iterator();
		while (views.hasNext()) {
			View view = (View) views.next();
			if (!(view instanceof Diagram)) { 
				referencingObjects.add(view);
			}
		}
	}
	return referencingObjects;
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:17,代码来源:NoBookTwiceOneShellModelConstraint.java

示例2: getHyperlinks

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
/**
 * @see org.eclipse.papyrus.infra.hyperlink.service.HyperlinkContributor#getHyperlinks(java.lang.Object)
 *
 * @param object
 * @return
 */
@Override
public List<HyperLinkObject> getHyperlinks(Object object) {
	List<HyperLinkObject> hyperlinks = new ArrayList<>();
	if (object instanceof Class) {
		Class clazz = (Class) object;
		if (UMLUtil.getStereotypeApplication(clazz, Book.class) != null) {
			// TODO: extract a method to get the borrower from a book in the
			// java implementation of the profile
			EList<DirectedRelationship> targetDirectedRelationships = clazz.getTargetDirectedRelationships();
			for (DirectedRelationship dependency : targetDirectedRelationships) {
				if (UMLUtil.getStereotypeApplication(dependency, Borrows.class) != null) {
					EList<Element> targets = dependency.getSources();
					for (Element element : targets) {
						Set<View> crossReferencingViews = CrossReferencerUtil.getCrossReferencingViews(element,null);
						// we take the first available view
						Object firstView = crossReferencingViews.toArray()[0];
						HyperLinkSpecificObject hyperlink = new HyperLinkSpecificObject((EObject) firstView);
						hyperlinks.add(hyperlink);
					}
				}
			}
		}
	}
	return hyperlinks;
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:32,代码来源:BookToBorrowerHyperlinkContributor.java

示例3: createEditPart

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
/**
 * @generated
 */
public EditPart createEditPart(EditPart context, Object model) {
	if (model instanceof View) {
		View view = (View) model;
		switch (StatemachineVisualIDRegistry.getVisualID(view)) {

		case StatemachineEditPart.VISUAL_ID:
			return new StatemachineEditPart(view);

		case StateEditPart.VISUAL_ID:
			return new StateEditPart(view);

		case StateNameEditPart.VISUAL_ID:
			return new StateNameEditPart(view);

		case TransitionEditPart.VISUAL_ID:
			return new TransitionEditPart(view);

		}
	}
	return createUnrecognizedEditPart(context, model);
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:25,代码来源:StatemachineEditPartFactory.java

示例4: getElement2ViewMap

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
/**
 * @generated
 */
public final Map<EObject, View> getElement2ViewMap() {
	if (element2ViewMap == null) {
		element2ViewMap = new HashMap<EObject, View>();
		// map possible notation elements to itself as these can't be found by view.getElement()
		for (EObject element : elementSet) {
			if (element instanceof View) {
				View view = (View) element;
				if (view.getDiagram() == scope.getDiagram()) {
					element2ViewMap.put(element, view); // take only those that part of our diagram
				}
			}
		}

		buildElement2ViewMap(scope, element2ViewMap, elementSet);
	}
	return element2ViewMap;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:21,代码来源:StatemachineDiagramEditorUtil.java

示例5: initializeFromPreferences

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
@Override
protected void initializeFromPreferences(View view) {
	super.initializeFromPreferences(view);
	IPreferenceStore store = (IPreferenceStore) getPreferencesHint()
			.getPreferenceStore();
	if (store == null) {
		return;
	}

	// Create region default styles
	ShapeStyle style = (ShapeStyle) view
			.getStyle(NotationPackage.Literals.SHAPE_STYLE);
	RGB fillRGB = PreferenceConverter.getColor(store,
			StatechartPreferenceConstants.PREF_REGION_BACKGROUND);
	style.setFillColor(FigureUtilities.RGBToInteger(fillRGB));
	RGB lineRGB = PreferenceConverter.getColor(store,
			StatechartPreferenceConstants.PREF_REGION_LINE);
	style.setLineColor(FigureUtilities.RGBToInteger(lineRGB));
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:20,代码来源:RegionViewFactory.java

示例6: decorateView

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void decorateView(View containerView, View view,
		IAdaptable element, String semanticHint, int index,
		boolean persisted) {

	FontStyle fontStyle = NotationFactory.eINSTANCE.createFontStyle();
	view.getStyles().add(fontStyle);

	super.decorateView(containerView, view, element, semanticHint, index,
			persisted);

	Node label = FactoryUtils.createLabel(view,
			SemanticHints.TRANSITION_EXPRESSION);
	Location location = (Location) label.getLayoutConstraint();
	location.setX(0);
	location.setY(10);

}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:20,代码来源:TransitionViewFactory.java

示例7: collectEditProposals

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
/**
 * Collects all edit proposals from contained poroposal providers.
 * 
 * @return
 */
protected List<IEditProposal> collectEditProposals() {
	List<IEditProposal> proposals = new ArrayList<IEditProposal>();

	// collect all IEditProposals
	View selectedView = getSelectedView();
	if (selectedView != null) {
		if (proposalProviders != null) {
			for (IEditProposalProvider provider : proposalProviders) {
				for (IEditProposal editProposal : provider.getProposals(selectedView)) {
					if (editProposal.isApplicable())
						proposals.add(editProposal);
				}
			}
		}
	}
	return proposals;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:23,代码来源:ContentProposalHandler.java

示例8: getDiagramContaining

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
/**
 * Returns the {@link Diagram} that contains a given semantic element.
 */
public static Diagram getDiagramContaining(EObject element) {
	Assert.isNotNull(element);
	Resource eResource = element.eResource();
	Collection<Diagram> objects = EcoreUtil.getObjectsByType(eResource.getContents(),
			NotationPackage.Literals.DIAGRAM);
	for (Diagram diagram : objects) {
		TreeIterator<EObject> eAllContents = diagram.eAllContents();
		while (eAllContents.hasNext()) {
			EObject next = eAllContents.next();
			if (next instanceof View) {
				if (EcoreUtil.equals(((View) next).getElement(), element)) {
					return ((View) next).getDiagram();
				}
			}
		}
	}
	return null;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:DiagramPartitioningUtil.java

示例9: internalExecute

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void internalExecute() {
	BooleanValueStyle inlineStyle = getInlineStyle(getContextObject());
	if (inlineStyle == null) {
		inlineStyle = createInlineStyle();
		getContextObject().getStyles().add(inlineStyle);
	}
	inlineStyle.setBooleanValue(true);
	View contextView = getContextObject();
	State contextElement = (State) contextView.getElement();
	Diagram diagramToInline = DiagramPartitioningUtil.getSubDiagram(contextElement);
	View containerView = ViewUtil.getChildBySemanticHint(contextView, SemanticHints.STATE_FIGURE_COMPARTMENT);

	while (diagramToInline.getChildren().size() > 0) {
		containerView.insertChild((View) diagramToInline.getChildren().get(0));
	}
	while (diagramToInline.getEdges().size() > 0) {
		containerView.getDiagram().insertEdge((Edge) diagramToInline.getEdges().get(0));

	}
	getResource().getContents().remove(diagramToInline);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:24,代码来源:InlineSubdiagramRefactoring.java

示例10: wrapEObjects

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
private Object[] wrapEObjects(Object[] objects, Object parentElement) {
	Collection<DomainNavigatorItem> result = new ArrayList<DomainNavigatorItem>();
	for (int i = 0; i < objects.length; i++) {
		if (objects[i] instanceof EObject) {
			DomainNavigatorItem navigatorItem = new DomainNavigatorItem(
					(EObject) objects[i], parentElement,
					myAdapterFctoryContentProvier);
			// Check if object has a corresponding View
			if (!(objects[i] instanceof View)) {
				EObject eObject = (EObject) objects[i];
				navigatorItem.setView(getReferencigView(eObject));
			}
			result.add(navigatorItem);
		}
	}
	return result.toArray();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:18,代码来源:StatechartNavigatorContentProvider.java

示例11: 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

示例12: validate

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
@Override
public IStatus validate(IValidationContext context) {
	EObject target = context.getTarget();
	if (target instanceof Element) {
		Element element = (Element) target;
		Set<View> crossReferencingViews = getCrossReferencingViews(element);
		if (crossReferencingViews.size() > 1) {
			return context.createFailureStatus(target);
		}
	}
	return context.createSuccessStatus();
}
 
开发者ID:bmaggi,项目名称:library-training,代码行数:13,代码来源:NoBookTwiceOneShellModelConstraint.java

示例13: copyWithSubdiagrams

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
/**
 * This is basically a copy of
 * {@link org.eclipse.gmf.runtime.diagram.ui.internal.commands.ClipboardCommand.copyViewsToString(List)}
 * which is static and therefore not exchangeable. Only difference is adding of sub diagrams.
 */
protected String copyWithSubdiagrams(List<EObject> views) {
	Assert.isNotNull(views);
	Assert.isTrue(views.size() > 0);

	List<EObject> selection = new ArrayList<EObject>();
	Iterator iter = views.iterator();
	while (iter.hasNext()) {
		EObject viewElement = (View) iter.next();
		if (viewElement != null) {
			selection.add(viewElement);
		}
	}

	/*
	 * We must append all inner edges of a node being copied. Edges are
	 * non-containment references, hence they won't be copied for free.
	 * Therefore, we add them here to the list of views to copy.
	 */
	selection.addAll(getInnerEdges(views));

	// add the measurement unit in an annotation. Put it in the last
	// position
	// to work around a limitation in the copy/paste infrastructure, that
	// selects the ClipboardSupportFactory based on the first element in
	// the copy list. If the annotation is first, then we get the wrong
	// clipboard support instance
	selection.add(getMeasurementUnitAnnotation(views));

	// PATCH START
	// add all sub diagrams of selected states
	selection.addAll(getSubDiagrams(views));
	// PATCH END

	/* Copy the selection to the string */
	return ClipboardUtil.copyElementsToString(selection, new HashMap(), new NullProgressMonitor());
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:42,代码来源:SubdiagramAwareCopyCommand.java

示例14: getNodeViewClass

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
@Override
protected Class<?> getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
	if (semanticHint == null || "".equals(semanticHint)) {
		semanticHint = SemanticHintUtil.getSemanticHint((EObject) semanticAdapter.getAdapter(EObject.class));
	}
	return getClass(semanticHint);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:8,代码来源:StatechartDiagramViewProvider.java

示例15: moveSelectedStateNodesTo

import org.eclipse.gmf.runtime.notation.View; //导入依赖的package包/类
protected void moveSelectedStateNodesTo(View containerView, Bounds compositeBounds) {

		for (GraphicalEditPart editPart : getContextObjects()) {
			Node stateNode = (Node)editPart.getNotationView();
			ViewUtil.insertChildView(containerView, stateNode, ViewUtil.APPEND, true);
			Bounds newBounds = NotationFactory.eINSTANCE.createBounds();
			Bounds oldBounds = (Bounds)stateNode.getLayoutConstraint();
			newBounds.setX(oldBounds.getX() - compositeBounds.getX() - 7); //FIXME use bounds of region view
			newBounds.setY(oldBounds.getY() - compositeBounds.getY() - 34); //FIXME use bounds of region view
			
			((Node)editPart.getNotationView()).setLayoutConstraint(newBounds);
		}
	}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:14,代码来源:GroupStatesIntoCompositeRefactoring.java


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