本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}