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


Java IUndoableOperation.execute方法代码示例

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


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

示例1: executeExpansionOperation

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
public static void executeExpansionOperation(EPlanElement element, boolean expanded) {
	CommonMember member = element.getMember(CommonMember.class);
	String action = (expanded ? "expanded" : "collapsed");
	IUndoableOperation operation = new FeatureTransactionChangeOperation(action + " " + getElementNameForDisplay(element), member, PlanPackage.Literals.COMMON_MEMBER__EXPANDED, expanded);
	try {
		InternalTransaction existingTransaction = null;
		TransactionalEditingDomain te = TransactionUtils.getDomain(element);
		if (te instanceof FixedTransactionEditingDomain) {
			FixedTransactionEditingDomain domain = (FixedTransactionEditingDomain) te;
			existingTransaction = domain.getThreadTransaction();
		};
		if (existingTransaction != null && !existingTransaction.isReadOnly()) {
			LogUtil.warn("There is an existing transaction executing so the expansion operation cannot be executed at this point");
			return;
		}				
		operation.execute(new NullProgressMonitor(), null);
	} catch (ExecutionException e) {
		LogUtil.error(e);
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:PlanUtils.java

示例2: createAndExecuteSetExpandedOperation

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
/**
 * If the editor is a plan editor, then create the appropriate operation
 * to set the expanded state.  Also, execute the newly created operation.
 * 
 * @param expanded
 */
private void createAndExecuteSetExpandedOperation(boolean expanded) {
	IWorkbenchPart part = MultiPagePlanEditorContributor.this.getPage().getActivePart();
	if (part instanceof MultiPagePlanEditor) {
		MultiPagePlanEditor editor = (MultiPagePlanEditor) part;
		EPlan plan = editor.getPlan();
		IUndoableOperation operation = new SetExpandedOperation(plan, expanded);
		try {
			operation.execute(new NullProgressMonitor(), null);
		} catch (ExecutionException e) {
			LogUtil.error(e);
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:20,代码来源:MultiPagePlanEditorContributor.java

示例3: doit

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
protected IStatus doit(IProgressMonitor monitor, IAdaptable info, boolean execute) throws ExecutionException {
	if (!progress) {
		monitor = null;
	}
	if (monitor != null) {
		monitor.beginTask(getLabel(), operationList.size());
	}
	try {
		for (IUndoableOperation operation : operationList) {
			IProgressMonitor operationMonitor = (monitor != null ? new SubProgressMonitor(monitor, 1) : null);
			IStatus status;
			if (execute) {
				status = operation.execute(operationMonitor, info);
			} else {
				status = operation.redo(operationMonitor, info);
			}
			if (operationMonitor != null) {
				operationMonitor.done();
				if ((monitor != null) && operationMonitor.isCanceled()) {
					monitor.setCanceled(true);
				}
			}
			if (!status.isOK()) {
				return status;
			}
		}
		return Status.OK_STATUS;
	} finally {
		if (monitor != null) {
			monitor.done();
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:34,代码来源:CompositeOperation.java


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