コード例 #1
0
 private void writeState(XMLWriter writer) {
   writer.startTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG, null, true);
   // Write the repositories
   Collection repos = Arrays.asList(getKnownRepositoryLocations());
   Iterator it = repos.iterator();
   while (it.hasNext()) {
     CVSRepositoryLocation location = (CVSRepositoryLocation) it.next();
     RepositoryRoot root = getRepositoryRootFor(location);
     root.writeState(writer);
   }
   writer.endTag(RepositoriesViewContentHandler.REPOSITORIES_VIEW_TAG);
 }
コード例 #2
0
 protected void saveState() throws TeamException {
   IPath pluginStateLocation = CVSUIPlugin.getPlugin().getStateLocation();
   File tempFile =
       pluginStateLocation.append(REPOSITORIES_VIEW_FILE + ".tmp").toFile(); // $NON-NLS-1$
   File stateFile = pluginStateLocation.append(REPOSITORIES_VIEW_FILE).toFile();
   try {
     XMLWriter writer = new XMLWriter(new BufferedOutputStream(new FileOutputStream(tempFile)));
     try {
       writeState(writer);
     } finally {
       writer.close();
     }
     if (stateFile.exists()) {
       stateFile.delete();
     }
     boolean renamed = tempFile.renameTo(stateFile);
     if (!renamed) {
       throw new TeamException(
           new Status(
               IStatus.ERROR,
               CVSUIPlugin.ID,
               TeamException.UNABLE,
               NLS.bind(
                   CVSUIMessages.RepositoryManager_rename,
                   new String[] {tempFile.getAbsolutePath()}),
               null));
     }
   } catch (IOException e) {
     throw new TeamException(
         new Status(
             IStatus.ERROR,
             CVSUIPlugin.ID,
             TeamException.UNABLE,
             NLS.bind(
                 CVSUIMessages.RepositoryManager_save, new String[] {stateFile.getAbsolutePath()}),
             e));
   }
 }
コード例 #3
0
 private void writeCommentHistory(XMLWriter writer) {
   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);
 }
コード例 #4
0
 private void writeCommentTemplates(XMLWriter writer) {
   writer.startTag(ELEMENT_COMMENT_TEMPLATES, null, false);
   for (int i = 0; i < commentTemplates.length; i++)
     writer.printSimpleTag(ELEMENT_COMMIT_COMMENT, commentTemplates[i]);
   writer.endTag(ELEMENT_COMMENT_TEMPLATES);
 }