Example #1
0
  private ParticipantPageSaveablePart createCompareInput() {
    ISynchronizeParticipant participant =
        new CompareParticipant(
            new CVSCompareSubscriber(
                new IResource[0],
                new CVSTag[0],
                Messages.getString("ProjectComparePage.3"))); // $NON-NLS-1$
    configuration = participant.createPageConfiguration();
    configuration.setMenuGroups(
        ISynchronizePageConfiguration.P_TOOLBAR_MENU,
        new String[] {
          ISynchronizePageConfiguration.NAVIGATE_GROUP,
          ISynchronizePageConfiguration.LAYOUT_GROUP,
          ChangeSetModelManager.CHANGE_SET_GROUP
        });
    configuration.setMenuGroups(ISynchronizePageConfiguration.P_CONTEXT_MENU, new String[0]);

    CompareConfiguration cc = new CompareConfiguration();
    cc.setLeftEditable(false);
    cc.setRightEditable(false);
    ParticipantPageSaveablePart part =
        new ParticipantPageSaveablePart(getShell(), cc, configuration, participant);

    // will be reset when setVisible is called
    setPageComplete(true);

    return part;
  }
  @Override
  public void initialize(ISynchronizePageConfiguration configuration) {
    super.initialize(configuration);
    final Viewer viewer = configuration.getPage().getViewer();
    if (viewer instanceof AbstractTreeViewer) {

      expandAllAction = new ExpandAllAction((AbstractTreeViewer) viewer);
      Utils.initAction(expandAllAction, "action.expandAll."); // $NON-NLS-1$

      collapseAll =
          new Action() {
            @Override
            public void run() {
              if (viewer.getControl().isDisposed() || !(viewer instanceof AbstractTreeViewer))
                return;
              viewer.getControl().setRedraw(false);
              ((AbstractTreeViewer) viewer)
                  .collapseToLevel(viewer.getInput(), AbstractTreeViewer.ALL_LEVELS);
              viewer.getControl().setRedraw(true);
            }
          };
      Utils.initAction(collapseAll, "action.collapseAll."); // $NON-NLS-1$

      ICompareNavigator nav =
          (ICompareNavigator) configuration.getProperty(SynchronizePageConfiguration.P_NAVIGATOR);
      if (nav != null) {
        gotoNext = new NavigateAction(configuration, true /*next*/);
        gotoPrevious = new NavigateAction(configuration, false /*previous*/);
      }
    }
  }
 /**
  * Return whether the page has been set to use a flat layout.
  *
  * @return whether the page has been set to use a flat layout
  * @since 3.3
  */
 protected final boolean isFlatLayout() {
   ISynchronizePageConfiguration c = getConfiguration();
   if (c != null) {
     String p = (String) c.getProperty(ITeamContentProviderManager.PROP_PAGE_LAYOUT);
     return p != null && p.equals(ITeamContentProviderManager.FLAT_LAYOUT);
   }
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.IContentProvider#dispose()
  */
 public void dispose() {
   ICommonContentExtensionSite extensionSite = getExtensionSite();
   if (extensionSite != null) {
     extensionSite.getExtensionStateModel().removePropertyChangeListener(this);
   }
   ISynchronizationContext context = getContext();
   if (context != null) context.getDiffTree().removeDiffChangeListener(this);
   ISynchronizePageConfiguration configuration = getConfiguration();
   if (configuration != null) configuration.removePropertyChangeListener(this);
 }
 /* (non-Javadoc)
  * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite)
  */
 public void init(ICommonContentExtensionSite site) {
   // Set the site
   this.site = site;
   // Configure the content provider based on the site and state model
   site.getExtensionStateModel().addPropertyChangeListener(this);
   ISynchronizePageConfiguration configuration = getConfiguration();
   if (configuration != null) configuration.addPropertyChangeListener(this);
   ITreeContentProvider provider = getDelegateContentProvider();
   if (provider instanceof ICommonContentProvider) {
     ((ICommonContentProvider) provider).init(site);
   }
   ISynchronizationContext context = getContext();
   if (context != null) context.getDiffTree().addDiffChangeListener(this);
 }
 /*
  * Initialize the log entry handler and place it in the configuration
  */
 private LogEntryCacheUpdateHandler initializeLogEntryHandler(
     final ISynchronizePageConfiguration configuration) {
   final LogEntryCacheUpdateHandler logEntryHandler =
       new LogEntryCacheUpdateHandler(configuration);
   configuration.setProperty(LOG_ENTRY_HANDLER, logEntryHandler);
   // Use an action group to get notified when the configuration is disposed
   configuration.addActionContribution(
       new SynchronizePageActionGroup() {
         public void dispose() {
           super.dispose();
           LogEntryCacheUpdateHandler handler =
               (LogEntryCacheUpdateHandler) configuration.getProperty(LOG_ENTRY_HANDLER);
           if (handler != null) {
             handler.shutdown();
             configuration.setProperty(LOG_ENTRY_HANDLER, null);
           }
         }
       });
   // It is possible that the configuration has been disposed concurrently by another thread
   // TODO
   return logEntryHandler;
 }
 public CVSChangeSetCollector(ISynchronizePageConfiguration configuration) {
   super(configuration);
   configuration.setProperty(CVSChangeSetCollector.CVS_CHECKED_IN_COLLECTOR, this);
 }