How to get full path of file in a CLIENT side plugin?
I Know the question about how to get full path of file had been asked many times, and there are samples showing how to do this, but i can't still get it done in a CLIENT side plugin.
In a SERVER side plugin example, you can get ServiceConfigurationProvider with the following code fragment,
public void run(AdvisableOperation operation, IProcessConfigurationElement advisorConfiguration, IAdvisorInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException {
Object operationData = operation.getOperationData();
if (!(operationData instanceof DeliverOperationData)) {
return;
}
DeliverOperationData data = (DeliverOperationData) operationData;
List<IChangeSetHandle> changeSetHandles = data.getChangeSetHandles();
IRepositoryItemService itemService = getService(IRepositoryItemService.class);
IScmService scmService = getService(IScmService.class);
IItemServiceIterator changeSetIterator = ItemServiceIteratorFactory.INSTANCE.createFetchItemsIterator(itemService, changeSetHandles.toArray(new IItemHandle[changeSetHandles.size()]), IRepositoryItemService.COMPLETE);
while (changeSetIterator.hasNext()) {
IChangeSet changeSet = (IChangeSet) changeSetIterator.next();
if (changeSet == null) {
continue;
}
for (IChange change : (List<IChange>) changeSet.changes()) {
if (change.kind() == IChange.DELETE) {
IVersionableHandle versionableHandle = change.beforeState();
ServiceConfigurationProvider configProvider = ServiceConfigurationProvider.FACTORY.create(
data.getDestWorkspace(), changeSet.getComponent());
But in a CLIENT side plugin which you can right click on a change set in Change Explorer view and then click on a customized menu item to export the change log details, how do you get a ServiceConfigurationProvider?
public class ExportChange extends AbstractActionDelegate {public ExportChange {}
@Overridepublic void run(Shell shell IWorkbenchPage page, IStructuredSelection selection) {
......
}
One answer
Thanks for the comment, but all i got for now is change sets user selected in the Change Explorer view, i don't know how to get an IWorkspaceConnection with them.
public class ExportChange extends AbstractActionDelegate {
private SnapshotId selectedSnapshot;
public ExportChange() {
}
@Override
public void run(Shell shell, IWorkbenchPage page, IStructuredSelection selection) {
List<ChangeSetWrapper> changeSetWrappers = AdapterUtil.adaptList(selection.toList(), ChangeSetWrapper.class);
List<IActivitySource> sources = AdapterUtil.adaptList(selection.toList(), IActivitySource.class);
for (IActivitySource next : sources) {
List<IRemoteActivity> activities = next.getActivities();
changeSetWrappers.addAll(RemoteActivityAdapter.convertToChangeSetWrappers(activities));
}
if (!changeSetWrappers.isEmpty()) {
ITeamRepository repo = changeSetWrappers.get(0).getRepository();
IScmService scmService = (IScmService) repo.getClientLibrary(IScmService.class);
IWorkspaceManager workspaceManager = (IWorkspaceManager) repo.getClientLibrary(IWorkspaceManager.class);
List<IChangeSet> changeSets = CollectionUtil.filterDupes(ChangeSetWrapper.getChangeSets(changeSetWrappers));
for(IChangeSet changeSet : changeSets) {
for(IChange change : (List<IChange>)changeSet.changes()) {
IVersionableHandle versionableHandle = change.beforeState();
.............
}
}
}
return;
}
}
Comments
1 vote
1 vote
1 vote
2 votes
showing 5 of 7
show 2 more comments
Comments
Surya Tripathi
Jul 10 '13, 7:04 p.m.1 vote