1 11 package org.eclipse.team.internal.ccvs.ui.repo; 12 13 import java.util.ArrayList ; 14 import java.util.Iterator ; 15 16 import org.eclipse.jface.viewers.IStructuredSelection; 17 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation; 18 import org.eclipse.team.internal.ccvs.ui.actions.CVSAction; 19 import org.eclipse.team.internal.ccvs.ui.model.BranchCategory; 20 21 24 public abstract class CVSRepoViewAction extends CVSAction { 25 26 29 protected ICVSRepositoryLocation[] getSelectedRepositoryLocations() { 30 ArrayList tags = new ArrayList (); 31 IStructuredSelection selection = getSelection(); 32 if (!selection.isEmpty()) { 33 Iterator elements = selection.iterator(); 34 while (elements.hasNext()) { 35 Object element = elements.next(); 36 Object adapter = getAdapter(element, ICVSRepositoryLocation.class); 37 if (adapter != null) { 38 tags.add(adapter); 39 } else { 40 adapter = getAdapter(element, BranchCategory.class); 41 if(adapter != null) { 42 tags.add(((BranchCategory)adapter).getRepository(adapter)); 43 } 44 } 45 } 46 } 47 return (ICVSRepositoryLocation[])tags.toArray(new ICVSRepositoryLocation[tags.size()]); 48 } 49 50 } 51 | Popular Tags |