/* * Copyright 2000-2020 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jetbrains.teamcity.ui.actions; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.ui.IViewActionDelegate; import org.eclipse.ui.IViewPart; public class RemoteRunViewActionDelegate implements IViewActionDelegate { private IViewPart myView; public RemoteRunViewActionDelegate(){ } public void init(IViewPart view) { myView = view; } public void run(IAction action) { final IStructuredSelection selection = (IStructuredSelection) myView.getSite().getSelectionProvider().getSelection(); // IStructuredSelection executorSelection; // if(selection == null || selection.isEmpty()){ // executorSelection = null;//default // //get all from view // if(myView instanceof ISynchronizeView){ // IResource[] resources = new IResource[0]; // ISynchronizeParticipant participant = ((ISynchronizeView)myView).getParticipant(); // // if(participant instanceof SubscriberParticipant){ // resources = ((SubscriberParticipant)participant).getResources(); // // } else if (participant instanceof ModelSynchronizeParticipant){//CVS leaf // final ModelSynchronizeParticipant modelParticipant = ((ModelSynchronizeParticipant)participant); // resources = ((SubscriberMergeContext)modelParticipant.getContext()).getDiffTree().getAffectedResources(); // // } // executorSelection = new StructuredSelection(resources); // } // // } else { // executorSelection = new StructuredSelection(((IStructuredSelection)selection).toArray()); // } final RemoteRunActionDelegate executor = new RemoteRunActionDelegate(/*executorSelection,*/ true); executor.setSelection(selection); executor.run(action); } public void selectionChanged(IAction action, ISelection selection) { } }