KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > actions > ShowEditorsAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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  * CSC - Intial implementation
10  * IBM Corporation - ongoing maintenance
11  *******************************************************************************/

12 package org.eclipse.team.internal.ccvs.ui.actions;
13
14 import java.lang.reflect.InvocationTargetException JavaDoc;
15 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.operation.IRunnableWithProgress;
18 import org.eclipse.team.internal.ccvs.core.EditorsInfo;
19 import org.eclipse.team.internal.ccvs.ui.EditorsView;
20 /**
21  *
22  *
23  * Action for Show Editors in popup menus
24  *
25  * @author <a HREF="mailto:kohlwes@gmx.net">Gregor Kohlwes</a>
26  *
27  */

28 public class ShowEditorsAction extends WorkspaceAction {
29     
30     protected void execute(IAction action) throws InvocationTargetException JavaDoc, InterruptedException JavaDoc {
31         final EditorsAction editorsAction = new EditorsAction();
32         run(new IRunnableWithProgress() {
33             public void run(IProgressMonitor monitor)
34                     throws InvocationTargetException JavaDoc, InterruptedException JavaDoc {
35                 executeProviderAction(editorsAction, monitor);
36             }
37         }, true /* cancelable */ , PROGRESS_DIALOG);
38         EditorsInfo[] infos = editorsAction.getEditorsInfo();
39         EditorsView view = (EditorsView)showView(EditorsView.VIEW_ID);
40         if (view != null) {
41             view.setInput(infos);
42         }
43
44     }
45
46     /**
47      * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
48      */

49     protected boolean isEnabledForAddedResources() {
50         return false;
51     }
52
53     /* (non-Javadoc)
54      * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
55      */

56     protected boolean isEnabledForNonExistantResources() {
57         return true;
58     }
59     
60     /**
61      * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
62      */

63     protected boolean isEnabledForMultipleResources() {
64         // We support one selected Resource,
65
// because the editors command will
66
// show the editors of all children too.
67
return false;
68     }
69
70 }
71
Popular Tags