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


Java ShapeNodeEditPart类代码示例

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


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

示例1: setInitialSelection

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Initializes the input filename.
 */
private void setInitialSelection() {
    if (selection == null) {
        return;
    }
    if (selection instanceof ITreeSelection) {
        ITreeSelection treeSelection = (ITreeSelection) selection;
        if (treeSelection.size() == 1 && treeSelection.getFirstElement() instanceof IFile) {
            IFile selFile = (IFile) treeSelection.getFirstElement();
            if (inputFileExtension.equals(selFile.getFileExtension())) {
                inputFilePath.setText(selFile.getFullPath().toString());
            }
        }
    }
    if (selection.getFirstElement() instanceof ShapeNodeEditPart) {
        inputFilePath.setText(inputModelFilePath);
    }
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:21,代码来源:AbstractXmlConversionWizardPage.java

示例2: getChildUUIDs

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Returns the set of strings those represents the ID of the children of the specified argument edit part.
 * 
 * @param argumentEditPart the argument edit part.
 * @return IDs of the children.
 */
public static Set<String> getChildUUIDs(ArgumentEditPart argumentEditPart) {

    if (argumentEditPart == null) {
        return null;
    }

    XMLResource resource = getXMLResource(argumentEditPart);
    if (resource == null) {
        return null;
    }

    Set<String> idSet = new HashSet<String>(COLLECTION_INITIAL_CAPACITY);
    for (Object obj : argumentEditPart.getChildren()) {
        if (obj instanceof ShapeNodeEditPart) {
            ShapeNodeEditPart nodeEditPart = (ShapeNodeEditPart) obj;
            String id = getUUIDs(nodeEditPart, resource);
            if (id != null) {
                idSet.add(id);
            }
        }
    }

    return idSet;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:31,代码来源:DcaseEditorUtil.java

示例3: doProcess

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Selects edit parts excluding specified edit parts.
 */
private void doProcess() {

    XMLResource resource = DcaseEditorUtil.getXMLResource(argumentEditPart);
    int counter = 0;
    for (Object obj : argumentEditPart.getChildren()) {

        if (!(obj instanceof ShapeNodeEditPart)) {
            continue;
        }
        
        ShapeNodeEditPart nodeEditPart = (ShapeNodeEditPart) obj;

        String id = DcaseEditorUtil.getUUIDs(nodeEditPart, resource);
        if (excludeIdSet.contains(id)) {
            continue;
        }

        if (counter == 0) {
            argumentEditPart.getViewer().select(nodeEditPart);
        } else {
            argumentEditPart.getViewer().appendSelection(nodeEditPart);
        }
        counter++;
    }
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:29,代码来源:SelectExcludesCommand.java

示例4: collectEditpartsToShow

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Add the children to show to the map.
 * 
 * @param editPart the parent node.
 */
private void collectEditpartsToShow(ShapeNodeEditPart editPart) {
    for (Object link : editPart.getSourceConnections()) {
        ConnectionNodeEditPart dLink = (ConnectionNodeEditPart) link;
        if (!dLink.getFigure().isVisible()) {
            // checks descendants.
            collectEditpartsToShow((ShapeNodeEditPart) (dLink.getTarget()));
            changeVisibleEditPartSet.add(dLink);
        }
    }
    if (((DcaseDelegateNodeEditPart) editPart).getBackgroundColorEx() == CONST_HIDE_COLOR) {
        changeBackgroundColorEditPartMap.put(
                (DcaseDelegateNodeEditPart) editPart, CONST_SHOW_COLOR);
    }
    // doesn't add the selected node to the map.
    if (editPart != selectedElement) {
        changeVisibleEditPartSet.add(editPart);
    }
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:24,代码来源:NodeChildrenShowHandler.java

示例5: getTargetEditPart

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Returns the list of the children of the selected node.
 * 
 * @param selectedElement the selected node.
 * @return the list of the children of the selected node.
 */
@SuppressWarnings("unchecked")
private List<ConnectionNodeEditPart> getTargetEditPart(
        ShapeNodeEditPart selectedElement) {

    List<ConnectionNodeEditPart> targetLinks = new ArrayList<ConnectionNodeEditPart>();
    // gets links.
    List<ConnectionNodeEditPart> sourceLinks = selectedElement
            .getSourceConnections();
    
    for (ConnectionNodeEditPart editPart : sourceLinks) {
        if (DcaseEditorUtil.isDcaseLinkEditPart(editPart)) {
            targetLinks.add(editPart);
        }
    }
    return targetLinks;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:23,代码来源:SetSiblingOrderHandler.java

示例6: doExecuteWithResult

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
        IAdaptable info) throws ExecutionException {

    // gets the EditParts to arrange layout.
    XMLResource resource = DcaseEditorUtil.getXMLResource(argumentEditPart);
    List<ShapeNodeEditPart> selectedEditPartList = new ArrayList<ShapeNodeEditPart>(
            COLLECTION_INITIAL_CAPACITY);
    for (Object obj : argumentEditPart.getChildren()) {

        if (!(obj instanceof ShapeNodeEditPart)) {
            continue;
        }

        ShapeNodeEditPart nodeEditPart = (ShapeNodeEditPart) obj;

        // tests whether the EditPart is to exclude.
        String id = DcaseEditorUtil.getUUIDs(nodeEditPart, resource);
        if (excludeIdSet.contains(id)) {
            continue;
        }

        selectedEditPartList.add(nodeEditPart);
    }

    // creates a command.
    ArrangeRequest request = new ArrangeRequest(
            RequestConstants.REQ_ARRANGE_DEFERRED);
    request.setViewAdaptersToArrange(selectedEditPartList);
    Command arrangeCommand = argumentEditPart.getCommand(request);

    // executes the command.
    arrangeCommand.execute();

    return CommandResult.newOKCommandResult();
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:37,代码来源:ArrangeExcludesCommand.java

示例7: checkJunctionLink

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Tests if the conjunction is exists.Throws the exception if the conjunction is detected.
 * 
 * @param editPart the node to test.
 */
private void checkJunctionLink(ShapeNodeEditPart editPart) {
    if (editPart.getTargetConnections().size() > 1) {
        throw new DcaseRuntimeException(Messages.NodeChildrenHideHandler_1,
                null, null, 0, MessageTypeImpl.HIDE_CHILDREN_HIDE_FAILED);
    }
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:12,代码来源:NodeChildrenHideHandler.java

示例8: getChildrenToShow

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Returns the children to show.
 * 
 * @param root the root.
 * @return the children to show.
 */
public Set<GraphicalEditPart> getChildrenToShow(ShapeNodeEditPart root) {
    selectedElement = root;
    initialize();
    collectEditpartsToShow(selectedElement);
    return changeVisibleEditPartSet;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:13,代码来源:NodeChildrenShowHandler.java

示例9: selectSubtree

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
public boolean selectSubtree(GraphicalEditPart editPart,
		GraphicalEditPart rootEditPart) {
	String uuid = DcaseEditorUtil.getUUIDs(editPart);
	// do not check junction link
	if (!checkedNodeList.contains(uuid)) {
		checkedNodeList.add(uuid);
	} else if (editPart != rootEditPart) {
		return true;
	} else {
		MessageWriter.writeMessageToConsole(Messages.CreateModuleHandler_4,
				MessageTypeImpl.MODULE_FILE_CREATE_FAILED);
		return false;
	}
	for (Object link : editPart.getSourceConnections()) {
		if (link instanceof ConnectionNodeEditPart) {
			ConnectionNodeEditPart dLink = (ConnectionNodeEditPart) link;
			if (!linkEditPartSet.contains(dLink)) {
				linkEditPartSet.add(dLink);
			} else {
				MessageWriter.writeMessageToConsole(
						Messages.CreateModuleHandler_5,
						MessageTypeImpl.MODULE_FILE_CREATE_FAILED);
				return false;
			}
			if (!selectSubtree((ShapeNodeEditPart) dLink.getTarget(),
					rootEditPart)) {
				return false;
			}

		} else {
			MessageWriter.writeMessageToConsole(
					Messages.CreateModuleHandler_6,
					MessageTypeImpl.MODULE_FILE_CREATE_FAILED);
			return false;
		}
	}
	if (!nodeEditPartSet.contains(editPart)) {
		nodeEditPartSet.add(editPart);
	} else {
		MessageWriter.writeMessageToConsole(Messages.CreateModuleHandler_7,
				MessageTypeImpl.MODULE_FILE_CREATE_FAILED);
		return false;
	}

	return true;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:47,代码来源:CreateModuleHandler.java

示例10: getHideNodeChildren

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Add the children to hide to the map.
 * Throws exception if the looped link,the conjunction or the link besides D-Case links is detected.
 * 
 * @param editPart the parent node.
 */
private void getHideNodeChildren(ShapeNodeEditPart editPart) {

    String uuid = DcaseEditorUtil.getUUIDs(editPart);
    // adds to the history.
    cyclicRoute.add(uuid);

    // checks the conjunction.
    if (selectedElement != editPart) {
        checkJunctionLink(editPart);
    }

    // checks the looped link.
    if (!checkedNodeList.contains(uuid)) {
        checkedNodeList.add(uuid);
    } else {
        MessageWriter.writeMessageToConsole(NLS.bind(
                "Cyclic state was found.({0})", cyclicRoute.toString()), //$NON-NLS-1$
                MessageTypeImpl.DIAGNOSIS);
        throw new DcaseRuntimeException(Messages.NodeChildrenHideHandler_0,
                null, null, 0, MessageTypeImpl.HIDE_CHILDREN_HIDE_FAILED);
    }
    
    for (Object link : editPart.getSourceConnections()) {
        // throws exception if the link besides the D-Case links is detected.
        if (!DcaseEditorUtil.isDcaseLinkEditPart(link)) {
            throw new DcaseRuntimeException(
                    Messages.NodeChildrenHideHandler_3, null, null, 0,
                    MessageTypeImpl.HIDE_CHILDREN_HIDE_FAILED);
        }
        ConnectionNodeEditPart dLink = (ConnectionNodeEditPart) link;
        if (dLink.getFigure().isVisible()) {
            // checks descendants.
            getHideNodeChildren((ShapeNodeEditPart) (dLink.getTarget()));
            changeVisibleEditPartSet.add(dLink);
        }
    }
    // doesn't add the selected node to the map.
    if (selectedElement != editPart) {
        changeVisibleEditPartSet.add(editPart);
    }
    cyclicRoute.removeLast();
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:49,代码来源:NodeChildrenHideHandler.java

示例11: execute

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Set sibling order to children of the selected node.
 * 
 * @param event ExecutionEvent
 * @return the result of the execution.
 * @throws ExecutionException if an exception occurred during execution.
 */
public Object execute(ExecutionEvent event) throws ExecutionException {

    // gets the edit part that represents the selected node.
    ShapeNodeEditPart selectedElement = getSelectedElement(event);
    if (selectedElement != null) {
        // gets children of the selected node.
        List<ConnectionNodeEditPart> editPartList = getTargetEditPart(selectedElement);

        if (editPartList != null && !editPartList.isEmpty()) {
            CompoundCommand cc = new CompoundCommand(
                    Menus.SetSiblingOrderHandler_0);

            TransactionalEditingDomain currentDomain = DcaseEditorUtil
                    .getCurrentArgumentEditPart().getEditingDomain();

            // sorts links by position of the target node.
            Collections.sort(editPartList, getBasicLinkComparator());

            int order = 1;
            for (ConnectionNodeEditPart editPart : editPartList) {
                // gets the link.
                BasicLink basicLink = (BasicLink) DcaseEditorUtil
                        .getElement(editPart);

                // sets the sibling order.
                Map<AttributeType, Object> attrMap = new HashMap<AttributeType, Object>();
                attrMap.put(AttributeType.SIBLINGORDER, Integer
                        .toString(order++));

                ICommand changeCommand = new ChangeBasicLinkPropertyTransactionCommand(
                        currentDomain, Menus.SetSiblingOrderHandler_0,
                        null, basicLink, attrMap);
                cc.add(new ICommandProxy(changeCommand));
            }
            if (!cc.isEmpty()) {
                selectedElement.getDiagramEditDomain()
                        .getDiagramCommandStack().execute(cc);
            }
        }
    }
    return null;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:50,代码来源:SetSiblingOrderHandler.java

示例12: createCommand

import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; //导入依赖的package包/类
/**
 * Returns the compound command for converting the node type.
 * 
 * @return the command.
 */
public CompoundCommand createCommand() {
	Argument currentArgument = (Argument) currentDiagram.getElement();
	if (currentArgument == null) {
		return null;
	}

	Set<String> excludeIdSet = DcaseEditorUtil
			.getChildUUIDs(currentArgumentEditPart);

	CompoundCommand cc = new CompoundCommand(CONVERT_NODE_TYPE_CMD_LABEL);

	PreferencesHint diagramPrefHint = currentArgumentEditPart
			.getDiagramPreferencesHint();

	// shows children.
	NodeChildrenShowHandler showHandler = new NodeChildrenShowHandler();
	ChangeVisibleEditPartsCommand changeVisibleEditPartsCommand = new ChangeVisibleEditPartsCommand(
			CONST_CHANGE_VISIBLE_COMMAND_LABEL,
			showHandler
					.getChildrenToShow((ShapeNodeEditPart) currentEditPart),
			true);
	cc.add(new ICommandProxy(changeVisibleEditPartsCommand));

	IElementType elementType = getElementType(newNodeType);

	ViewAndElementDescriptor descriptor = new ViewAndElementDescriptor(
			new CreateElementRequestAdapter(new CreateElementRequest(
					elementType)), Node.class,
			((IHintedType) elementType).getSemanticHint(), diagramPrefHint);

	CreateViewAndElementRequest createNodeRequest = new CreateViewAndElementRequest(
			descriptor);
	createNodeRequest
			.setLocation(getNewNodeAbsoluteLocation(currentEditPart));
	createNodeRequest.setSize(new Dimension(-1, -1));
	Command createNodeCommand = currentArgumentEditPart
			.getCommand(createNodeRequest);
	cc.add(createNodeCommand);

	UpdateLinkCommand convertLinkCommand = new UpdateLinkCommand(
			currentDomain, UPDATE_BASICLINK_COMMAND_LABEL, currentArgument,
			oldNode, currentArgumentEditPart, createNodeRequest);
	cc.add(new ICommandProxy(convertLinkCommand));

	CopyNodeAttributeCommand copyAttributeCommand = new CopyNodeAttributeCommand(
			currentDomain, COPY_NODE_ATTRIBUTE_COMMAND_LABEL, oldNode,
			currentArgumentEditPart, createNodeRequest, newName);
	cc.add(new ICommandProxy(copyAttributeCommand));

	ICommand selectCommand = new SelectExcludesCommand(
			SELECT_COMMAND_LABEL, currentArgumentEditPart, excludeIdSet);
	cc.add(new ICommandProxy(selectCommand));
	return cc;
}
 
开发者ID:d-case,项目名称:d-case_editor,代码行数:60,代码来源:ConvertNodeTypeUtil.java


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