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


Java SetCommand.create方法代码示例

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


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

示例1: allocateIds

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
/**
 * Allocates ID's to recently pasted nodes.
 * 
 * @param nodes the recently pasted nodes
 * @param command the command responsible for adding the nodes
 */
private void allocateIds(final List<GNode> nodes, final CompoundCommand command) {

    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(graphEditor.getModel());
    final EAttribute feature = ModelPackage.Literals.GNODE__ID;

    for (final GNode node : nodes) {

        if (checkNeedsNewId(node, nodes)) {

            final String id = allocateNewId();
            final Command setCommand = SetCommand.create(domain, node, feature, id);

            if (setCommand.canExecute()) {
                command.appendAndExecute(setCommand);
            }

            graphEditor.getSkinLookup().lookupNode(node).initialize();
        }
    }
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:27,代码来源:TitledSkinController.java

示例2: execute

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
		EditingDomainController editingDomainController) {
	System.out.println("delete");
	if (selection instanceof EObject) {
		EditingDomain ed = null; // editingDomainController.getEditingDomain((EObject)
									// selection);
		if (ed != null) {
			Command command = SetCommand.create(ed, selection,
					BtsmodelPackage.ADMINISTRATIV_DATA_OBJECT__STATE,
					BTSConstants.OBJECT_STATE_TERMINATED);
			ed.getCommandStack().execute(command);

		}
else {
			((AdministrativDataObject) selection)
					.setState(BTSConstants.OBJECT_STATE_TERMINATED);
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:22,代码来源:DeleteHandler.java

示例3: allocateIds

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
/**
 * Allocates ID's to recently pasted nodes.
 * 
 * @param nodes the recently pasted nodes
 * @param command the command responsible for adding the nodes
 */
private void allocateIds(final List<GNode> nodes, final CompoundCommand command) {

    final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(graphEditor.getModel());
    final EAttribute feature = GraphPackage.Literals.GNODE__ID;

    for (final GNode node : nodes) {

        if (checkNeedsNewId(node, nodes)) {

            final String id = allocateNewId();
            final Command setCommand = SetCommand.create(domain, node, feature, id);

            if (setCommand.canExecute()) {
                command.appendAndExecute(setCommand);
            }

            graphEditor.getSkinLookup().lookupNode(node).initialize();
        }
    }
}
 
开发者ID:tesis-dynaware,项目名称:graph-editor,代码行数:27,代码来源:TitledSkinController.java

示例4: save

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
public void save() {
	if (translations == null)
	{
		return;
	}
	BTSTranslation trans = translations.getBTSTranslation(getLanguage());
	if ((trans.getValue() == null && !"".equals(text.getText().trim()))
			|| !text.getText().equals(trans.getValue()))
	{
		org.eclipse.emf.common.command.Command command = SetCommand
				.create(domain, trans, BtsmodelPackage.Literals.BTS_TRANSLATION__VALUE, text.getText());
		domain.getCommandStack().execute(command);
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:15,代码来源:TranslationEditorComposite.java

示例5: setChildEntrySelected

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
private void setChildEntrySelected(BTSObjectTypeTreeNode entry,
		boolean checked, CompoundCommand compoundCommand) {
	org.eclipse.emf.common.command.Command command = SetCommand.create(
			editingDomain, entry,
			BtsviewmodelPackage.Literals.BTS_OBJECT_TYPE_TREE_NODE__SELECTED,
			checked);
	for (BTSObjectTypeTreeNode child : entry.getChildren()) {
		setChildEntrySelected((BTSObjectTypeTreeNode) child, checked,
				compoundCommand);
	}

	compoundCommand.append(command);

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

示例6: execute

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
@Execute
public void execute(
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) Object selection,
		EditingDomainController editingDomainController, @Optional @Active MPart activePart) {
	System.out.println("restore");
	if (selection instanceof EObject) {
		EditingDomain ed = editingDomainController
				.getEditingDomain((EObject) selection);
		if (ed != null) {
			Command command = SetCommand.create(ed, selection,
					BtsmodelPackage.ADMINISTRATIV_DATA_OBJECT__STATE,
					BTSConstants.OBJECT_STATE_ACTIVE);
			ed.getCommandStack().execute(command);

		} else {
			((AdministrativDataObject) selection)
					.setState(BTSConstants.OBJECT_STATE_ACTIVE);
		}
		
		// General Command Controller... save!
		if (activePart != null)
		{
		
			Object o = activePart.getObject();
			if (o instanceof StructuredViewerProvider)
			{
				StructuredViewerProvider viewerProvider = (StructuredViewerProvider) o;
				viewerProvider.getActiveStructuredViewer().refresh();
			}
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:33,代码来源:RestoreHandler2.java

示例7: removeLemmatizerData

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
private void removeLemmatizerData() {
	if (userMayEdit && currentWord != null && activateButton.getSelection()) {
		lemmaID_text.setText("");
		flex_text.setText("");
		CompoundCommand compoundCommand = new CompoundCommand();
		org.eclipse.emf.common.command.Command command = SetCommand.create(
				editingDomain, currentWord,
				BtsCorpusModelPackage.Literals.BTS_WORD__LKEY, null);
		compoundCommand.append(command);

		command = SetCommand.create(editingDomain, currentWord,
				BtsCorpusModelPackage.Literals.BTS_WORD__FLEX_CODE, null);
		compoundCommand.append(command);

		// remove all translations
		for (BTSTranslation trans : currentWord.getTranslation()
				.getTranslations()) {
			command = SetCommand.create(editingDomain, trans,
					BtsmodelPackage.Literals.BTS_TRANSLATION__VALUE, "");
			compoundCommand.append(command);
		}

		editingDomain.getCommandStack().execute(compoundCommand);
		wordTranslate_Editor.setTranslationText(null);
		wordTranslate_Editor.save();
	}

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

示例8: setSelectedGlypheIgnored

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
private void setSelectedGlypheIgnored(boolean selection) {
		if (selectedGlyphe != null) {
			Command c = SetCommand.create(editingDomain, selectedGlyphe,
					BtsCorpusModelPackage.BTS_GRAPHIC__IGNORED, selection);
			editingDomain.getCommandStack().execute(c);
			selectedGlyphe.setIgnored(selection);
			int selectedGlypheIndex = selectedGlyphe != null ? wordGraphics
					.indexOf(selectedGlyphe) : 0;
			String normalizedMdC = transformWordToMdCString(currentWord,
					selectedGlypheIndex);
			MDCNormalizer d = new MDCNormalizer();
			try {
				normalizedMdC = d.normalize(normalizedMdC);
			} catch (MDCSyntaxError e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

//			String glypheSelectedMdC = setGlypheSelectionInMdC(normalizedMdC,
//					selectedGlypheIndex);

			hierotw_text.setText(normalizedMdC);
			hierotw_text.setSelection(hierotw_text.getText().length());
			jseshEditor.setMDCText(normalizedMdC);
		}

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

示例9: ScheduledOperation

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
private ScheduledOperation(EPlanElement planElement, boolean scheduled) {
	super("scheduled");
	this.planElement = planElement;
	this.scheduled = scheduled;
	TemporalMember member = planElement.getMember(TemporalMember.class);
	EAttribute feature = TemporalPackage.Literals.TEMPORAL_MEMBER__SCHEDULED;
	command = SetCommand.create(TransactionUtils.getDomain(planElement), member, feature, scheduled);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:9,代码来源:ScheduledOperation.java

示例10: execute

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) {
	boolean state = getCommandState(event.getCommand());
	IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (editor != null) {
		EPlan plan = (EPlan) editor.getAdapter(EPlan.class);
		if (plan != null) {
			TransactionalEditingDomain domain = TransactionUtils.getDomain(plan);
			final List<CommonMember> selected = new ArrayList<CommonMember>();
			Timeline<EPlan> timeline = TimelineUtils.getTimeline(event);
			if (timeline != null) {
				for (TimelineViewer v : timeline.getTimelineViewers()) {
					List<?> selectedEditParts = v.getSelectedEditParts();
					for (Object ep : selectedEditParts) {
						if (ep instanceof TemporalNodeEditPart) {
							EPlanElement pe = ((TemporalNodeEditPart) ep).getModel();
							selected.add(pe.getMember(CommonMember.class));
						}
					}
				}
				List<Command> commands = new ArrayList<Command>();
				for(CommonMember commonMember : selected) {
					Command create = SetCommand.create(domain, commonMember,
							PlanPackage.Literals.COMMON_MEMBER__MARKED, !state);
					commands.add(create);
				}
				EMFUtils.executeCommand(domain, new CompoundCommand(commands));
				try {
					HandlerUtil.toggleCommandState(event.getCommand());
				} catch (ExecutionException e) {
					LogUtil.error(e);
				}
			}
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:38,代码来源:ToggleOverlayHandler.java

示例11: createGapWaiverSuggestion

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
private Suggestion createGapWaiverSuggestion() {
	ProfileConstraint constraint = getProfileReference();
	if (getWaiverRationale() != null
			|| !(constraint instanceof ProfileEqualityConstraint)) {
		return null;
	}
	final ProfileEqualityConstraint equalityConstraint = (ProfileEqualityConstraint) constraint;
	Amount<Duration> value = getDuration();
	final String englishDuration = DurationFormat.getEnglishDuration(value.longValue(SI.SECOND));
	final Amount<Duration> newGap = value;
	EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(getOwner());
	Command cmd = SetCommand.create(domain, equalityConstraint, ProfilePackage.Literals.PROFILE_EQUALITY_CONSTRAINT__MAXIMUM_GAP, newGap);
	IUndoableOperation operation = new CommandUndoableOperation("Set gap size to "+englishDuration, domain, cmd);
	return new Suggestion(WAIVE_ICON, "Ignore gaps less than "+englishDuration, operation);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:16,代码来源:ProfileConstraintViolation.java

示例12: execute

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) {
	Timeline timeline = TimelineUtils.getTimeline(event);
	if (timeline != null) {
		final ETimeline currentTimeline = timeline.getTimelineModel();
		EditingDomain domain = EMFUtils.getAnyDomain(currentTimeline);
		ETimeline defaultTimeline = TimelineEditorUtils.getDefaultTimelineModel(event);
		final Collection newValue = new ArrayList((Collection) defaultTimeline.eGet(TimelinePackage.Literals.ETIMELINE__CONTENTS));
		Command command = SetCommand.create(domain, currentTimeline, TimelinePackage.Literals.ETIMELINE__CONTENTS, newValue);
		EMFUtils.executeCommand(domain, command);
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:14,代码来源:ResetTimelineHandler.java

示例13: modify

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
public static void modify(Object facet, Object value, Object feature, IUndoContext undoContext, IItemPropertyDescriptor itemPropertyDescriptor, EditingDomain domain) {
	if (domain == null) {
		LogUtil.error("can't get editing domain for facet of class: " + facet.getClass().getSimpleName());
	} else {
		Command command = SetCommand.create(domain, facet, feature, value);
		EMFUtils.executeCommand(domain, command);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:9,代码来源:EMFReadWriteUtils.java

示例14: setRuleFile

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
void setRuleFile(String ruleFile) {
	EAttribute feature = SmcPackage.eINSTANCE.getContract_RuleFile();
	Contract contract = this.instance.getContract();
	Command cmd = SetCommand.create(instance.getEditingDomain(), contract,
			feature, ruleFile);
	instance.getEditingDomain().getCommandStack().execute(cmd);
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:8,代码来源:RuleTab.java

示例15: taskSaved

import org.eclipse.emf.edit.command.SetCommand; //导入方法依赖的package包/类
/**
 * Save a new task to this corresponding role
 */
private boolean taskSaved() {
	
	// Validate the inputs
	if (!validateTask()) return false;
	
	Role role = this.instance.getRole();
	java.util.List<Task> tasks = role.getTask();
	java.util.List<Task> newTaskList = new ArrayList<Task>();
	
	// Check if we add a new task or modify an existing task
	// Task name is used as unique identifier
	Task task = null;
	Boolean overwriteTask = false;
	for (int i=0; i<tasks.size(); i++) {
		task = tasks.get(i);			
		if (task.getId().equalsIgnoreCase(mNameWidget.getText())) {
			task = createNewTask();
			overwriteTask = true;
		}
		
		newTaskList.add(task);
	}
	
	if (!overwriteTask) {
		task = createNewTask();
		newTaskList.add(task);
	}	

	EReference feature = SmcPackage.eINSTANCE.getRole_Task();
	Command cmd = SetCommand.create(instance.getEditingDomain(), role, feature, newTaskList);
	instance.getEditingDomain().getCommandStack().execute(cmd);
	
	return true;
}
 
开发者ID:road-framework,项目名称:ROADDesigner,代码行数:38,代码来源:TaskTab.java


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