KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ui > mapping > RestoreRemovedItemsAction


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ui.mapping;
12
13 import org.eclipse.jface.viewers.IStructuredSelection;
14 import org.eclipse.team.core.mapping.ISynchronizationContext;
15 import org.eclipse.team.core.subscribers.SubscriberMergeContext;
16 import org.eclipse.team.internal.core.subscribers.SubscriberDiffTreeEventHandler;
17 import org.eclipse.team.internal.ui.Utils;
18 import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
19
20 public class RestoreRemovedItemsAction extends ResourceModelParticipantAction {
21     
22     public RestoreRemovedItemsAction(ISynchronizePageConfiguration configuration) {
23         super(null, configuration);
24         Utils.initAction(this, "action.restoreRemovedFromView."); //$NON-NLS-1$
25
}
26
27     public void run() {
28         ISynchronizationContext context = getSynchronizationContext();
29         if(context instanceof SubscriberMergeContext){
30             SubscriberMergeContext smc = (SubscriberMergeContext) context;
31             SubscriberDiffTreeEventHandler handler = (SubscriberDiffTreeEventHandler) smc.getAdapter(SubscriberDiffTreeEventHandler.class);
32             handler.reset();
33         }
34         super.run();
35     }
36
37     protected boolean isEnabledForSelection(IStructuredSelection selection) {
38         return true;
39     }
40
41
42 }
43
Popular Tags