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


Java Node类代码示例

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


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

示例1: createNode

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * @generated
 */
public Node createNode(IAdaptable semanticAdapter, View containerView,
		String semanticHint, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	final EObject domainElement = getSemanticElement(semanticAdapter);
	final int visualID;
	if (semanticHint == null) {
		visualID = StatemachineVisualIDRegistry.getNodeVisualID(
				containerView, domainElement);
	} else {
		visualID = StatemachineVisualIDRegistry.getVisualID(semanticHint);
	}
	switch (visualID) {
	case StateEditPart.VISUAL_ID:
		return createState_2001(domainElement, containerView, index,
				persisted, preferencesHint);
	}
	// can't happen, provided #provides(CreateNodeViewOperation) is correct
	return null;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:23,代码来源:StatemachineViewProvider.java

示例2: isEnabled

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
@Override
public boolean isEnabled() {
	IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	if (activeWorkbenchWindow == null)
		return false;
	ISelection selection = activeWorkbenchWindow.getActivePage().getSelection();
	if (selection == null)
		return false;
	Node unwrap = unwrap(selection);
	if (unwrap == null) {
		return false;
	}
	State state = (State) unwrap.getElement();
	if (state==null || state.isComposite())
		return false;
	BooleanValueStyle inlineStyle = DiagramPartitioningUtil.getInlineStyle(unwrap);
	if (inlineStyle != null && !inlineStyle.isBooleanValue())
		return false;
	return super.isEnabled();
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:21,代码来源:CreateSubdiagramCommand.java

示例3: decorateView

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的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

示例4: createEntryPoint

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
protected void createEntryPoint(Edge edge, Diagram subdiagram) {
	Transition transition = (Transition) edge.getElement();
	Region entryPointContainer = getEntryPointContainer(transition);
	Entry entryPoint = createSemanticEntryPoint(transition);

	// re-wire old transition to targeting the selected state
	transition.setTarget((State) subdiagram.getElement());
	View oldTarget = edge.getTarget();
	edge.setTarget(getContextObject());

	// create node for entry point
	View entryPointContainerView = helper.getViewForSemanticElement(entryPointContainer, subdiagram);
	View entryPointRegionCompartment = ViewUtil.getChildBySemanticHint(entryPointContainerView,
			SemanticHints.REGION_COMPARTMENT);
	Node entryNode = ViewService.createNode(entryPointRegionCompartment, entryPoint, SemanticHints.ENTRY,
			preferencesHint);
	ViewService.createEdge(entryNode, oldTarget, entryPoint.getOutgoingTransitions().get(0),
			SemanticHints.TRANSITION, preferencesHint);

	addEntryPointSpec(transition, entryPoint);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:22,代码来源:ExtractSubdiagramRefactoring.java

示例5: setCompositeStateLayoutConstraint

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * Iterates through all {@link StateEditPart}s of the current selection and
 * computes layout constraints for the composite node.
 * 
 * @param compositeStateNode
 *            node of the composite state
 */
protected void setCompositeStateLayoutConstraint(Node compositeStateNode) {

	Rectangle newbounds = null;
	
	for (GraphicalEditPart editPart : getContextObjects()) {
		Rectangle childBounds = editPart.getFigure().getBounds();
		if (newbounds == null)
			newbounds = childBounds.getCopy();
		
		newbounds.union(childBounds);
	}
	newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING));

	Bounds bounds = NotationFactory.eINSTANCE.createBounds();
	bounds.setX(newbounds.x);
	bounds.setY(newbounds.y);
	bounds.setWidth(newbounds.width);
	bounds.setHeight(newbounds.height);
	compositeStateNode.setLayoutConstraint(bounds);
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:28,代码来源:GroupStatesIntoCompositeRefactoring.java

示例6: createView

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
@Override
protected final Node createView(final EObject theElement, final View theContainer) {
    final Point theNextCoordinate = getTheNextCoordinate(theContainer);

    final Node theNode = super.createView(theElement, theContainer);

    final Bounds b = (Bounds) theNode.getLayoutConstraint();
    b.setX(theNextCoordinate.x);
    b.setY(theNextCoordinate.y);
    b.setWidth(getPreference(P_CLASS_DIAGRAM_ELEMENT_WIDTH));

    if (!diagrams2Nodes.containsKey(theContainer)) {
        diagrams2Nodes.put(theContainer, new ArrayList<Node>());
    }
    diagrams2Nodes.get(theContainer).add(theNode);
    return theNode;
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:18,代码来源:DiagramSynchronizer.java

示例7: getTheNextCoordinate

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
private Point getTheNextCoordinate(final View inTheContainer) {
    final int verticalPadding = getPreference(P_CLASS_DIAGRAM_VERTICAL_PADDING);
    final int column = diagrams2Nodes.containsKey(inTheContainer) ? diagrams2Nodes.get(inTheContainer).size()
            % getPreference(P_CLASS_DIAGRAM_COLUMNS) : 0;
    int theLowestBound = Math.max(DEFAULT_ORIGIN.y, DEFAULT_ORIGIN.y - verticalPadding);
    int theLeftMargin = DEFAULT_ORIGIN.x;
    for (final Node n : EcoreUtil.<Node> getObjectsByType(inTheContainer.getVisibleChildren(),
            NotationPackage.Literals.NODE)) {
        final LayoutConstraint l = n.getLayoutConstraint();
        if (NotationPackage.Literals.BOUNDS.isInstance(l)) {
            final Bounds b = (Bounds) l;
            final int aLowerBound;
            if (column == 0) {
                aLowerBound = b.getY() + verticalPadding
                        + (b.getHeight() < 0 ? getPreferredDimension(n).height : b.getHeight());
            } else {
                aLowerBound = b.getY();
            }
            theLowestBound = Math.max(theLowestBound, aLowerBound);
            theLeftMargin = Math.min(theLeftMargin, b.getX());
        }
    }
    return new Point(column * getPreference(P_CLASS_DIAGRAM_COLUMN_WIDTH) + theLeftMargin, theLowestBound);
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:25,代码来源:DiagramSynchronizer.java

示例8: createNode

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * @generated
 */
public Node createNode(IAdaptable semanticAdapter, View containerView,
		String semanticHint, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	final EObject domainElement = getSemanticElement(semanticAdapter);
	final int visualID;
	if (semanticHint == null) {
		visualID = EconomyVisualIDRegistry.getNodeVisualID(containerView,
				domainElement);
	} else {
		visualID = EconomyVisualIDRegistry.getVisualID(semanticHint);
	}
	switch (visualID) {
	case GoldEditPart.VISUAL_ID:
		return createGold_2001(domainElement, containerView, index,
				persisted, preferencesHint);
	}
	// can't happen, provided #provides(CreateNodeViewOperation) is correct
	return null;
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:23,代码来源:EconomyViewProvider.java

示例9: addDestroyChildNodesCommand

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * @generated
 */
private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
	View view = (View) getHost().getModel();
	for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
		Node node = (Node) nit.next();
		switch (StateVisualIDRegistry.getVisualID(node)) {
		case RegionRegionCitiesCompartmentEditPart.VISUAL_ID:
			for (Iterator<?> cit = node.getChildren().iterator(); cit
					.hasNext();) {
				Node cnode = (Node) cit.next();
				switch (StateVisualIDRegistry.getVisualID(cnode)) {
				case CityEditPart.VISUAL_ID:
					cmd.add(new DestroyElementCommand(
							new DestroyElementRequest(getEditingDomain(),
									cnode.getElement(), false))); // directlyOwned: true
					// don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
					// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
					break;
				}
			}
			break;
		}
	}
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:27,代码来源:RegionItemSemanticEditPolicy.java

示例10: execute

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
@Override
public void execute() {
    final View theView = (View) aViewAdapter.getAdapter(View.class);
    if (theView == null) {
        return;
    }
    final View theAttributeCompartment = getTheAttributeCompartment(theView);
    if (theAttributeCompartment == null) {
        return;
    }
    final IHintedType theViewType = (IHintedType) UMLElementTypes.getElementType(UMLVisualIDRegistry
            .getNodeVisualID(theAttributeCompartment, theSemanticElement));
    final ViewDescriptor theViewDescriptor = new ViewDescriptor(new EObjectAdapter(theSemanticElement), Node.class,
            theViewType.getSemanticHint(), ViewUtil.APPEND, false, thePreferencesHint);
    createTheView = new CreateViewCommand(theEditingDomain, theViewDescriptor, theAttributeCompartment);
    try {
        createTheView.execute(null, null);
    } catch (final ExecutionException e) {
        Activator.INSTANCE.log(e);
    }
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:22,代码来源:DiagramExt.java

示例11: createNode

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
* @generated
*/
public Node createNode(IAdaptable semanticAdapter, View containerView, String semanticHint, int index,
		boolean persisted, PreferencesHint preferencesHint) {
	final EObject domainElement = getSemanticElement(semanticAdapter);
	final int visualID;
	if (semanticHint == null) {
		visualID = edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.part.ICSE15_SequenceDiagram_MAVOVisualIDRegistry
				.getNodeVisualID(containerView, domainElement);
	} else {
		visualID = edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.part.ICSE15_SequenceDiagram_MAVOVisualIDRegistry
				.getVisualID(semanticHint);
	}
	switch (visualID) {
	case edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts.LifelineEditPart.VISUAL_ID:
		return createLifeline_2001(domainElement, containerView, index, persisted, preferencesHint);
	case edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts.ClassEditPart.VISUAL_ID:
		return createClass_2002(domainElement, containerView, index, persisted, preferencesHint);
	case edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts.MessageEditPart.VISUAL_ID:
		return createMessage_2003(domainElement, containerView, index, persisted, preferencesHint);
	case edu.toronto.cs.se.modelepedia.icse15_sequencediagram_mavo.diagram.edit.parts.OperationEditPart.VISUAL_ID:
		return createOperation_3001(domainElement, containerView, index, persisted, preferencesHint);
	}
	// can't happen, provided #provides(CreateNodeViewOperation) is correct
	return null;
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:28,代码来源:ICSE15_SequenceDiagram_MAVOViewProvider.java

示例12: addDestroyChildNodesCommand

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * @generated
 */
private void addDestroyChildNodesCommand(ICompositeCommand cmd) {
	View view = (View) getHost().getModel();
	for (Iterator<?> nit = view.getChildren().iterator(); nit.hasNext();) {
		Node node = (Node) nit.next();
		switch (edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part.NECSIS14_ClassDiagramVisualIDRegistry
				.getVisualID(node)) {
		case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.ClassClassAttributesCompartmentEditPart.VISUAL_ID:
			for (Iterator<?> cit = node.getChildren().iterator(); cit
					.hasNext();) {
				Node cnode = (Node) cit.next();
				switch (edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.part.NECSIS14_ClassDiagramVisualIDRegistry
						.getVisualID(cnode)) {
				case edu.toronto.cs.se.modelepedia.necsis14_classdiagram.diagram.edit.parts.AttributeEditPart.VISUAL_ID:
					cmd.add(new DestroyElementCommand(
							new DestroyElementRequest(getEditingDomain(),
									cnode.getElement(), false))); // directlyOwned: true
					// don't need explicit deletion of cnode as parent's view deletion would clean child views as well 
					// cmd.add(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(getEditingDomain(), cnode));
					break;
				}
			}
			break;
		}
	}
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:29,代码来源:ClassItemSemanticEditPolicy.java

示例13: createNode

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
* @generated
*/
public Node createNode(
		IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	final EObject domainElement = getSemanticElement(semanticAdapter);
	final int visualID;
	if (semanticHint == null) {
		visualID = ClassDiagramVisualIDRegistry.getNodeVisualID(containerView, domainElement);
	}
	else {
		visualID = ClassDiagramVisualIDRegistry.getVisualID(semanticHint);
	}
	switch (visualID) {
		case ClassEditPart.VISUAL_ID:
			return createClass_2001(domainElement, containerView, index, persisted, preferencesHint);
		case AttributeEditPart.VISUAL_ID:
			return createAttribute_3001(domainElement, containerView, index, persisted, preferencesHint);
		case OperationEditPart.VISUAL_ID:
			return createOperation_3002(domainElement, containerView, index, persisted, preferencesHint);
	}
	// can't happen, provided #provides(CreateNodeViewOperation) is correct
	return null;
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:26,代码来源:ClassDiagramViewProvider.java

示例14: createNode

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * @generated
 */
public Node createNode(IAdaptable semanticAdapter, View containerView,
		String semanticHint, int index, boolean persisted,
		PreferencesHint preferencesHint) {
	final EObject domainElement = getSemanticElement(semanticAdapter);
	final int visualID;
	if (semanticHint == null) {
		visualID = ArmyVisualIDRegistry.getNodeVisualID(containerView,
				domainElement);
	} else {
		visualID = ArmyVisualIDRegistry.getVisualID(semanticHint);
	}
	switch (visualID) {
	case UnitEditPart.VISUAL_ID:
		return createUnit_2001(domainElement, containerView, index,
				persisted, preferencesHint);
	}
	// can't happen, provided #provides(CreateNodeViewOperation) is correct
	return null;
}
 
开发者ID:adisandro,项目名称:MMINT,代码行数:23,代码来源:ArmyViewProvider.java

示例15: createState_2001

import org.eclipse.gmf.runtime.notation.Node; //导入依赖的package包/类
/**
 * @generated
 */
public Node createState_2001(EObject domainElement, View containerView,
		int index, boolean persisted, PreferencesHint preferencesHint) {
	Node node = NotationFactory.eINSTANCE.createNode();
	node.getStyles()
			.add(NotationFactory.eINSTANCE.createDescriptionStyle());
	node.getStyles().add(NotationFactory.eINSTANCE.createFontStyle());
	node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds());
	node.setType(StatemachineVisualIDRegistry
			.getType(StateEditPart.VISUAL_ID));
	ViewUtil.insertChildView(containerView, node, index, persisted);
	node.setElement(domainElement);
	stampShortcut(containerView, node);
	// initializeFromPreferences 
	final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint
			.getPreferenceStore();
	FontStyle nodeFontStyle = (FontStyle) node
			.getStyle(NotationPackage.Literals.FONT_STYLE);
	if (nodeFontStyle != null) {
		FontData fontData = PreferenceConverter.getFontData(prefStore,
				IPreferenceConstants.PREF_DEFAULT_FONT);
		nodeFontStyle.setFontName(fontData.getName());
		nodeFontStyle.setFontHeight(fontData.getHeight());
		nodeFontStyle.setBold((fontData.getStyle() & SWT.BOLD) != 0);
		nodeFontStyle.setItalic((fontData.getStyle() & SWT.ITALIC) != 0);
		org.eclipse.swt.graphics.RGB fontRGB = PreferenceConverter
				.getColor(prefStore, IPreferenceConstants.PREF_FONT_COLOR);
		nodeFontStyle.setFontColor(FigureUtilities.RGBToInteger(fontRGB)
				.intValue());
	}
	Node label5001 = createLabel(node,
			StatemachineVisualIDRegistry
					.getType(StateNameEditPart.VISUAL_ID));
	return node;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:38,代码来源:StatemachineViewProvider.java


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