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


Java RemoveCommand类代码示例

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


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

示例1: clear

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Clears everything in the given model.
 *
 * @param model the {@link GModel} to be cleared
 */
public static void clear(final GModel model) {

    final EditingDomain editingDomain = getEditingDomain(model);

    if (editingDomain != null) {
        final CompoundCommand command = new CompoundCommand();

        command.append(RemoveCommand.create(editingDomain, model, CONNECTIONS, model.getConnections()));
        command.append(RemoveCommand.create(editingDomain, model, NODES, model.getNodes()));

        if (command.canExecute()) {
            editingDomain.getCommandStack().execute(command);
        }
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:21,代码来源:Commands.java

示例2: setNewJoints

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Removes any existing joints from the connection and creates a new set of joints at the given positions.
 *
 * <p>
 * This is executed as a single compound command and is therefore a single element in the undo-redo stack.
 * </p>
 *
 * @param positions a list of {@link Point2D} instances speciying the x and y positions of the new joints
 * @param connection the connection in which the joints will be set
 */
public static void setNewJoints(final List<Point2D> positions, final GConnection connection) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(connection);
    final CompoundCommand command = new CompoundCommand();

    command.append(RemoveCommand.create(editingDomain, connection, JOINTS, connection.getJoints()));

    for (final Point2D position : positions) {

        final GJoint newJoint = ModelFactory.eINSTANCE.createGJoint();
        newJoint.setX(position.getX());
        newJoint.setY(position.getY());

        command.append(AddCommand.create(editingDomain, connection, JOINTS, newJoint));
    }

    if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:31,代码来源:JointCommands.java

示例3: removeConnection

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Removes a connection from the model.
 *
 * @param model the {@link GModel} from which the connection should be removed
 * @param connection the {@link GConnection} to be removed
 * @return the newly-executed {@link CompoundCommand} that removed the connection
 */
public static CompoundCommand removeConnection(final GModel model, final GConnection connection) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(model);

    if (editingDomain != null) {
        final CompoundCommand command = new CompoundCommand();

        final GConnector source = connection.getSource();
        final GConnector target = connection.getTarget();

        command.append(RemoveCommand.create(editingDomain, model, CONNECTIONS, connection));
        command.append(RemoveCommand.create(editingDomain, source, CONNECTOR_CONNECTIONS, connection));
        command.append(RemoveCommand.create(editingDomain, target, CONNECTOR_CONNECTIONS, connection));

        if (command.canExecute()) {
            editingDomain.getCommandStack().execute(command);
        }
        return command;

    } else {
        return null;
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:31,代码来源:ConnectionCommands.java

示例4: setNewJoints

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Removes any existing joints from the connection and creates a new set of joints at the given positions.
 *
 * <p>
 * This is executed as a single compound command and is therefore a single element in the undo-redo stack.
 * </p>
 *
 * @param positions a list of {@link Point2D} instances speciying the x and y positions of the new joints
 * @param connection the connection in which the joints will be set
 */
public static void setNewJoints(final List<Point2D> positions, final GConnection connection) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(connection);
    final CompoundCommand command = new CompoundCommand();

    command.append(RemoveCommand.create(editingDomain, connection, JOINTS, connection.getJoints()));

    for (final Point2D position : positions) {

        final GJoint newJoint = GraphFactory.eINSTANCE.createGJoint();
        newJoint.setX(position.getX());
        newJoint.setY(position.getY());

        command.append(AddCommand.create(editingDomain, connection, JOINTS, newJoint));
    }

    if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
    }
}
 
开发者ID:tesis-dynaware,项目名称:graph-editor,代码行数:31,代码来源:JointCommands.java

示例5: setMaster

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
public void setMaster ( final MasterServer master, final MasterMode masterMode )
{
    final CompoundManager manager = new CompoundManager ();

    for ( final MasterAssigned v : SelectionHelper.iterable ( getSelection (), MasterAssigned.class ) )
    {
        final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( v );
        if ( domain == null )
        {
            continue;
        }

        switch ( masterMode )
        {
            case ADD:
                manager.append ( domain, AddCommand.create ( domain, v, ComponentPackage.Literals.MASTER_ASSIGNED__MASTER_ON, master ) );
                break;
            case REPLACE:
                manager.append ( domain, SetCommand.create ( domain, v, ComponentPackage.Literals.MASTER_ASSIGNED__MASTER_ON, Collections.singletonList ( master ) ) );
                break;
            case DELETE:
                manager.append ( domain, RemoveCommand.create ( domain, v, ComponentPackage.Literals.MASTER_ASSIGNED__MASTER_ON, master ) );
                break;
        }
    }

    manager.executeAll ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:29,代码来源:SetMasterHandler.java

示例6: removeJoints

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Removes joints from a connection.
 *
 * <p>
 * This method adds the remove operations to the given compound command and does not execute it.
 * </p>
 *
 * @param command a {@link CompoundCommand} to which the remove commands will be added
 * @param indices the indices within the connection's list of joints specifying the joints to be removed
 * @param connection the connection whose joints are to be removed
 */
public static void removeJoints(final CompoundCommand command, final Set<Integer> indices,
        final GConnection connection) {

    final EditingDomain editingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(connection);

    for (int i = 0; i < connection.getJoints().size(); i++) {
        if (indices.contains(i)) {
            final GJoint joint = connection.getJoints().get(i);
            command.append(RemoveCommand.create(editingDomain, connection, JOINTS, joint));
        }
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:24,代码来源:JointCommands.java

示例7: remove

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Removes all specified nodes and connections from the model in a single compound command.
 *
 * <p>
 * All references to the removed elements are also removed.
 * </p>
 *
 * @param nodesToRemove the nodes to be removed
 * @param connectionsToRemove the connections to be removed
 */
public CompoundCommand remove(final List<GNode> nodesToRemove, final List<GConnection> connectionsToRemove) {

    final CompoundCommand command = new CompoundCommand();

    for (final GNode node : nodesToRemove) {
        command.append(RemoveCommand.create(editingDomain, model, NODES, node));
    }

    for (final GConnection connection : connectionsToRemove) {
        command.append(RemoveCommand.create(editingDomain, model, CONNECTIONS, connection));

        final GConnector source = connection.getSource();
        final GConnector target = connection.getTarget();

        if (!nodesToRemove.contains(source.getParent())) {
            command.append(RemoveCommand.create(editingDomain, source, CONNECTOR_CONNECTIONS, connection));
        }

        if (!nodesToRemove.contains(target.getParent())) {
            command.append(RemoveCommand.create(editingDomain, target, CONNECTOR_CONNECTIONS, connection));
        }
    }

    if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
    }

    return command;
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:40,代码来源:ModelEditingManager.java

示例8: checkAndReload

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
protected void checkAndReload(Command command) {
	if (command instanceof DeleteCommand
			|| command instanceof CompoundCommand
			|| command instanceof AddCommand
			|| command instanceof RemoveCommand) {
		loadRelations();

	}

	
}
 
开发者ID:cplutte,项目名称:bts,代码行数:12,代码来源:CommentEditorDialog.java

示例9: checkAndReload

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
private void checkAndReload(Command command) {
	if (command instanceof DeleteCommand
			|| command instanceof CompoundCommand
			|| command instanceof AddCommand
			|| command instanceof RemoveCommand) {
		CTabItem tabItem = tabFolder.getSelection();
		reloadGenericTabItem(tabItem);
		tabItem.setData("reloaded", genericTabsReloadRequiredCounter++);

	}

}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:PassportEditorPart.java

示例10: createRemoveConstraintCommand

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
private Command createRemoveConstraintCommand(Class<? extends ColumnConstraint> constraintClass) {
	for (ColumnConstraint constraint : column.getConstraints()) {
		if (constraintClass.isInstance(constraint)) {
			return RemoveCommand.create(getEditingDomain(), 
					column, 
					ColumnPackage.Literals.COLUMN__CONSTRAINTS, 
					constraint);
		}
	}
	return null;
}
 
开发者ID:yatechorg,项目名称:sqlite-db-modeler-plugin-4android,代码行数:12,代码来源:ColumnEditingFacade.java

示例11: createRemoveConstraintCommand

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
private Command createRemoveConstraintCommand(Class<? extends TableConstraint> constraintClass) {
	for (TableConstraint constraint : table.getConstraints()) {
		if (constraintClass.isInstance(constraint)) {
			return RemoveCommand.create(getEditingDomain(), 
					table, 
					TablePackage.Literals.TABLE__CONSTRAINTS, 
					constraint);
		}
	}
	return null;
}
 
开发者ID:yatechorg,项目名称:sqlite-db-modeler-plugin-4android,代码行数:12,代码来源:TableEditingFacade.java

示例12: removeEditParts

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
/**
 * Calls the {@link RemoveCommand} on an EditPart. 
 * @param editingDomain - the domain required by {@link RemoveCommand#create(EditingDomain, Object)}. It is the EditingDomain of the {@link DiagramEditPart}
 * @param editParts - the EditParts that are to be removed
 */
public static void removeEditParts(EditingDomain editingDomain, List<EditPart> editParts) {
		List<Object> modelElements = new LinkedList<Object>();
		for(EditPart editPart : editParts){
			modelElements.add(editPart.getModel());
		}
		
		org.eclipse.emf.common.command.Command command = RemoveCommand.create(editingDomain, modelElements);
		if(command instanceof RemoveCommand){
			RemoveCommand removeCommand = (RemoveCommand) command;
			editingDomain.getCommandStack().execute(removeCommand);
		}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:18,代码来源:ElementsManagerUtils.java

示例13: getCommand

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
@Override
public Command getCommand(Request request) {
	if (RequestConstants.REQ_DELETE == request.getType()) {
		EditingDomain domain = EMFUtils.getAnyDomain(conditions);
		final org.eclipse.emf.common.command.Command emfCommand = RemoveCommand.create(domain, conditions);
		return new EMFCommandWrapper(domain, emfCommand);
	}
	return super.getCommand(request);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:10,代码来源:ResourceConditionTimelineService.java

示例14: closeTimelineViewer

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
protected void closeTimelineViewer() {
	Object contentObject = getTimelineSectionModel();
	if (contentObject != null) {
		ETimeline timelineModel = getTimeline().getTimelineModel();
		EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(timelineModel);
		EReference featureReference = getContentsReference();
		Command command = RemoveCommand.create(domain, timelineModel, featureReference, Collections.singleton(contentObject));
		EMFUtils.executeCommand(domain, command);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:11,代码来源:TimelineViewer.java

示例15: removeRow

import org.eclipse.emf.edit.command.RemoveCommand; //导入依赖的package包/类
public void removeRow() {
	if (currentInput == null) {
		return;
	}
	TreeTableViewer viewer = null;
	int index = tabFolder.getSelectionIndex();
	switch (index) {
	case 0:
		viewer = equalityTableViewer;
		break;
	case 1:
		viewer = envelopeTableViewer;
		break;
	case 2:
		viewer = effectTableViewer;
		break;
	}
	if (viewer != null) {
		ISelection selection = viewer.getSelection();
		if (selection instanceof StructuredSelection) {
			List list = ((StructuredSelection) selection).toList();
			EditingDomain domain = planEditorModel.getEditingDomain();
			Command command = RemoveCommand.create(domain, list);
			EMFUtils.executeCommand(domain, command);
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:ProfileEffectsAndRequirementsPage.java


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