diff options
author | Michael Valenta | 2001-11-29 16:21:13 +0000 |
---|---|---|
committer | Michael Valenta | 2001-11-29 16:21:13 +0000 |
commit | fdf7eb62e75072e240b2156109a74be4ee8cef6f (patch) | |
tree | e9caea819086be64b85a4df254604199ab801b61 /bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java | |
parent | 23f77246d18f364d4aa3b5491d493fac53b89792 (diff) | |
download | eclipse.platform.team-fdf7eb62e75072e240b2156109a74be4ee8cef6f.tar.gz eclipse.platform.team-fdf7eb62e75072e240b2156109a74be4ee8cef6f.tar.xz eclipse.platform.team-fdf7eb62e75072e240b2156109a74be4ee8cef6f.zip |
Changed IRemoteResource to ICVSRemoteResource
Changed IRemoteFile to ICVSRemoteFile
Changed IRemoteFolder to ICVSRemoteFolder
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java')
-rw-r--r-- | bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java index 3cf479de6..5701320ae 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/OpenRemoteFileAction.java @@ -1,102 +1,102 @@ -package org.eclipse.team.internal.ccvs.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.team.ccvs.core.IRemoteFile;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
-import org.eclipse.team.internal.ccvs.ui.Policy;
-import org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput;
-import org.eclipse.team.ui.actions.TeamAction;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-
-public class OpenRemoteFileAction extends TeamAction {
- /**
- * Returns the selected remote files
- */
- protected IRemoteFile[] getSelectedRemoteFiles() {
- ArrayList resources = null;
- if (!selection.isEmpty()) {
- resources = new ArrayList();
- Iterator elements = ((IStructuredSelection) selection).iterator();
- while (elements.hasNext()) {
- Object next = elements.next();
- if (next instanceof IRemoteFile) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- IAdaptable a = (IAdaptable) next;
- Object adapter = a.getAdapter(IRemoteFile.class);
- if (adapter instanceof IRemoteFile) {
- resources.add(adapter);
- continue;
- }
- }
- }
- }
- if (resources != null && !resources.isEmpty()) {
- IRemoteFile[] result = new IRemoteFile[resources.size()];
- resources.toArray(result);
- return result;
- }
- return new IRemoteFile[0];
- }
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
- IWorkbenchPage page = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IRemoteFile[] files = getSelectedRemoteFiles();
- for (int i = 0; i < files.length; i++) {
- try {
- page.openEditor(new RemoteFileEditorInput(files[i]), "org.eclipse.ui.DefaultTextEditor");
- } catch (PartInitException e) {
- CVSUIPlugin.log(e.getStatus());
- }
- }
- }
- }, Policy.bind("OpenRemoteFileAction.open"), this.PROGRESS_DIALOG);
- }
- /*
- * @see TeamAction#isEnabled()
- */
- protected boolean isEnabled() throws TeamException {
- IRemoteFile[] resources = getSelectedRemoteFiles();
- if (resources.length == 0) return false;
- return true;
- }
- /** (Non-javadoc)
- * Method declared on IActionDelegate.
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- this.selection = (IStructuredSelection) selection;
- //this action can be invoked by double-click, in which case
- //there is no target action
- if (action != null) {
- try {
- action.setEnabled(isEnabled());
- } catch (TeamException e) {
- action.setEnabled(false);
- }
- }
- }
- }
+package org.eclipse.team.internal.ccvs.ui.actions; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.team.ccvs.core.ICVSRemoteFile; +import org.eclipse.team.core.TeamException; +import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin; +import org.eclipse.team.internal.ccvs.ui.Policy; +import org.eclipse.team.internal.ccvs.ui.RemoteFileEditorInput; +import org.eclipse.team.ui.actions.TeamAction; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; + +public class OpenRemoteFileAction extends TeamAction { + /** + * Returns the selected remote files + */ + protected ICVSRemoteFile[] getSelectedRemoteFiles() { + ArrayList resources = null; + if (!selection.isEmpty()) { + resources = new ArrayList(); + Iterator elements = ((IStructuredSelection) selection).iterator(); + while (elements.hasNext()) { + Object next = elements.next(); + if (next instanceof ICVSRemoteFile) { + resources.add(next); + continue; + } + if (next instanceof IAdaptable) { + IAdaptable a = (IAdaptable) next; + Object adapter = a.getAdapter(ICVSRemoteFile.class); + if (adapter instanceof ICVSRemoteFile) { + resources.add(adapter); + continue; + } + } + } + } + if (resources != null && !resources.isEmpty()) { + ICVSRemoteFile[] result = new ICVSRemoteFile[resources.size()]; + resources.toArray(result); + return result; + } + return new ICVSRemoteFile[0]; + } + /* + * @see IActionDelegate#run(IAction) + */ + public void run(IAction action) { + run(new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException { + IWorkbenchPage page = CVSUIPlugin.getPlugin().getWorkbench().getActiveWorkbenchWindow().getActivePage(); + ICVSRemoteFile[] files = getSelectedRemoteFiles(); + for (int i = 0; i < files.length; i++) { + try { + page.openEditor(new RemoteFileEditorInput(files[i]), "org.eclipse.ui.DefaultTextEditor"); + } catch (PartInitException e) { + CVSUIPlugin.log(e.getStatus()); + } + } + } + }, Policy.bind("OpenRemoteFileAction.open"), this.PROGRESS_DIALOG); + } + /* + * @see TeamAction#isEnabled() + */ + protected boolean isEnabled() throws TeamException { + ICVSRemoteFile[] resources = getSelectedRemoteFiles(); + if (resources.length == 0) return false; + return true; + } + /** (Non-javadoc) + * Method declared on IActionDelegate. + */ + public void selectionChanged(IAction action, ISelection selection) { + if (selection instanceof IStructuredSelection) { + this.selection = (IStructuredSelection) selection; + //this action can be invoked by double-click, in which case + //there is no target action + if (action != null) { + try { + action.setEnabled(isEnabled()); + } catch (TeamException e) { + action.setEnabled(false); + } + } + } + } }
\ No newline at end of file |