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


Java View.getElement方法代码示例

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


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

示例1: getStatemachine_1000SemanticChildren

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
public static List<StatemachineNodeDescriptor> getStatemachine_1000SemanticChildren(
		View view) {
	if (!view.isSetElement()) {
		return Collections.emptyList();
	}
	Statemachine modelElement = (Statemachine) view.getElement();
	LinkedList<StatemachineNodeDescriptor> result = new LinkedList<StatemachineNodeDescriptor>();
	for (Iterator<?> it = modelElement.getStates().iterator(); it.hasNext();) {
		State childElement = (State) it.next();
		int visualID = StatemachineVisualIDRegistry.getNodeVisualID(view,
				childElement);
		if (visualID == StateEditPart.VISUAL_ID) {
			result.add(new StatemachineNodeDescriptor(childElement,
					visualID));
			continue;
		}
	}
	return result;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:23,代码来源:StatemachineDiagramUpdater.java

示例2: validate

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
private static void validate(DiagramEditPart diagramEditPart, View view) {
	IFile target = view.eResource() != null ? WorkspaceSynchronizer
			.getFile(view.eResource()) : null;
	if (target != null) {
		StatemachineMarkerNavigationProvider.deleteMarkers(target);
	}
	Diagnostic diagnostic = runEMFValidator(view);
	createMarkers(target, diagnostic, diagramEditPart);
	IBatchValidator validator = (IBatchValidator) ModelValidationService
			.getInstance().newValidator(EvaluationMode.BATCH);
	validator.setIncludeLiveConstraints(true);
	if (view.isSetElement() && view.getElement() != null) {
		IStatus status = validator.validate(view.getElement());
		createMarkers(target, status, diagramEditPart);
	}
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:20,代码来源:ValidateAction.java

示例3: getSubDiagrams

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
protected List<Diagram> getSubDiagrams(List views) {
	List<Diagram> subDiagrams = new ArrayList<Diagram>();
	Iterator iter = views.iterator();
	while (iter.hasNext()) {
		View viewElement = (View) iter.next();
		if (viewElement != null) {
			EObject semanticElement = viewElement.getElement();
			if (semanticElement instanceof State) {
				collectSubdiagramsInState(subDiagrams, (State) semanticElement);
			} else if (semanticElement instanceof Region) {
				collectSubdiagramsInRegion(subDiagrams, (Region) semanticElement);
			}
		}
	}
	return subDiagrams;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:17,代码来源:SubdiagramAwareCopyCommand.java

示例4: getSemanticPasteTarget

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * Customized Method to find the semantic target which should contain the
 * copied elements.
 * 
 * @param view
 * @param container
 * @return the semantic target.
 */
public static EObject getSemanticPasteTarget(View view, View container) {
	EObject copiedSemanticObject = view.getElement();
	EObject semanticTarget = container.getElement();
	if (copiedSemanticObject instanceof Transition) {
		semanticTarget = copiedSemanticObject.eContainer();
	}
	EList<EReference> eAllReferences = semanticTarget.eClass()
			.getEAllReferences();
	for (EReference eReference : eAllReferences) {
		EClass eReferenceType = eReference.getEReferenceType();
		if (eReference.isContainment()
				&& eReferenceType.isSuperTypeOf(copiedSemanticObject
						.eClass())) {
			return semanticTarget;
		}
	}
	return null;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:27,代码来源:NotationClipboardOperationHelper.java

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

示例6: getModel

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
@Override
public EObject getModel(Object element) {
	View view = ((IDiagramElementEditPart) element).getNotationView();
	if (view.getElement() instanceof DNode) {
		return ((DNode) view.getElement()).getTarget();
	} else {
		return view.getElement();
	}
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:10,代码来源:StatemachineSiriusActivator.java

示例7: getStatemachine_1000ContainedLinks

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
public static List<StatemachineLinkDescriptor> getStatemachine_1000ContainedLinks(
		View view) {
	Statemachine modelElement = (Statemachine) view.getElement();
	LinkedList<StatemachineLinkDescriptor> result = new LinkedList<StatemachineLinkDescriptor>();
	result.addAll(getContainedTypeModelFacetLinks_Transition_4001(modelElement));
	return result;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:11,代码来源:StatemachineDiagramUpdater.java

示例8: getState_2001IncomingLinks

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
public static List<StatemachineLinkDescriptor> getState_2001IncomingLinks(
		View view) {
	State modelElement = (State) view.getElement();
	Map<EObject, Collection<EStructuralFeature.Setting>> crossReferences = EcoreUtil.CrossReferencer
			.find(view.eResource().getResourceSet().getResources());
	LinkedList<StatemachineLinkDescriptor> result = new LinkedList<StatemachineLinkDescriptor>();
	result.addAll(getIncomingTypeModelFacetLinks_Transition_4001(
			modelElement, crossReferences));
	return result;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:14,代码来源:StatemachineDiagramUpdater.java

示例9: getState_2001OutgoingLinks

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
public static List<StatemachineLinkDescriptor> getState_2001OutgoingLinks(
		View view) {
	State modelElement = (State) view.getElement();
	LinkedList<StatemachineLinkDescriptor> result = new LinkedList<StatemachineLinkDescriptor>();
	result.addAll(getOutgoingTypeModelFacetLinks_Transition_4001(modelElement));
	return result;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:11,代码来源:StatemachineDiagramUpdater.java

示例10: runEMFValidator

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
private static Diagnostic runEMFValidator(View target) {
	if (target.isSetElement() && target.getElement() != null) {
		return new Diagnostician() {

			public String getObjectLabel(EObject eObject) {
				return EMFCoreUtil.getQualifiedName(eObject, true);
			}
		}.validate(target.getElement());
	}
	return Diagnostic.OK_INSTANCE;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:15,代码来源:ValidateAction.java

示例11: getText

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * @generated
 */
public String getText(View view) {
	if (view.getElement() != null && view.getElement().eIsProxy()) {
		return getUnresolvedDomainElementProxyText(view);
	}
	switch (StatemachineVisualIDRegistry.getVisualID(view)) {
	case StatemachineEditPart.VISUAL_ID:
		return getStatemachine_1000Text(view);
	case StateEditPart.VISUAL_ID:
		return getState_2001Text(view);
	case TransitionEditPart.VISUAL_ID:
		return getTransition_4001Text(view);
	}
	return getUnknownElementText(view);
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:18,代码来源:StatemachineNavigatorLabelProvider.java

示例12: decorate

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
protected void decorate(View view) {
	List<SCTIssue> issues = store.getIssues(semanticID);
	SCTIssue subDiagramIssue = getSubDiagramIssue(view);
	if (subDiagramIssue != null)
		issues.add(subDiagramIssue);
	Severity severity = Severity.INFO;
	Label toolTip = null;
	if (issues.isEmpty())
		return;
	for (int i = 0; i < issues.size(); i++) {
		Issue issue = issues.get(i);
		Severity nextSeverity = issue.getSeverity();
		Image nextImage = getImage(nextSeverity);
		if (toolTip == null) {
			toolTip = new Label(issue.getMessage(), nextImage);
		} else {
			if (toolTip.getChildren().isEmpty()) {
				Label comositeLabel = new Label();
				FlowLayout fl = new FlowLayout(false);
				fl.setMinorSpacing(0);
				comositeLabel.setLayoutManager(fl);
				comositeLabel.add(toolTip);
				toolTip = comositeLabel;
			}
			toolTip.add(new Label(issue.getMessage(), nextImage));
		}
		severity = (nextSeverity.ordinal() < severity.ordinal()) ? nextSeverity : severity;
	}

	if (view instanceof Edge) {
		setDecoration(getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true));
		getDecoration().setToolTip(toolTip);
	} else {
		int margin = view.getElement() instanceof Pseudostate || view.getElement() instanceof FinalState ? 0
				: -1;
		setDecoration(getDecoratorTarget().addShapeDecoration(getImage(severity),
				IDecoratorTarget.Direction.NORTH_EAST, margin, false));
		getDecoration().setToolTip(toolTip);
	}
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:41,代码来源:StatechartValidationDecorationProvider.java

示例13: getSubDiagramIssue

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
protected SCTIssue getSubDiagramIssue(View view) {
	if (SemanticHints.STATE.equals(view.getType())) {
		BooleanValueStyle style = GMFNotationUtil.getBooleanValueStyle(view,
				DiagramPartitioningUtil.INLINE_STYLE);
		if (style == null ? false : !style.isBooleanValue()) {
			EObject element = view.getElement();
			TreeIterator<EObject> eAllContents = element.eAllContents();
			while (eAllContents.hasNext()) {
				EObject next = eAllContents.next();
				if(next instanceof Transition && next.eContainer() == element) {
					eAllContents.prune();
					continue;
				}
				String semanticURI = EcoreUtil.getURI(next).fragment();
				List<SCTIssue> issues = store.getIssues(semanticURI);
				for (final SCTIssue issue : issues) {
					if (Severity.ERROR.equals(issue.getSeverity())) {
						IssueImpl result = new Issue.IssueImpl();
						result.setMessage(SUB_DIAGRAM_ERRORS);
						result.setSeverity(Severity.ERROR);
						return new SCTIssue(result, issue.getSemanticURI());
					}
				}
			}
		}
	}
	return null;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:29,代码来源:StatechartValidationDecorationProvider.java

示例14: createSubdiagram

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
/**
 * Creates a new {@link Diagram} and copies child elements
 */
protected Diagram createSubdiagram() {
	View contextView = getContextObject();
	State contextElement = (State) contextView.getElement();
	Diagram subdiagram = ViewService.createDiagram(contextElement, StatechartDiagramEditor.ID, preferencesHint);
	View figureCompartment = ViewUtil.getChildBySemanticHint(contextView, SemanticHints.STATE_FIGURE_COMPARTMENT);
	getResource().getContents().add(subdiagram);
	while (figureCompartment.getChildren().size() > 0) {
		subdiagram.insertChild((View) figureCompartment.getChildren().get(0));
	}
	return subdiagram;
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:15,代码来源:ExtractSubdiagramRefactoring.java

示例15: addElementsToDiagram

import org.eclipse.gmf.runtime.notation.View; //导入方法依赖的package包/类
@Override
public void addElementsToDiagram(List<Element> elements){
	
	/* The diagram creation creates an empty StateMachine, but it may have more Regions. 
	 * So we delete it and place it on the diagram again.  */
	EditPart stateMachineEditpart = (EditPart) diagramEditPart.getChildren().get(0);
	View smModel = (View) stateMachineEditpart.getModel();
	Element smElement = (Element) smModel.getElement();
	
	ElementsManagerUtils.removeEditParts(diagramEditPart.getEditingDomain(), Arrays.asList(stateMachineEditpart));
	ElementsManagerUtils.addElementsToEditPart(diagramEditPart, Arrays.asList(smElement));
	
	EditPart newStateMachineEditpart = (EditPart) diagramEditPart.getChildren().get(0);
	fillState(newStateMachineEditpart, elements);
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:16,代码来源:StateMachineDiagramElementsManager.java


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