KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ccvs > ui > repo > RemoteTagsView


1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.team.internal.ccvs.ui.repo;
12
13 import org.eclipse.jface.viewers.ISelection;
14 import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
15 import org.eclipse.team.internal.ui.actions.TeamAction;
16 import org.eclipse.ui.IWorkbenchPart;
17
18
19 /**
20  * This view shows the tags for the repository selected in the Repositories view
21  */

22 public class RemoteTagsView extends RemoteViewPart {
23
24     public static final String JavaDoc VIEW_ID = "org.eclipse.team.ccvs.ui.RemoteTagsView"; //$NON-NLS-1$
25

26     /**
27      * Constructor for RemoteTagsView.
28      * @param partName
29      */

30     public RemoteTagsView() {
31         super(VIEW_ID);
32     }
33
34     /**
35      * @see org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart#getTreeInput()
36      */

37     protected Object JavaDoc getTreeInput() {
38         return null;
39     }
40
41     protected void initializeListeners() {
42         // listen for selection changes in the repo view
43
getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(RepositoriesView.VIEW_ID, this);
44     }
45
46     /**
47      * @see org.eclipse.ui.IWorkbenchPart#dispose()
48      */

49     public void dispose() {
50         getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(RepositoriesView.VIEW_ID, this);
51         super.dispose();
52     }
53     
54     /**
55      * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
56      */

57     public void selectionChanged(IWorkbenchPart part, ISelection selection) {
58         Object JavaDoc[] selected = TeamAction.getSelectedAdaptables(selection, ICVSRepositoryLocation.class);
59         if (selected.length == 0) {
60             getViewer().setInput(null);
61         } else {
62             getViewer().setInput((ICVSRepositoryLocation)selected[0]);
63         };
64         refreshViewer();
65     }
66 }
67
Popular Tags