use of com.collabnet.subversion.merge.MergeOutput in project subclipse by subclipse.
the class ResumeMergeAction method run.
public void run(IAction action) {
DialogWizard dialogWizard = new DialogWizard(DialogWizard.RESUME_MERGE);
MergeWizardDialog dialog = new MergeWizardDialog(Display.getDefault().getActiveShell(), dialogWizard);
if (dialog.open() == MergeWizardDialog.CANCEL)
return;
Iterator iter = fSelection.iterator();
while (iter.hasNext()) {
Object selectedObject = iter.next();
if (selectedObject instanceof MergeOutput) {
MergeOutput mergeOutput = (MergeOutput) selectedObject;
mergeOutput.resume();
}
}
}
use of com.collabnet.subversion.merge.MergeOutput in project subclipse by subclipse.
the class UndoMergeAction method run.
public void run(IAction action) {
DialogWizard dialogWizard = new DialogWizard(DialogWizard.UNDO_MERGE_WARNING);
MergeWizardDialog dialog = new MergeWizardDialog(Display.getDefault().getActiveShell(), dialogWizard, true);
if (dialog.open() == MergeWizardDialog.CANCEL)
return;
final ArrayList resources = new ArrayList();
ArrayList mergeOutputs = new ArrayList();
Iterator iter = fSelection.iterator();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof MergeOutput) {
MergeOutput mergeOutput = (MergeOutput) object;
mergeOutputs.add(mergeOutput);
IResource resource = mergeOutput.getResource();
resources.add(resource);
}
}
final IResource[] resourceArray = new IResource[resources.size()];
resources.toArray(resourceArray);
UndoMergeOperation undoMergeOperation = new UndoMergeOperation(MergeResultsView.getView(), resourceArray);
try {
undoMergeOperation.run();
} catch (Exception e) {
Activator.handleError(Messages.UndoMergeAction_error, e);
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.UndoMergeAction_title, e.getMessage());
return;
}
iter = mergeOutputs.iterator();
while (iter.hasNext()) {
MergeOutput mergeOutput = (MergeOutput) iter.next();
mergeOutput.delete();
}
MergeResultsView.getView().refresh();
dialogWizard = new DialogWizard(DialogWizard.UNDO_MERGE_COMPLETED);
dialog = new MergeWizardDialog(Display.getDefault().getActiveShell(), dialogWizard, true);
if (dialog.open() == MergeWizardDialog.CANCEL)
return;
RevertAction revertAction = new RevertAction();
revertAction.setShowNothingToRevertMessage(false);
IStructuredSelection selection = new IStructuredSelection() {
public Object getFirstElement() {
return resourceArray[0];
}
public Iterator iterator() {
return toList().iterator();
}
public int size() {
return resourceArray.length;
}
public Object[] toArray() {
return resourceArray;
}
public List toList() {
return resources;
}
public boolean isEmpty() {
return resources.isEmpty();
}
};
revertAction.selectionChanged(null, selection);
revertAction.run(null);
}
use of com.collabnet.subversion.merge.MergeOutput in project subclipse by subclipse.
the class MergeResultsView method createPartControl.
public void createPartControl(Composite parent) {
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.verticalSpacing = 2;
layout.marginWidth = 0;
layout.marginHeight = 2;
parent.setLayout(layout);
treeViewer = new TreeViewer(parent);
treeViewer.setLabelProvider(labelProvider);
treeViewer.setContentProvider(new MergeResultsViewContentProvider());
treeViewer.setUseHashlookup(true);
GridData layoutData = new GridData();
layoutData.grabExcessHorizontalSpace = true;
layoutData.grabExcessVerticalSpace = true;
layoutData.horizontalAlignment = GridData.FILL;
layoutData.verticalAlignment = GridData.FILL;
treeViewer.getControl().setLayoutData(layoutData);
treeViewer.setInput(this);
treeViewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {
treeConflict = null;
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
Object selectedItem = selection.getFirstElement();
MergeResult mergeResult = null;
if (selectedItem instanceof AdaptableMergeResult)
mergeResult = (MergeResult) selectedItem;
if (selectedItem instanceof AdaptableMergeResultsFolder) {
MergeResultsFolder mergeResultsFolder = (MergeResultsFolder) selectedItem;
mergeResult = mergeResultsFolder.getMergeResult();
}
if (mergeResult != null) {
if (mergeResult.getResource() instanceof IFile && mergeResult.isConflicted() && !mergeResult.isResolved()) {
editConflicts(mergeResult);
return;
}
if (mergeResult.getResource() instanceof IFile && mergeResult.hasTreeConflict() && !mergeResult.isTreeConflictResolved()) {
boolean addAddConflict = false;
if (mergeResult.getResource() != null && mergeResult.getResource().exists()) {
treeConflict = getTreeConflict(mergeResult.getResource());
if (treeConflict != null && treeConflict.getDescription() != null && treeConflict.getDescription().contains("local add") && treeConflict.getDescription().contains("incoming add")) {
// $NON-NLS-1$ //$NON-NLS-2$
addAddConflict = true;
}
if (!addAddConflict) {
openAction.run();
}
}
if (!addAddConflict) {
return;
}
}
if (!mergeResult.getAction().equals(MergeResult.ACTION_DELETE)) {
final ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(mergeResult.getResource());
if (!localResource.exists()) {
return;
}
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
try {
if (treeConflict != null) {
if (!localResource.isFolder()) {
SVNConflictDescriptor descriptor = treeConflict.getConflictDescriptor();
SVNConflictVersion rightVersion = descriptor.getSrcRightVersion();
try {
ISVNRemoteFile remoteFile = new RemoteFile(localResource.getRepository(), new SVNUrl(rightVersion.getReposURL() + "/" + rightVersion.getPathInRepos()), new SVNRevision.Number(rightVersion.getPegRevision()));
SVNLocalCompareInput compareInput = new SVNLocalCompareInput(localResource, remoteFile);
CompareUI.openCompareEditorOnPage(compareInput, getSite().getPage());
} catch (Exception e) {
}
}
return;
}
CompareUI.openCompareEditorOnPage(new SVNLocalCompareInput(localResource, SVNRevision.BASE), getSite().getPage());
} catch (SVNException e) {
if (!e.operationInterrupted()) {
Activator.handleError(Messages.MergeResultsView_compareError, e);
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MergeResultsView_compareWithLatest, e.getLocalizedMessage());
}
} catch (SVNClientException e) {
Activator.handleError(Messages.MergeResultsView_compareError, e);
MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MergeResultsView_compareWithLatest, e.getLocalizedMessage());
}
}
});
}
}
}
});
treeViewer.getTree().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
boolean mergeOutputSelected = false;
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
Iterator iter = selection.iterator();
while (iter.hasNext()) {
if (iter.next() instanceof MergeOutput) {
mergeOutputSelected = true;
break;
}
}
removeAction.setEnabled(mergeOutputSelected);
}
});
createMenus();
createToolbar();
getSite().setSelectionProvider(treeViewer);
if (Activator.getDefault().getPreferenceStore().getBoolean(CONFLICTS_ONLY_PREFERENCE))
setContentDescription(Messages.MergeResultsView_conflictsMode);
}
use of com.collabnet.subversion.merge.MergeOutput in project subclipse by subclipse.
the class MergeResultsViewContentProvider method getChildren.
public Object[] getChildren(Object parentElement) {
int mode = store.getInt(MergeResultsView.LAYOUT_PREFERENCE);
boolean conflictsOnly = store.getBoolean(MergeResultsView.CONFLICTS_ONLY_PREFERENCE);
if (parentElement instanceof MergeResultsView) {
return MergeOutput.getMergeOutputs();
}
if (parentElement instanceof MergeOutput) {
MergeOutput mergeOutput = (MergeOutput) parentElement;
if (mode == MergeResultsView.MODE_FLAT) {
if (conflictsOnly)
return mergeOutput.getConflictedMergeResults();
else
// else return mergeOutput.getNonSkippedMergeResults();
return mergeOutput.getMergeResults();
}
if (mode == MergeResultsView.MODE_COMPRESSED_FOLDERS) {
MergeResult[] rootMergeResults = mergeOutput.getRootMergeResults(conflictsOnly);
MergeResultsFolder[] mergeResultFolders = mergeOutput.getCompressedFolders(conflictsOnly);
ArrayList returnObjects = new ArrayList();
for (int i = 0; i < mergeResultFolders.length; i++) returnObjects.add(mergeResultFolders[i]);
for (int i = 0; i < rootMergeResults.length; i++) returnObjects.add(rootMergeResults[i]);
Object[] returnArray = new Object[returnObjects.size()];
returnObjects.toArray(returnArray);
return returnArray;
}
}
if (parentElement instanceof MergeResultsFolder) {
MergeResultsFolder folder = (MergeResultsFolder) parentElement;
if (folder.isCompressed()) {
return folder.getMergeResults(conflictsOnly);
}
}
return new Object[0];
}
use of com.collabnet.subversion.merge.MergeOutput in project subclipse by subclipse.
the class MergeResultsViewLabelProvider method getImage.
public Image getImage(Object element) {
if (element instanceof MergeOutput) {
Image image = null;
if (((MergeOutput) element).isIncomplete())
image = Activator.getImage(Activator.IMAGE_MERGE_OUTPUT_ABORTED);
else {
if (((MergeOutput) element).isAbnormalEnd())
image = Activator.getImage(Activator.IMAGE_MERGE_OUTPUT_ABNORMAL);
else if (((MergeOutput) element).isInProgress())
image = Activator.getImage(Activator.IMAGE_MERGE_OUTPUT_IN_PROGRESS);
else
image = Activator.getImage(Activator.IMAGE_MERGE_OUTPUT);
}
return compareConfiguration.getImage(image, Differencer.NO_CHANGE);
}
if (element instanceof MergeResult) {
MergeResult mergeResult = (MergeResult) element;
if (mergeResult.getResource() == null || mergeResult.getResource().getName() == null) {
return super.getImage(element);
}
return getImage(mergeResult);
}
if (element instanceof MergeResultsFolder) {
MergeResultsFolder mergeResultsFolder = (MergeResultsFolder) element;
Image image;
if (mergeResultsFolder.getFolder().getFullPath().makeRelative().toString().length() > mergeResultsFolder.getRootFolderLength())
image = workbenchLabelProvider.getImage(mergeResultsFolder.getFolder());
else
image = workbenchLabelProvider.getImage(mergeResultsFolder.getMergeOutput().getResource());
MergeResult mergeResult = mergeResultsFolder.getMergeResult();
if (mergeResult != null)
return getImage(mergeResult);
return compareConfiguration.getImage(image, Differencer.NO_CHANGE);
}
return super.getImage(element);
}
Aggregations