Java Code Examples for org.eclipse.team.core.TeamException#UNABLE
The following examples show how to use
org.eclipse.team.core.TeamException#UNABLE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyFilesManager.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void saveKeyFilesHistory() throws TeamException { IPath pluginStateLocation = SVNUIPlugin.getPlugin().getStateLocation(); File tempFile = pluginStateLocation.append(KEYFILE_HIST_FILE + ".tmp").toFile(); //$NON-NLS-1$ File histFile = pluginStateLocation.append(KEYFILE_HIST_FILE).toFile(); try { XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile))); try { writer.startTag(ELEMENT_KEYFILE_HISTORY, null, false); for (int i=0; i<previousKeyFiles.length && i<MAX_FILES; i++) writer.printSimpleTag(ELEMENT_KEYFILE, previousKeyFiles[i]); writer.endTag(ELEMENT_KEYFILE_HISTORY); } finally { writer.close(); } if (histFile.exists()) { histFile.delete(); } boolean renamed = tempFile.renameTo(histFile); if (!renamed) { throw new TeamException(new Status(Status.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.rename", tempFile.getAbsolutePath()), null)); //$NON-NLS-1$ } } catch (IOException e) { throw new TeamException(new Status(Status.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.save",histFile.getAbsolutePath()), e)); //$NON-NLS-1$ } }
Example 2
Source File: CommentsManager.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * save the comments history */ public void saveCommentHistory() throws TeamException { IPath pluginStateLocation = SVNUIPlugin.getPlugin().getStateLocation(); File tempFile = pluginStateLocation.append(COMMENT_HIST_FILE + ".tmp").toFile(); //$NON-NLS-1$ File histFile = pluginStateLocation.append(COMMENT_HIST_FILE).toFile(); try { XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile))); try { writer.startTag(ELEMENT_COMMIT_HISTORY, null, false); for (int i=0; i<previousComments.length && i<maxComments; i++) writer.printSimpleTag(ELEMENT_COMMIT_COMMENT, previousComments[i]); writer.endTag(ELEMENT_COMMIT_HISTORY); } finally { writer.close(); } if (histFile.exists()) { histFile.delete(); } boolean renamed = tempFile.renameTo(histFile); if (!renamed) { throw new TeamException(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.rename", tempFile.getAbsolutePath()), null)); //$NON-NLS-1$ } } catch (IOException e) { throw new TeamException(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, Policy.bind("RepositoryManager.save",histFile.getAbsolutePath()), e)); //$NON-NLS-1$ } }
Example 3
Source File: CommentsManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void saveCommentTemplates() throws TeamException { IPath pluginStateLocation = SVNUIPlugin.getPlugin().getStateLocation(); File tempFile = pluginStateLocation.append( COMMENT_TEMPLATES_FILE + ".tmp").toFile(); //$NON-NLS-1$ File histFile = pluginStateLocation.append(COMMENT_TEMPLATES_FILE) .toFile(); try { XMLWriter writer = new XMLWriter(new BufferedOutputStream( new FileOutputStream(tempFile))); try { writeCommentTemplates(writer); } finally { writer.close(); } if (histFile.exists()) { histFile.delete(); } boolean renamed = tempFile.renameTo(histFile); if (!renamed) { throw new TeamException(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, NLS.bind( Policy.bind("RepositoryManager.rename"), new String[] { tempFile.getAbsolutePath() }), null)); } } catch (IOException e) { throw new TeamException(new Status(IStatus.ERROR, SVNUIPlugin.ID, TeamException.UNABLE, NLS.bind( Policy.bind("RepositoryManager.save"), new String[] { histFile.getAbsolutePath() }), e)); } }
Example 4
Source File: AddIgnoredPatternCommand.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void run(IProgressMonitor monitor) throws SVNException { monitor = Policy.monitorFor(monitor); monitor.beginTask(null, 100); //$NON-NLS-1$ if (!folder.getStatus().isManaged()) throw new SVNException(IStatus.ERROR, TeamException.UNABLE, Policy.bind("SVNTeamProvider.ErrorSettingIgnorePattern", folder.getIResource().getFullPath().toString())); //$NON-NLS-1$ ISVNClientAdapter svnClient = folder.getRepository().getSVNClient(); try { OperationManager.getInstance().beginOperation(svnClient); try { svnClient.addToIgnoredPatterns(folder.getFile(), pattern); // broadcast changes to unmanaged children - they are the only candidates for being ignored ISVNResource[] members = folder.members(null, ISVNFolder.UNMANAGED_MEMBERS); IResource[] possiblesIgnores = new IResource[members.length]; for (int i = 0; i < members.length;i++) { possiblesIgnores[i] = ((ISVNLocalResource)members[i]).getIResource(); } folder.refreshStatus(false); SVNProviderPlugin.broadcastSyncInfoChanges(possiblesIgnores, false); broadcastNestedFolders(possiblesIgnores); } catch (SVNClientException e) { throw SVNException.wrapException(e); } } finally { OperationManager.getInstance().endOperation(); monitor.done(); folder.getRepository().returnSVNClient(svnClient); } }
Example 5
Source File: SVNMoveDeleteHook.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
private void deleteResource(ISVNLocalResource resource) throws SVNException { ISVNClientAdapter svnClient = resource.getRepository().getSVNClient(); try { svnClient.remove(new File[] { resource.getResource().getLocation().toFile() }, true); } catch (SVNClientException e) { throw new SVNException(IStatus.ERROR, TeamException.UNABLE, e.getMessage(), e); } finally { resource.getRepository().returnSVNClient(svnClient); } }