Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2004, 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 Brock Janiczak <brockj@tpg.com.au> - Bug 166333 [Wizards] Show diff in CVS commit dialog /
 
 package org.eclipse.team.internal.ccvs.ui.wizards;
 
 
 import  org.eclipse.swt.widgets.Display;
A participant that uses our decorator instead of the standard one.
 
 public class CommitWizardParticipant extends WorkspaceModelParticipant {

    
The actions to be displayed in the context menu.
 
     private class ActionContribution extends SynchronizePageActionGroup {
         public void modelChanged(final ISynchronizeModelElement root) {
             super.modelChanged(root);
             Display.getDefault().asyncExec(new Runnable() {
                 public void run() {                
                     final CommitWizardCommitPage page.getCommitPage();
                     if (page != null)
                         page.updateForModelChange();
                 }
             });
         }
     }
     
     
     	if ( == null) {
              = new WorkspaceChangeSetCapability() {
             	public boolean supportsCheckedInChangeSets() {
             		return false;
             	}
             	public boolean enableActiveChangeSetsFor(ISynchronizePageConfiguration configuration) {
             		return false;
             	};
             };
         }
         return ;
     }

    
An extension of the standard label decorator which configures the keyword substitution mode according to the settings on the file type wizard page.
 
     private static class Decorator extends CVSParticipantLabelDecorator {
         
         private final CommitWizard fWizard;
 
         public Decorator(ISynchronizePageConfiguration configurationCommitWizard wizard) {
             super(configuration);
             wizard;
         }
         
         protected CVSDecoration getDecoration(IResource resourcethrows CoreException {
             final CVSDecoration decorationsuper.getDecoration(resource);
             final CommitWizardFileTypePage page.getFileTypePage();
             
             if (page != null && resource instanceof IFile
                 decoration.setKeywordSubstitution(page.getOption((IFile)resource).getShortDisplayText());
             return decoration;
         }
     }
 
 	protected static final String ACTION_GROUP = "org.eclipse.tam.cvs.ui.CommitActions"//$NON-NLS-1$
     
     final CommitWizard fWizard;
    
    public CommitWizardParticipant(SynchronizationContext contextCommitWizard wizard) {
        super(context);
        wizard;
    }
    
        return new Decorator(configuration);
    }
    /* (non-Javadoc)
     * @see org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant#initializeConfiguration(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
     */
    protected void initializeConfiguration(final ISynchronizePageConfiguration configuration) {
        super.initializeConfiguration(configuration);
		configuration.addMenuGroup(
        configuration.addActionContribution(new ActionContribution());
        // Wrap the container so that we can update the enablements after the runnable
        // (i.e. the container resets the state to what it was at the beginning of the
        // run even if the state of the page changed. Remove from View changes the state)
        configuration.setRunnableContext(new IRunnableContext() {
            public void run(boolean forkboolean cancelable,
                    IRunnableWithProgress runnable)
                    throws InvocationTargetExceptionInterruptedException {
                .getContainer().run(forkcancelablerunnable);
                final CommitWizardCommitPage page.getCommitPage();
                if (page != null)
                    page.updateEnablements();
            }
        });
        configuration.addActionContribution(new SynchronizePageActionGroup() {
        	public void initialize(ISynchronizePageConfiguration configuration) {
        		super.initialize(configuration);
        		 = new Action(null.) {
        			public void run() {
        			}
        		};
        		Utils.initAction("ComnitWizardComparePaneToggle.", Policy.getActionBundle()); //$NON-NLS-1$
        	}
		});
        configuration.setProperty(.new Action() {
			public void run() {
				ISelection selection = configuration.getSite().getSelectionProvider().getSelection();
				if(selection instanceof IStructuredSelection) {
					final Object obj = ((IStructuredSelectionselection).getFirstElement();
					}
				}
			}
        });
    }
    
    /* (non-Javadoc)
     * @see org.eclipse.team.ui.synchronize.AbstractSynchronizeParticipant#doesSupportSynchronize()
     */
    public boolean doesSupportSynchronize() {
        return false;
    }
    
    private boolean isComparePaneVisible() {
		return section == null ? false : section.getBoolean(.);
    }
		return new WorkspaceMergeActionGroup() {
			protected void addToContextMenu(String mergeActionIdAction actionIMenuManager manager) {
					// skip merge actions
					return;
				}
				super.addToContextMenu(mergeActionIdactionmanager);
			}
			protected void appendToGroup(String menuIdString groupId,	IAction action) {
					// skip commit action
					return;
				}
				super.appendToGroup(menuIdgroupIdaction);
			}
		};
	}
New to GrepCode? Check out our FAQ X