本文整理汇总了Java中org.eclipse.emf.edit.command.RemoveCommand.create方法的典型用法代码示例。如果您正苦于以下问题:Java RemoveCommand.create方法的具体用法?Java RemoveCommand.create怎么用?Java RemoveCommand.create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.edit.command.RemoveCommand
的用法示例。
在下文中一共展示了RemoveCommand.create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
}
示例4: 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);
}
示例5: 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);
}
}
示例6: 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);
}
}
}
示例7: getRemoveCommand
import org.eclipse.emf.edit.command.RemoveCommand; //导入方法依赖的package包/类
/**
* The remove command to return may be a simple straight-forward remove command
* or it may be a complicated remove command where we are trying to remove an item from a
* table open a multi-valued attribute.
*
* @return an appropriate remove command.
*/
private Command getRemoveCommand(
final EditingDomain editingDomain,
final TreeTableViewer<EObject, EAttribute> treeTableViewer,
List list) {
Command command = RemoveCommand.create(editingDomain, list);
if(command instanceof UnexecutableCommand) {
IContentProvider contentProvider = treeTableViewer.getContentProvider();
if(contentProvider instanceof EMFTreeTableContentProvider) {
EMFTreeTableContentProvider emfContentProvider = (EMFTreeTableContentProvider)contentProvider;
EStructuralFeature structuralFeature = emfContentProvider.getStructuralFeature();
EObject owner = null;
if(structuralFeature instanceof EAttribute && structuralFeature.isMany()) {
List itemsToRemove = new ArrayList();
for(Object object : list) {
if(object instanceof EObjectIndexPair) {
EObjectIndexPair pair = (EObjectIndexPair) object;
if(owner == null) {
owner = pair.getObject();
} else if(owner.equals(pair.getObject())) {
LogUtil.warn("object index pairs in the same list have different owners.");
continue;
}
int index = pair.getIndex();
List values = (List) owner.eGet(structuralFeature);
Object selectedValue = values.get(index);
itemsToRemove.add(selectedValue);
}
}
command = RemoveCommand.create(editingDomain, owner, structuralFeature, itemsToRemove);
}
}
}
return command;
}
示例8: createSetValueCommand
import org.eclipse.emf.edit.command.RemoveCommand; //导入方法依赖的package包/类
private Command createSetValueCommand(Object value) {
Command cmd = null;
List list = (List)target.eGet(feature);
boolean contains = list.contains(this.value);
if (Boolean.TRUE == value && !contains) {
cmd = AddCommand.create(domain, target, feature, Collections.singleton(this.value));
} else if (Boolean.FALSE == value && contains) {
cmd = RemoveCommand.create(domain, target, feature, Collections.singleton(this.value));
}
return cmd;
}
示例9: removeCommand_DirectCreation
import org.eclipse.emf.edit.command.RemoveCommand; //导入方法依赖的package包/类
/**
* Tests remove command.
*/
@Test
public void removeCommand_DirectCreation() {
final TestElement leafSection = Create.testElement();
final TestElement actor = Create.testElement();
leafSection.getContainedElements().add(actor);
new EMFStoreCommand() {
@Override
protected void doRun() {
getProject().addModelElement(leafSection);
}
}.run(false);
final EditingDomain editingDomain = ESWorkspaceProviderImpl.getInstance().getEditingDomain();
// remove
final Command removeCommand = RemoveCommand.create(editingDomain, leafSection,
TestmodelPackage.Literals.TEST_ELEMENT__CONTAINED_ELEMENTS, actor);
if (removeCommand.canExecute()) {
editingDomain.getCommandStack().execute(removeCommand);
} else {
fail(COMMAND_NOT_EXECUTABLE);
}
assertEquals(0, leafSection.getContainedElements().size());
assertTrue(editingDomain.getCommandStack().canUndo());
// undo the command
editingDomain.getCommandStack().undo();
assertEquals(1, leafSection.getContainedElements().size());
assertTrue(editingDomain.getCommandStack().canRedo());
// redo the command
editingDomain.getCommandStack().redo();
assertEquals(0, leafSection.getContainedElements().size());
}
示例10: removeConditions
import org.eclipse.emf.edit.command.RemoveCommand; //导入方法依赖的package包/类
public void removeConditions(IStructuredSelection selection) {
List list = ((StructuredSelection) selection).toList();
EditingDomain domain = planEditorModel.getEditingDomain();
Command command = RemoveCommand.create(domain, list);
EMFUtils.executeCommand(domain, command);
}