/*******************************************************************************
* Copyright (c) 2009, 2010 Innovation Gate GmbH.
* 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:
* Innovation Gate GmbH - initial API and implementation
******************************************************************************/
package de.innovationgate.eclipse.wgadesigner.team;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.team.core.subscribers.Subscriber;
import org.eclipse.team.ui.TeamUI;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor;
import org.eclipse.team.ui.synchronize.SubscriberParticipant;
import de.innovationgate.eclipse.wgadesigner.ResourceIDs;
import de.innovationgate.eclipse.wgadesigner.decorators.DesignFolderDecorator;
import de.innovationgate.eclipse.wgadesigner.decorators.NatureDecorator;
import de.innovationgate.eclipse.wgadesigner.models.WGARemoteServer;
import de.innovationgate.eclipse.wgadesigner.natures.WGARuntime;
public class WGARemoteServerSynchronizationParticipant extends SubscriberParticipant {
private WGARuntime _runtime;
private WGARemoteServer _server;
public WGARemoteServerSynchronizationParticipant(WGARemoteServer server, WGARuntime runtime) {
_runtime = runtime;
_server = server;
setSubscriber(new WGARemoteServerSubscriber(_server, _runtime));
setName("WGA runtime '" + _runtime.getName() + "' to '" + _server.getUrl() + "'.");
}
@Override
protected void setSubscriber(Subscriber subscriber) {
super.setSubscriber(subscriber);
try {
ISynchronizeParticipantDescriptor descriptor = TeamUI.getSynchronizeManager().getParticipantDescriptor(ResourceIDs.WGA_REMOTE_SERVER_SYNCHRONIZATION_PARTICIPANT);
setInitializationData(descriptor);
setSecondaryId(Long.toString(System.currentTimeMillis()));
} catch (CoreException e) {
// ignore
}
}
@Override
protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
super.initializeConfiguration(configuration);
configuration.setMenuGroups(ISynchronizePageConfiguration.P_CONTEXT_MENU, new String[] {WGARemoteServerSynchronizationActionContribution.CONTEXT_MENU_CONTRIBUTION_GROUP, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP});
configuration.addActionContribution(new WGARemoteServerSynchronizationActionContribution());
configuration.setSupportedModes(ISynchronizePageConfiguration.OUTGOING_MODE);
configuration.addLabelDecorator(new NatureDecorator());
configuration.addLabelDecorator(new DesignFolderDecorator());
}
public WGARuntime getRuntime() {
return _runtime;
}
public WGARemoteServer getServer() {
return _server;
}
}