Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2000, 2009 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: IBM Corporation - initial API and implementation /
 
 package org.eclipse.team.internal.ccvs.ui.repo;
 
 
 
 import  org.eclipse.swt.SWT;
 import  org.eclipse.swt.dnd.*;
 import  org.eclipse.swt.events.KeyAdapter;
 import  org.eclipse.swt.events.KeyEvent;
 import  org.eclipse.swt.widgets.*;
RepositoriesView is a view on a set of known CVS repositories which allows navigation of the structure of the repository and the performing of CVS-specific operations on the repository contents.
 
 public class RepositoriesView extends RemoteViewPart {
 	public static final String VIEW_ID = "org.eclipse.team.ccvs.ui.RepositoriesView"//$NON-NLS-1$
 	
 	// The root
 	private AllRootsElement root;
 	
 	// Actions
 	private IAction removeAction;
 	private Action newAction;
 	private Action newAnonAction;
 	
 	private static final String SELECTED_ORDER_BY = "selectedOrderBy"//$NON-NLS-1$
 	private static final String SELECTED_SORTING_ORDER = "selectedSortingOrder"//$NON-NLS-1$
 	private static final String FILTER_SHOW_MODULES = "filterShowModules"//$NON-NLS-1$
 
 		public void repositoryAdded(final ICVSRepositoryLocation root) {
 			getViewer().getControl().getDisplay().asyncExec(new Runnable() {
 				public void run() {
 				}
 			});
 		}
 		public void repositoriesChanged(ICVSRepositoryLocation[] roots) {
 			refresh();
 		}
 		private void refresh() {
 			Display display = getViewer().getControl().getDisplay();
 			display.asyncExec(new Runnable() {
 				public void run() {
 				}
 			});
 		}
 	};
     
     private static final class RepositoryDragSourceListener implements DragSourceListener {
         private IStructuredSelection selection;
 
         public void dragStart(DragSourceEvent event) {
             if(!=null) {            
                 final Object[] array = .toArray();
                // event.doit = Utils.getResources(array).length > 0;
                for (int i = 0; i < array.lengthi++) {
                    if (array[iinstanceof ICVSRemoteFile) {
                        event.doit = true;
                        return;
                    }
                }
                event.doit = false;
            }
        }
        public void dragSetData(DragSourceEvent event) {
            if (!=null && CVSResourceTransfer.getInstance().isSupportedType(event.dataType)) {
                final Object[] array = .toArray();
                for (int i = 0; i < array.lengthi++) {
                    if (array[iinstanceof ICVSRemoteFile) {
                        event.data = array[i];
                        return;
                    }
                }
            } else if (PluginTransfer.getInstance().isSupportedType(event.dataType)) {
            	final Object[] array = .toArray();
                 for (int i = 0; i < array.lengthi++) {
                     if (array[iinstanceof ICVSRemoteFile) {
                         event.data = new PluginTransferData("org.eclipse.team.cvs.ui.cvsRemoteDrop", CVSResourceTransfer.getInstance().toByteArray((ICVSRemoteFilearray[i])); //$NON-NLS-1$
                         return;
                     }
                 }
                
             }
        }
        
        public void dragFinished( DragSourceEvent event) {
        }
        public void updateSelectionIStructuredSelection selection) {
            this. = selection;
        }
    }
    
Constructor for RepositoriesView.
	public RepositoriesView() {
		super();		
		IDialogSettings workbenchSettings = CVSUIPlugin.getPlugin().getDialogSettings();
		 = workbenchSettings.getSection();
		if ( == null) {
			 = workbenchSettings.addNewSection();
		}
		try {
			// parse the values
			String selectedSortingOrder = .get();
			int orderBy = Integer.parseInt(selectedOrderBy);
			boolean ascending = Boolean.valueOf(selectedSortingOrder).booleanValue();
			 = new RepositoryComparator(orderByascending);
catch (NumberFormatException e) {
			// use default comparator
		}
	}

Contribute actions to the view
	protected void contributeActions() {
		final Shell shell = getShell();
		// Create actions
		// New Repository (popup)
			public void run() {
				wizard.setSwitchPerspectives(false);
				WizardDialog dialog = new WizardDialog(shellwizard);
				dialog.open();
			}
		};
				public void run() {
					Properties p = new Properties();
					p.setProperty("connection""pserver"); //$NON-NLS-1$ //$NON-NLS-2$
					p.setProperty("user""anonymous"); //$NON-NLS-1$ //$NON-NLS-2$
					p.setProperty("host""dev.eclipse.org"); //$NON-NLS-1$ //$NON-NLS-2$
					p.setProperty("root""/cvsroot/eclipse"); //$NON-NLS-1$ //$NON-NLS-2$
					wizard.setSwitchPerspectives(false);
					WizardDialog dialog = new WizardDialog(shellwizard);
					dialog.open();
				}
			};
		}
		// Properties
		if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
else {
		}
			public void selectionChanged(SelectionChangedEvent event) {
				boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof RepositoryRoot;
			}
		});
		 = new RemoveRootAction(.getControl().getShell(), this);
		 = new Action(){
			public void run(){
				}
				}
			}
		};
		// Sort By action group
		IPropertyChangeListener comparatorUpdater = new IPropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent event) {
                String property = event.getProperty();
                if (.
                        .equals(property)) {
                    Object newValue = event.getNewValue();
                    getViewer().refresh();
                    saveSelectedComparator((RepositoryComparatornewValue);
                }
            }
        };
        		comparatorUpdater));
		// restore comparator selection
			public void run(){
				if ( != null)
			}
		};
		//Create the filter action
		IMenuManager actionBarsMenu = bars.getMenuManager();
		if (actionBarsMenu != null){
			actionBarsMenu.add(new Separator());
			actionBarsMenu.add();
		}
	}
	private void saveSelectedComparator(RepositoryComparator selectedComparator) {
		if ( != null) {
		}
	}

    
Returns the action group.

Returns:
the action group
        return ;
    }

    
Sets the action group.

Parameters:
actionGroup the action group
    private void setActionGroup(RepositoriesSortingActionGroup actionGroup) {
        this. = actionGroup;
    }

Method includeEclipseConnection.

Returns:
boolean
	private boolean includeAnonConnection() {
		return System.getProperty("eclipse.cvs.anon") != null//$NON-NLS-1$
	}

See also:
org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart.addWorkbenchActions(org.eclipse.jface.action.IMenuManager)
	protected void addWorkbenchActions(IMenuManager manager) {
		// New actions go next
		manager.add(sub);
		super.addWorkbenchActions(manager);
		}		
		}
		if (selection.size() == 1 && selection.getFirstElement() instanceof RepositoryRoot) {
			manager.add(new Separator());
		}
		if ( != null)
		sub.add(new Separator("group1")); //$NON-NLS-1$
	}
	/*
	 * @see WorkbenchPart#createPartControl
	 */
	public void createPartControl(Composite parent) {
		super.createPartControl(parent);
		// We need to set comparator on the viewer, in order to modify it by
		// repositoriesSortingActionGroup in the future. It's the same object
		if ( != null)
	}
	/*
	 * @see WorkbenchPart#dispose
	 */
	public void dispose() {
		if ( != null)
		else
        if (getRepositoriesSortingActionGroup() != null) {
            getRepositoriesSortingActionGroup().dispose();
        }
		super.dispose();
	}

Initialize the repositories and actions
	private void initialize() {
	}
	protected void initializeListeners() {
			public void selectionChanged(SelectionChangedEvent event) {
				handleChange(selection);	
			}			
		});
        
        .addDragSupport( DND.DROP_LINK | DND.DROP_DEFAULT, 
                new Transfer[] { CVSResourceTransfer.getInstance(),PluginTransfer.getInstance()}, 
                );
	}

See also:
org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart.getTreeInput()
	protected Object getTreeInput() {
		return ;
	}

See also:
org.eclipse.ui.ISelectionListener.selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
	public void selectionChanged(IWorkbenchPart partISelection selection) {
		String msg = getStatusLineMessage(selection);
	}
	private String getStatusLineMessage(ISelection selection) {
		if (selection==null || selection.isEmpty()) return ""//$NON-NLS-1$
		if (!(selection instanceof IStructuredSelection)) return ""//$NON-NLS-1$
		if (s.size() > 1)
            return NLS.bind(.new String[] { String.valueOf(s.size()) }); 
		Object element = TeamAction.getAdapter(s.getFirstElement(), ICVSResource.class);
		if (element instanceof ICVSRemoteResource) {
			String name;
			if (res.isContainer()) {
else { 
				try {
					name = res.getRepositoryRelativePath() + " " + ((ICVSRemoteFile)res).getRevision(); //$NON-NLS-1$
catch (TeamException e) {
			}
		}
	}

See also:
org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart.getHelpContextId()
	protected String getHelpContextId() {
	}

See also:
org.eclipse.team.internal.ccvs.ui.repo.RemoteViewPart.getKeyListener()
	protected KeyAdapter getKeyListener() {
		return new KeyAdapter() {
			public void keyPressed(KeyEvent event) {
				if (event.keyCode == SWT.F5) {
						ICVSRepositoryLocation[] locations = KnownRepositories.getInstance().getRepositories();
						for (int i = 0; i < locations.lengthi++) {
							locations[i].flushUserInfo();
						}
else {
					}
else if (event.keyCode == SWT.F9 && .) {
				}
			}
		};
	}
	private void handleChange(IStructuredSelection selection){
        
	}
	public void showFilter(RepositoriesFilter filter) {
		if ( != null)
	}
    
New to GrepCode? Check out our FAQ X