diff options
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java new file mode 100644 index 000000000..a669cce7a --- /dev/null +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ShowEditorsAction.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * CSC - Intial implementation + * IBM Corporation - ongoing maintenance + *******************************************************************************/ +package org.eclipse.team.internal.ccvs.ui.actions; + +import java.lang.reflect.InvocationTargetException; +import org.eclipse.core.runtime.IProgressMonitor; +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 { + + protected void execute(IAction action) throws InvocationTargetException, InterruptedException { + final EditorsAction editorsAction = new EditorsAction(); + run(new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + 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() + */ + protected boolean isEnabledForAddedResources() { + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForNonExistantResources() + */ + protected boolean isEnabledForNonExistantResources() { + return true; + } + + /** + * @see org.eclipse.team.internal.ccvs.ui.actions.WorkspaceAction#isEnabledForMultipleResources() + */ + protected boolean isEnabledForMultipleResources() { + // We support one selected Resource, + // because the editors command will + // show the editors of all children too. + return false; + } + +} |