1 11 package org.eclipse.team.internal.ccvs.ui.wizards; 12 13 import java.lang.reflect.InvocationTargetException ; 14 15 import org.eclipse.core.resources.IFile; 16 import org.eclipse.core.resources.IResource; 17 import org.eclipse.core.runtime.CoreException; 18 import org.eclipse.jface.operation.IRunnableContext; 19 import org.eclipse.jface.operation.IRunnableWithProgress; 20 import org.eclipse.jface.viewers.ILabelDecorator; 21 import org.eclipse.swt.widgets.Display; 22 import org.eclipse.team.internal.ccvs.ui.CVSDecoration; 23 import org.eclipse.team.internal.ccvs.ui.subscriber.CVSParticipantLabelDecorator; 24 import org.eclipse.team.internal.ccvs.ui.subscriber.WorkspaceSynchronizeParticipant; 25 import org.eclipse.team.internal.ui.synchronize.ChangeSetCapability; 26 import org.eclipse.team.ui.synchronize.*; 27 28 31 public class CommitWizardParticipant extends WorkspaceSynchronizeParticipant { 32 33 36 private class ActionContribution extends SynchronizePageActionGroup { 37 public void modelChanged(final ISynchronizeModelElement root) { 38 super.modelChanged(root); 39 Display.getDefault().asyncExec(new Runnable () { 40 public void run() { 41 final CommitWizardCommitPage page= fWizard.getCommitPage(); 42 if (page != null) 43 page.updateForModelChange(); 44 } 45 }); 46 } 47 } 48 49 53 private static class Decorator extends CVSParticipantLabelDecorator { 54 55 private final CommitWizard fWizard; 56 57 public Decorator(ISynchronizePageConfiguration configuration, CommitWizard wizard) { 58 super(configuration); 59 fWizard= wizard; 60 } 61 62 protected CVSDecoration getDecoration(IResource resource) throws CoreException { 63 final CVSDecoration decoration= super.getDecoration(resource); 64 final CommitWizardFileTypePage page= fWizard.getFileTypePage(); 65 66 if (page != null && resource instanceof IFile) 67 decoration.setKeywordSubstitution(page.getOption((IFile)resource).getShortDisplayText()); 68 return decoration; 69 } 70 } 71 72 final CommitWizard fWizard; 73 74 public CommitWizardParticipant(ISynchronizeScope scope, CommitWizard wizard) { 75 super(scope); 76 fWizard= wizard; 77 } 78 79 protected ILabelDecorator getLabelDecorator(ISynchronizePageConfiguration configuration) { 80 return new Decorator(configuration, fWizard); 81 } 82 83 public ChangeSetCapability getChangeSetCapability() { 84 return null; } 86 89 protected void initializeConfiguration( ISynchronizePageConfiguration configuration) { 90 super.initializeConfiguration(configuration); 91 configuration.setProperty(ISynchronizePageConfiguration.P_TOOLBAR_MENU, new String [] {ISynchronizePageConfiguration.LAYOUT_GROUP}); 92 configuration.setProperty(ISynchronizePageConfiguration.P_CONTEXT_MENU, ISynchronizePageConfiguration.DEFAULT_CONTEXT_MENU); 93 configuration.addMenuGroup( 94 ISynchronizePageConfiguration.P_CONTEXT_MENU, 95 CONTEXT_MENU_CONTRIBUTION_GROUP_3); 96 configuration.addActionContribution(new ActionContribution()); 97 98 configuration.setRunnableContext(new IRunnableContext() { 102 public void run(boolean fork, boolean cancelable, 103 IRunnableWithProgress runnable) 104 throws InvocationTargetException , InterruptedException { 105 fWizard.getContainer().run(fork, cancelable, runnable); 106 final CommitWizardCommitPage page= fWizard.getCommitPage(); 107 if (page != null) 108 page.updateEnablements(); 109 } 110 }); 111 configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE); 112 configuration.setMode(ISynchronizePageConfiguration.OUTGOING_MODE); 113 } 114 117 public boolean doesSupportSynchronize() { 118 return false; 119 } 120 } 121 | Popular Tags |