Java 类org.eclipse.core.commands.operations.IOperationApprover 实例源码

项目:OpenSPIFe    文件:DefaultOperationHistory.java   
private IStatus getRedoApproval(IUndoableOperation operation,
        IAdaptable info) {

    final Object[] approverArray = approvers.getListeners();

    for (int i = 0; i < approverArray.length; i++) {
        IOperationApprover approver = (IOperationApprover) approverArray[i];
        IStatus approval = approver.proceedRedoing(operation, this, info);
        if (!approval.isOK()) {
            if (DEBUG_OPERATION_HISTORY_APPROVAL) {
                Tracing.printTrace("OPERATIONHISTORY", //$NON-NLS-1$
                        "Redo not approved by " + approver //$NON-NLS-1$
                                + "for operation " + operation //$NON-NLS-1$
                                + " approved by " + approval); //$NON-NLS-1$
            }
            return approval;
        }
    }
    return Status.OK_STATUS;
}
项目:OpenSPIFe    文件:DefaultOperationHistory.java   
private IStatus getUndoApproval(IUndoableOperation operation,
        IAdaptable info) {

    final Object[] approverArray = approvers.getListeners();

    for (int i = 0; i < approverArray.length; i++) {
        IOperationApprover approver = (IOperationApprover) approverArray[i];
        IStatus approval = approver.proceedUndoing(operation, this, info);
        if (!approval.isOK()) {
            if (DEBUG_OPERATION_HISTORY_APPROVAL) {
                Tracing.printTrace("OPERATIONHISTORY", //$NON-NLS-1$
                        "Undo not approved by " + approver //$NON-NLS-1$
                                + "for operation " + operation //$NON-NLS-1$
                                + " with status " + approval); //$NON-NLS-1$
            }
            return approval;
        }
    }
    return Status.OK_STATUS;
}
项目:OpenSPIFe    文件:PlanReadOnlyOperationApprover.java   
public static IOperationApprover getInstance() {
    if (instance == null) {
        synchronized (PlanReadOnlyOperationApprover.class) {
            if (instance == null) {
                try {
                    instance = MissionExtender.construct(PlanReadOnlyOperationApprover.class);
                } catch (ConstructionException e) {
                    instance = new PlanReadOnlyOperationApprover();
                }
            }
        }
    }
    return instance;
}
项目:OpenSPIFe    文件:DefaultOperationHistory.java   
@Override
public void removeOperationApprover(IOperationApprover approver) {
    approvers.remove(approver);
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
@Override
protected IOperationApprover getUndoRedoOperationApprover(IUndoContext undoContext) {
    // since IResource is a more general way to compare java elements, we
    // use this as the preferred class for comparing objects.
    return new NonLocalUndoUserApprover(undoContext, this, new Object [] { getInputJavaElement() }, IResource.class);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
@Override
protected IOperationApprover getUndoRedoOperationApprover(IUndoContext undoContext) {
    // since IResource is a more general way to compare java elements, we
    // use this as the preferred class for comparing objects.
    return new NonLocalUndoUserApprover(undoContext, this, new Object [] { getInputJavaElement() }, IResource.class);
}
项目:OpenSPIFe    文件:DefaultOperationHistory.java   
/**
 * <p>
 * Add the specified approver to the list of operation approvers consulted
 * by the operation history before an undo or redo is allowed to proceed.
 * This method has no effect if the instance being added is already in the
 * list.
 * </p>
 * <p>
 * Operation approvers must be prepared to receive these the operation
 * approval messages from a background thread. Any UI access occurring
 * inside the implementation must be properly synchronized using the
 * techniques specified by the client's widget library.
 * </p>
 * 
 * @param approver
 *            the IOperationApprover to be added as an approver.
 * 
 */

@Override
public void addOperationApprover(IOperationApprover approver) {
    approvers.add(approver);
}