diff options
author | Michael Valenta | 2006-05-19 20:28:35 +0000 |
---|---|---|
committer | Michael Valenta | 2006-05-19 20:28:35 +0000 |
commit | 50414e5f30d00cd2c6864679e6679b116143545e (patch) | |
tree | 0335d201d47f0bd066e05169013e16cdee2dc51f /examples/org.eclipse.team.examples.filesystem | |
parent | 8a702936a30275081ff68d42a19996d25763bc93 (diff) | |
download | eclipse.platform.team-50414e5f30d00cd2c6864679e6679b116143545e.tar.gz eclipse.platform.team-50414e5f30d00cd2c6864679e6679b116143545e.tar.xz eclipse.platform.team-50414e5f30d00cd2c6864679e6679b116143545e.zip |
Working on model example
Diffstat (limited to 'examples/org.eclipse.team.examples.filesystem')
-rw-r--r-- | examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/mapping/ModelSyncActionProvider.java | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/mapping/ModelSyncActionProvider.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/mapping/ModelSyncActionProvider.java index 1f27ce492..9a5c042f1 100644 --- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/mapping/ModelSyncActionProvider.java +++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/model/ui/mapping/ModelSyncActionProvider.java @@ -10,15 +10,71 @@ *******************************************************************************/ package org.eclipse.team.examples.model.ui.mapping; +import org.eclipse.core.commands.*; +import org.eclipse.core.runtime.Assert; +import org.eclipse.team.ui.mapping.MergeActionHandler; import org.eclipse.team.ui.mapping.SynchronizationActionProvider; +import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; /** * The action provider that is used for synchronizations. */ public class ModelSyncActionProvider extends SynchronizationActionProvider { + /** Delegate for merge action handlers */ + private final class ActionHandlerDelegate extends AbstractHandler { + + /** The delegate handler */ + private final IHandler fDelegateHandler; + + /** + * Creates a new synchronization handler delegate. + * + * @param handler + * the delegate handler + */ + public ActionHandlerDelegate(final IHandler handler) { + Assert.isNotNull(handler); + fDelegateHandler= handler; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + fDelegateHandler.dispose(); + super.dispose(); + } + + /** + * {@inheritDoc} + */ + public Object execute(final ExecutionEvent event) throws ExecutionException { + return fDelegateHandler.execute(event); + } + + /** + * {@inheritDoc} + */ + public boolean isEnabled() { + return fDelegateHandler.isEnabled(); + } + } + public ModelSyncActionProvider() { - // TODO Auto-generated constructor stub + super(); } + /* (non-Javadoc) + * @see org.eclipse.team.ui.mapping.SynchronizationActionProvider#initialize() + */ + protected void initialize() { + super.initialize(); + final ISynchronizePageConfiguration configuration= getSynchronizePageConfiguration(); + // TODO: We should provide custom handlers that ensure that the MOD files get updated properly + // when MOE files are merged. + registerHandler(MERGE_ACTION_ID, new ActionHandlerDelegate(MergeActionHandler.getDefaultHandler(MERGE_ACTION_ID, configuration))); + registerHandler(OVERWRITE_ACTION_ID, new ActionHandlerDelegate(MergeActionHandler.getDefaultHandler(OVERWRITE_ACTION_ID, configuration))); + // We can just use the default mark as merged handler + } } |