use of org.tigris.subversion.subclipse.ui.conflicts.MergeFileAssociation in project subclipse by subclipse.
the class SVNUIPlugin method getMergeFileAssociations.
public MergeFileAssociation[] getMergeFileAssociations() throws BackingStoreException {
ArrayList associations = new ArrayList();
String[] childrenNames = MergeFileAssociation.getParentPreferences().childrenNames();
for (int i = 0; i < childrenNames.length; i++) {
org.osgi.service.prefs.Preferences node = MergeFileAssociation.getParentPreferences().node(childrenNames[i]);
MergeFileAssociation association = new MergeFileAssociation();
association.setFileType(childrenNames[i]);
// $NON-NLS-1$, //$NON-NLS-1$
association.setMergeProgram(node.get("mergeProgram", ""));
// $NON-NLS-1$, //$NON-NLS-1$
association.setParameters(node.get("parameters", ""));
association.setType(node.getInt("type", MergeFileAssociation.BUILT_IN));
associations.add(association);
}
MergeFileAssociation[] associationArray = new MergeFileAssociation[associations.size()];
associations.toArray(associationArray);
Arrays.sort(associationArray);
return associationArray;
}
use of org.tigris.subversion.subclipse.ui.conflicts.MergeFileAssociation in project subclipse by subclipse.
the class EditConflictsAction method execute.
/*
* (non-Javadoc)
*
* @see org.tigris.subversion.subclipse.ui.actions.SVNAction#execute(org.eclipse.jface.action.IAction)
*/
protected void execute(final IAction action) throws InvocationTargetException, InterruptedException {
IFile resource;
if (selectedResource == null)
resource = (IFile) getSelectedResources()[0];
else
resource = selectedResource;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
IFile conflictNewFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictNew());
IFile conflictOldFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictOld());
IFile conflictWorkingFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictWorking());
if (conflictWorkingFile == null) {
conflictWorkingFile = resource;
}
MergeFileAssociation mergeFileAssociation = null;
try {
mergeFileAssociation = SVNUIPlugin.getPlugin().getMergeFileAssociation(resource.getName());
} catch (BackingStoreException e) {
mergeFileAssociation = new MergeFileAssociation();
}
if (mergeFileAssociation.getType() == MergeFileAssociation.BUILT_IN) {
editConflictsInternal(resource, conflictOldFile, conflictWorkingFile, conflictNewFile);
} else if (mergeFileAssociation.getType() == MergeFileAssociation.DEFAULT_EXTERNAL) {
IPreferenceStore preferenceStore = SVNUIPlugin.getPlugin().getPreferenceStore();
String mergeProgramLocation = preferenceStore.getString(ISVNUIConstants.PREF_MERGE_PROGRAM_LOCATION);
String mergeProgramParameters = preferenceStore.getString(ISVNUIConstants.PREF_MERGE_PROGRAM_PARAMETERS);
editConflictsExternal(resource, conflictOldFile, conflictWorkingFile, conflictNewFile, mergeProgramLocation, mergeProgramParameters);
} else {
editConflictsExternal(resource, conflictOldFile, conflictWorkingFile, conflictNewFile, mergeFileAssociation.getMergeProgram(), mergeFileAssociation.getParameters());
}
} catch (Exception e) {
exception = e;
}
if (exception != null) {
throw new InvocationTargetException(exception);
}
}
use of org.tigris.subversion.subclipse.ui.conflicts.MergeFileAssociation in project subclipse by subclipse.
the class SVNUIPlugin method getMergeFileAssociation.
public MergeFileAssociation getMergeFileAssociation(String fileName) throws BackingStoreException {
MergeFileAssociation[] mergeFileAssociations = getMergeFileAssociations();
for (int i = 0; i < mergeFileAssociations.length; i++) {
if (mergeFileAssociations[i].getFileType().equals(fileName))
return mergeFileAssociations[i];
}
for (int i = 0; i < mergeFileAssociations.length; i++) {
if (mergeFileAssociations[i].matches(fileName))
return mergeFileAssociations[i];
}
MergeFileAssociation mergeFileAssociation = new MergeFileAssociation();
IPreferenceStore preferenceStore = getPreferenceStore();
if (preferenceStore.getBoolean(ISVNUIConstants.PREF_MERGE_USE_EXTERNAL))
mergeFileAssociation.setType(MergeFileAssociation.DEFAULT_EXTERNAL);
else
mergeFileAssociation.setType(MergeFileAssociation.BUILT_IN);
return mergeFileAssociation;
}
Aggregations