blob: a708c50f60b1e48492f6ea9a64851b085a89f351 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*******************************************************************************
* Copyright (c) 2010, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
* Alex Blewitt <alex.blewitt@gmail.com> - replace new Boolean with Boolean.valueOf - https://bugs.eclipse.org/470344
*******************************************************************************/
package org.eclipse.team.internal.ui.mapping;
import org.eclipse.jface.action.Action;
import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
import org.eclipse.team.internal.ui.synchronize.patch.*;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
public class ReversePatchAction extends Action {
private ISynchronizePageConfiguration configuration;
private ApplyPatchModelSynchronizeParticipant participant;
private ApplyPatchSubscriberMergeContext context;
private ApplyPatchSubscriber subscriber;
public ReversePatchAction(ISynchronizePageConfiguration configuration) {
super("", AS_CHECK_BOX); //$NON-NLS-1$
this.configuration = configuration;
participant = (ApplyPatchModelSynchronizeParticipant) configuration
.getParticipant();
context = (ApplyPatchSubscriberMergeContext) participant.getContext();
subscriber = (ApplyPatchSubscriber) context.getSubscriber();
}
@Override
public boolean isChecked() {
return subscriber.getPatcher().isReversed();
}
@Override
public void run() {
boolean oldValue = subscriber.getPatcher().isReversed();
subscriber.getPatcher().setReversed(!oldValue);
SubscriberDiffTreeEventHandler handler = context.getAdapter(SubscriberDiffTreeEventHandler.class);
handler.reset();
participant.refresh(configuration.getSite().getWorkbenchSite(), context
.getScope().getMappings());
firePropertyChange(CHECKED, Boolean.valueOf(oldValue), Boolean.valueOf(
!oldValue));
}
}
|