Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 7117646e19887f3a3657924b3eb1dbe797fe4009 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*******************************************************************************
 * Copyright (c) 2000, 2006 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:
 *     CSC - Intial implementation
 *     IBM Corporation - ongoing maintenance
 *******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;

import java.lang.reflect.InvocationTargetException;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.team.internal.ccvs.core.EditorsInfo;
import org.eclipse.team.internal.ccvs.ui.EditorsView;
/**
 * 
 * 
 * Action for Show Editors in popup menus
 * 
 * @author <a href="mailto:kohlwes@gmx.net">Gregor Kohlwes</a>
 * 
 */
public class ShowEditorsAction extends WorkspaceAction {
	
	@Override
	protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
		final EditorsAction editorsAction = new EditorsAction();
		run((IRunnableWithProgress) monitor -> executeProviderAction(editorsAction, monitor), true /* cancelable */ ,
				PROGRESS_DIALOG);
		EditorsInfo[] infos = editorsAction.getEditorsInfo();
		EditorsView view = (EditorsView)showView(EditorsView.VIEW_ID);
		if (view != null) {
			view.setInput(infos);
		}

	}

	/**
	 * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForAddedResources()
	 */
	@Override
	protected boolean isEnabledForAddedResources() {
		return false;
	}

	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources()
	 */
	@Override
	protected boolean isEnabledForNonExistantResources() {
		return true;
	}
	
	/**
	 * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources()
	 */
	@Override
	protected boolean isEnabledForMultipleResources() {
		// We support one selected Resource,
		// because the editors command will
		// show the editors of all children too.
		return false;
	}

}

Back to the top