diff options
author | Michael Valenta | 2003-09-24 20:59:29 +0000 |
---|---|---|
committer | Michael Valenta | 2003-09-24 20:59:29 +0000 |
commit | 5f8150f899baaf723d84e6ea78aaddfec8f7fb25 (patch) | |
tree | 22401d4fb8cd5795fae7877f63c6bc9234a0948f | |
parent | 2431dfd5fe053091ce2afc8dae123f77fc07c37c (diff) | |
download | eclipse.platform.team-5f8150f899baaf723d84e6ea78aaddfec8f7fb25.tar.gz eclipse.platform.team-5f8150f899baaf723d84e6ea78aaddfec8f7fb25.tar.xz eclipse.platform.team-5f8150f899baaf723d84e6ea78aaddfec8f7fb25.zip |
43296: Background auto-build and .vcm_meta fileI20030925
11 files changed, 14 insertions, 603 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/plugin.properties b/bundles/org.eclipse.team.cvs.core/plugin.properties index dbf90fa22..8dfac4eeb 100644 --- a/bundles/org.eclipse.team.cvs.core/plugin.properties +++ b/bundles/org.eclipse.team.cvs.core/plugin.properties @@ -10,5 +10,4 @@ ############################################################################### providerName=Eclipse.org pluginName=CVS Team Provider Core -cvsNature=CVS Team Nature -vcmMetaMarker=VCM meta file
\ No newline at end of file +cvsNature=CVS Team Nature
\ No newline at end of file diff --git a/bundles/org.eclipse.team.cvs.core/plugin.xml b/bundles/org.eclipse.team.cvs.core/plugin.xml index 9ff5a3c9c..61048381f 100644 --- a/bundles/org.eclipse.team.cvs.core/plugin.xml +++ b/bundles/org.eclipse.team.cvs.core/plugin.xml @@ -190,25 +190,7 @@ pattern="core"> </ignore> </extension> -<!-- *************** Markers **************** --> - <extension - id="cvsmarker" - point="org.eclipse.core.resources.markers"> - </extension> - <extension - id="vcmmeta" - name="%vcmMetaMarker" - point="org.eclipse.core.resources.markers"> - <super - type="org.eclipse.core.resources.problemmarker"> - </super> - <super - type="org.eclipse.team.cvs.core.cvsmarker"> - </super> - <persistent - value="true"> - </persistent> - </extension> + <!-- ************ File Types *************** --> <extension point="org.eclipse.team.core.fileTypes"> diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java index 2d1000b93..def41934c 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSProviderPlugin.java @@ -54,7 +54,6 @@ import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.core.resources.FileModificationManager; import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; import org.eclipse.team.internal.ccvs.core.util.BuildCleanupListener; -import org.eclipse.team.internal.ccvs.core.util.ProjectDescriptionManager; import org.eclipse.team.internal.ccvs.core.util.SyncFileChangeListener; import org.eclipse.team.internal.ccvs.core.util.Util; @@ -112,7 +111,6 @@ public class CVSProviderPlugin extends Plugin { // CVS specific resource delta listeners private BuildCleanupListener addDeleteMoveListener; private FileModificationManager fileModificationManager; - private ProjectDescriptionManager projectDescriptionListener; private SyncFileChangeListener metaFileSyncListener; private static final String REPOSITORIES_STATE_FILE = ".cvsProviderState"; //$NON-NLS-1$ @@ -320,9 +318,7 @@ public class CVSProviderPlugin extends Plugin { IWorkspace workspace = ResourcesPlugin.getWorkspace(); addDeleteMoveListener = new BuildCleanupListener(); fileModificationManager = new FileModificationManager(); - projectDescriptionListener = new ProjectDescriptionManager(); metaFileSyncListener = new SyncFileChangeListener(); - workspace.addResourceChangeListener(projectDescriptionListener, IResourceChangeEvent.PRE_AUTO_BUILD); workspace.addResourceChangeListener(addDeleteMoveListener, IResourceChangeEvent.POST_AUTO_BUILD); workspace.addResourceChangeListener(metaFileSyncListener, IResourceChangeEvent.POST_CHANGE); workspace.addResourceChangeListener(fileModificationManager, IResourceChangeEvent.POST_CHANGE); @@ -346,7 +342,6 @@ public class CVSProviderPlugin extends Plugin { // remove listeners IWorkspace workspace = ResourcesPlugin.getWorkspace(); workspace.removeResourceChangeListener(metaFileSyncListener); - workspace.removeResourceChangeListener(projectDescriptionListener); workspace.removeResourceChangeListener(fileModificationManager); workspace.removeResourceChangeListener(addDeleteMoveListener); @@ -737,7 +732,7 @@ public class CVSProviderPlugin extends Plugin { ICVSFolder folder = (ICVSFolder)CVSWorkspaceRoot.getCVSResourceFor(projects[i]); FolderSyncInfo info = folder.getFolderSyncInfo(); if (info != null) { - ICVSRepositoryLocation result = getRepository(info.getRoot()); + getRepository(info.getRoot()); } } } @@ -781,8 +776,10 @@ public class CVSProviderPlugin extends Plugin { } else if (count == REPOSITORIES_STATE_FILE_VERSION_2) { count = dis.readInt(); for (int i = 0; i < count; i++) { - ICVSRepositoryLocation root = getRepository(dis.readUTF()); - String programName = dis.readUTF(); + // Perform a get on the repository so it is added to the plugin + getRepository(dis.readUTF()); + // Read the next field which is no longer used + dis.readUTF(); } } else { Util.logError(Policy.bind("CVSProviderPlugin.unknownStateFileVersion", new Integer(count).toString()), null); //$NON-NLS-1$ @@ -799,7 +796,7 @@ public class CVSProviderPlugin extends Plugin { while (it.hasNext()) { CVSRepositoryLocation root = (CVSRepositoryLocation)it.next(); dos.writeUTF(root.getLocation()); - dos.writeUTF("unused"); // place holder for an additional configuration parameter + dos.writeUTF("unused"); // place holder for an additional configuration parameter //$NON-NLS-1$ } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java index 6d692b1da..9b6fd024e 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/listeners/LogListener.java @@ -140,9 +140,8 @@ public class LogListener extends CommandOutputListener { String serverMessage = getServerMessage(line, location); if (serverMessage != null) { // look for the following condition - // E cvs server: nothing known about .vcm_meta + // E cvs server: nothing known about fileName if (serverMessage.startsWith(NOTHING_KNOWN_ABOUT)) { - String filename = serverMessage.substring(NOTHING_KNOWN_ABOUT.length()); return new CVSStatus(IStatus.ERROR, CVSStatus.DOES_NOT_EXIST, commandRoot, line); } } diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties index 8572fb245..98fdd3dba 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/messages.properties @@ -105,15 +105,6 @@ CVSTeamProvider.errorGettingWatchEdit=Could not get "watch/edit" property for pr CVSTeamProvider.errorSettingWatchEdit=Could not set "watch/edit" property for project ''{0}''. CVSTeamProvider.errorAddingFileToDiff=An I/O error occurred adding file ''{0}'' to the patch output. -ProjectDescriptionManager.unableToSetDescription=An error occurred setting the project description -ProjectDescriptionManager.unableToReadDescription=An error occurred reading the project description -ProjectDescriptionManager.ioDescription=An I/O error occurred while writing the project description -ProjectDescriptionManager.coreDescription=A Core error occurred while writing the project description -ProjectDescriptionManager.vcmmetaIgnored=.vcm_meta file ignored for project {0} -ProjectDescriptionManager.cannotUpdateDesc=Cannot update project description -ProjectDescriptionManager.markerError=Error creating marker for .vcm_meta file. -ProjectDescriptionManager.vcmmetaMarker=The file {0} exists in {1} but is no longer being read; its usage has been replaced with .project. - ResourceDeltaVisitor.visitError=Error while processing resource deltas ResponseDispatcher.serverError=The CVS server responded with an error (see the CVS console) diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionContentHandler.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionContentHandler.java deleted file mode 100644 index 4d412a8eb..000000000 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionContentHandler.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ccvs.core.util; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Stack; - -import org.eclipse.core.resources.ICommand; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.team.internal.ccvs.core.Policy; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; - -public class ProjectDescriptionContentHandler implements ContentHandler { - - IProjectDescription desc; - boolean inProjectDescription = false; - - boolean inComment = false; - StringBuffer buffer = new StringBuffer(); - - boolean inBuilder = false; - List builders = new ArrayList(); - ICommand currentBuilder = null; - Map args = new HashMap(); - - List natures = new ArrayList(); - - List references = new ArrayList(); - - Stack tagStack = new Stack(); - - ProjectDescriptionContentHandler(IProjectDescription desc) { - this.desc = desc; - } - /** - * @see ContentHandler#characters(char[], int, int) - */ - public void characters(char[] chars, int startIndex, int length) - throws SAXException { - buffer.append(chars, startIndex, length); - } - /** - * @see ContentHandler#endDocument() - */ - public void endDocument() throws SAXException { - } - /** - * @see ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) - */ - public void endElement(String namespaceURI, String localName, String qName) - throws SAXException { - if (localName.equals("project-description") && inProjectDescription) { //$NON-NLS-1$ - inProjectDescription = false; - desc.setBuildSpec((ICommand[]) builders.toArray(new ICommand[builders.size()])); - desc.setNatureIds((String[]) natures.toArray(new String[natures.size()])); - desc.setReferencedProjects( - (IProject[]) references.toArray(new IProject[references.size()])); - } else if (localName.equals("comment") && inProjectDescription && inComment) { //$NON-NLS-1$ - inComment = false; - desc.setComment(buffer.toString()); - } else if (localName.equals("builder") && inProjectDescription && inBuilder) { //$NON-NLS-1$ - inBuilder = false; - currentBuilder.setArguments(args); - if (currentBuilder.getBuilderName() != null) - builders.add(currentBuilder); - } - if (!localName.equals(tagStack.peek())) { - throw new RuntimeException(Policy.bind("ProjectDescriptionContentHandler.xml")); //$NON-NLS-1$ - } - tagStack.pop(); - } - /** - * @see ContentHandler#endPrefixMapping(java.lang.String) - */ - public void endPrefixMapping(String arg0) throws SAXException { - } - /** - * @see ContentHandler#ignorableWhitespace(char[], int, int) - */ - public void ignorableWhitespace(char[] arg0, int arg1, int arg2) - throws SAXException { - } - /** - * @see ContentHandler#processingInstruction(java.lang.String, java.lang.String) - */ - public void processingInstruction(String arg0, String arg1) - throws SAXException { - } - /** - * @see ContentHandler#setDocumentLocator(org.xml.sax.Locator) - */ - public void setDocumentLocator(Locator arg0) { - } - /** - * @see ContentHandler#skippedEntity(java.lang.String) - */ - public void skippedEntity(String e) throws SAXException { - } - /** - * @see ContentHandler#startDocument() - */ - public void startDocument() throws SAXException { - } - /** - * @see ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement( - String namespaceURI, - String localName, - String qName, - Attributes atts) - throws SAXException { - if (localName.equals("project-description") && !inProjectDescription) { //$NON-NLS-1$ - inProjectDescription = true; - } else if (localName.equals("comment") && inProjectDescription && !inComment) { //$NON-NLS-1$ - inComment = true; - } else if (localName.equals("builder") && inProjectDescription && !inBuilder) { //$NON-NLS-1$ - String builderName = atts.getValue("name"); //$NON-NLS-1$ - if (builderName != null) { - inBuilder = true; - currentBuilder = desc.newCommand(); - currentBuilder.setBuilderName(builderName); - args = new HashMap(11); - } - } else if (localName.equals("arg") && inProjectDescription && inBuilder) { //$NON-NLS-1$ - String argName = atts.getValue("name"); //$NON-NLS-1$ - String argValue = atts.getValue("value"); //$NON-NLS-1$ - if (argName != null && argValue != null) - args.put(argName, argValue); - } else if (localName.equals("nature") && inProjectDescription && !inBuilder) { //$NON-NLS-1$ - String natureId = atts.getValue("id"); //$NON-NLS-1$ - if (natureId != null) - natures.add(natureId); - } else if ( - localName.equals("reference") && inProjectDescription && !inBuilder) { //$NON-NLS-1$ - String projectName = atts.getValue("project-name"); //$NON-NLS-1$ - if (projectName != null) - references.add( - ResourcesPlugin.getWorkspace().getRoot().getProject(projectName)); - } - // empty buffer - buffer = new StringBuffer(); - tagStack.push(localName); - } - /** - * @see ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) - */ - public void startPrefixMapping(String arg0, String arg1) throws SAXException { - } -} diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java deleted file mode 100644 index a2cc5550a..000000000 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionManager.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ccvs.core.util; - - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.xerces.parsers.SAXParser; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.team.core.RepositoryProvider; -import org.eclipse.team.core.TeamException; -import org.eclipse.team.internal.ccvs.core.CVSException; -import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; -import org.eclipse.team.internal.ccvs.core.CVSTeamProvider; -import org.eclipse.team.internal.ccvs.core.ICVSFile; -import org.eclipse.team.internal.ccvs.core.ICVSFolder; -import org.eclipse.team.internal.ccvs.core.Policy; -import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -/** - * This class handles the updating of the .vcm_meta file in projects managed by the CVSTeamProvider. - * - * It does so by listening to deltas on the project description and the .vcm_meta file itself. - * - */ -public class ProjectDescriptionManager implements IResourceChangeListener { - - public final static IPath PROJECT_DESCRIPTION_PATH = new Path(".vcm_meta"); //$NON-NLS-1$ - public final static IPath CORE_PROJECT_DESCRIPTION_PATH = new Path(".project"); //$NON-NLS-1$ - public final static boolean UPDATE_PROJECT_DESCRIPTION_ON_LOAD = true; - - public static final String VCMMETA_MARKER = "org.eclipse.team.cvs.core.vcmmeta"; //$NON-NLS-1$ - - /* - * Read the project meta file into the provider description - */ - public static void readProjectDescription(IProjectDescription desc, InputStream stream) throws IOException, CVSException { - SAXParser parser = new SAXParser(); - parser.setContentHandler(new ProjectDescriptionContentHandler(desc)); - try { - parser.parse(new InputSource(stream)); - } catch (SAXException ex) { - throw new CVSException(IStatus.ERROR, IStatus.ERROR, Policy.bind("ProjectDescriptionManager.unableToReadDescription"), ex); //$NON-NLS-1$ - } - } - - public static void writeProjectDescription(IProject project, IProgressMonitor progress) throws CVSException { - - // generate the new contents of the project meta file into a string - ByteArrayOutputStream byteOutputStream = new ByteArrayOutputStream(); - String newContents = null; - try { - IProjectDescription desc = project.getDescription(); - ProjectDescriptionWriter.writeProjectDescription(desc, byteOutputStream); - byteOutputStream.close(); - newContents = byteOutputStream.toString("UTF8"); //$NON-NLS-1$ - } catch (IOException ex) { - throw CVSException.wrapException(project, Policy.bind("ProjectDescriptionManager.ioDescription"), ex); //$NON-NLS-1$ - } catch (CoreException ex) { - throw CVSException.wrapException(project, Policy.bind("ProjectDescriptionManager.coreDescription"), ex); //$NON-NLS-1$ - } - - IFile descResource = project.getFile(PROJECT_DESCRIPTION_PATH); - if (descResource.exists()) { - // check if the existing contents are the same before rewriting - String oldContents = null; - try { - StringBuffer stringBuffer = new StringBuffer(); - InputStream is = ((IFile) descResource).getContents(); - byte[] buf = new byte[512]; - int result = is.read(buf); - while (result != -1) { - stringBuffer.append(new String(buf, 0, result, "UTF8")); //$NON-NLS-1$ - result = is.read(buf); - } - oldContents = stringBuffer.toString(); - is.close(); - } catch (IOException ex) { - throw CVSException.wrapException(project, Policy.bind("ProjectDescriptionManager.ioDescription"), ex); //$NON-NLS-1$ - } catch (CoreException ex) { - throw CVSException.wrapException(project, Policy.bind("ProjectDescriptionManager.coreDescription"), ex); //$NON-NLS-1$ - } - - if (oldContents.equals(newContents)) { - // the contents of the new file would be the same as the old - return; - } - try { - descResource.setContents( - new ByteArrayInputStream(byteOutputStream.toByteArray()), - false, - false, - progress); - } catch (CoreException ex) { - throw CVSException.wrapException(project, Policy.bind("ProjectDescriptionManager.coreDescription"), ex); //$NON-NLS-1$ - } - } else { - try { - descResource.create( - new ByteArrayInputStream(byteOutputStream.toByteArray()), - false, - progress); - } catch (CoreException ex) { - throw CVSException.wrapException(descResource, Policy.bind("ProjectDescriptionManager.coreDescription"), ex); //$NON-NLS-1$ - } - - } - } - - /* - * To be called whenever the project description file is believed to have changed by - * a load/loadIfIncoming operation. - */ - public static void updateProjectIfNecessary(IProject project, IProgressMonitor progress) throws CoreException, CVSException { - - IFile descResource = project.getFile(PROJECT_DESCRIPTION_PATH); - if (descResource.exists() && UPDATE_PROJECT_DESCRIPTION_ON_LOAD) { - - // If a managed .project files exists, don't read the .vcm_meta - ICVSFile coreDescResource = CVSWorkspaceRoot.getCVSFileFor(project.getFile(CORE_PROJECT_DESCRIPTION_PATH)); - if (coreDescResource.exists() && coreDescResource.isManaged()) { - createVCMMetaMarker(descResource); - Util.logError(Policy.bind("ProjectDescriptionManager.vcmmetaIgnored", project.getName()), null); //$NON-NLS-1$ - return; - } else { - ICVSFolder folder = CVSWorkspaceRoot.getCVSFolderFor(project); - if (! folder.isCVSFolder()) { - createVCMMetaMarker(descResource); - Util.logError(Policy.bind("ProjectDescriptionManager.vcmmetaIgnored", project.getName()), null); //$NON-NLS-1$ - return; - } - } - - // update project description file (assuming it has changed) - IProjectDescription desc = project.getDescription(); - DataInputStream is = null; - try { - is = new DataInputStream(((IFile) descResource).getContents()); - try { - readProjectDescription(desc, is); - } finally { - is.close(); - } - try { - project.setDescription(desc, IResource.FORCE | IResource.KEEP_HISTORY, progress); - } catch (CoreException ex) { - // Failing to set the description is probably due to a missing nature - // Other natures are still set - Util.logError(Policy.bind("ProjectDescriptionManager.unableToSetDescription"), ex); //$NON-NLS-1$ - } - - // Make sure we are still marked as a CVS project - if(RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()) == null) - RepositoryProvider.map(project, CVSProviderPlugin.getTypeId()); - - // Mark the .vcm_meta file with a problem marker - if (project.getFile(CORE_PROJECT_DESCRIPTION_PATH).exists()) { - createVCMMetaMarker(descResource); - } - } catch(TeamException ex) { - Util.logError(Policy.bind("ProjectDescriptionManager.unableToReadDescription"), ex); //$NON-NLS-1$ - // something went wrong, delete the project description file - descResource.delete(true, progress); - } catch (IOException ex) { - Util.logError(Policy.bind("ProjectDescriptionManager.unableToReadDescription"), ex); //$NON-NLS-1$ - // something went wrong, delete the project description file - descResource.delete(true, progress); - } - } - } - - /* - * Write out the project description file. - * - * For now just do it. It would be nice to detect the proper conditions - * - */ - public static void writeProjectDescriptionIfNecessary(CVSTeamProvider provider, IResource resource, IProgressMonitor monitor) throws CVSException { - if (resource.getType() == IResource.PROJECT || isProjectDescription(resource)) { - IProject project = resource.getProject(); - if (project.getFile(PROJECT_DESCRIPTION_PATH).exists() /* || ! project.getFile(CORE_PROJECT_DESCRIPTION_PATH).exists() */) { - writeProjectDescription(project, monitor); - } - } - } - - public static boolean isProjectDescription(IResource resource) { - return resource.getProjectRelativePath().equals(PROJECT_DESCRIPTION_PATH); - } - - public void resourceChanged(IResourceChangeEvent event) { - try { - IResourceDelta root = event.getDelta(); - IResourceDelta[] projectDeltas = root.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.ADDED); - for (int i = 0; i < projectDeltas.length; i++) { - IResourceDelta delta = projectDeltas[i]; - IResource resource = delta.getResource(); - if (resource.getType() == IResource.PROJECT) { - IProject project = (IProject)resource; - RepositoryProvider provider = RepositoryProvider.getProvider(project, CVSProviderPlugin.getTypeId()); - if (provider == null) continue; - // First, check if the .vcm_meta file for the project is in the delta. - IResourceDelta[] children = delta.getAffectedChildren(IResourceDelta.ADDED); - boolean inSync = false; - for (int j = 0; j < children.length; j++) { - IResourceDelta childDelta = children[j]; - IResource childResource = childDelta.getResource(); - if (isProjectDescription(childResource)) - switch (childDelta.getKind()) { - case IResourceDelta.REMOVED: - writeProjectDescriptionIfNecessary((CVSTeamProvider)provider, project, Policy.monitorFor(null)); - inSync = true; - break; - case IResourceDelta.CHANGED: - case IResourceDelta.ADDED: - updateProjectIfNecessary(project, Policy.monitorFor(null)); - inSync = true; - break; - } - } - // Check if we didn't do anything above and the project description changed. - if (! inSync && (delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { - writeProjectDescriptionIfNecessary((CVSTeamProvider)provider, project, Policy.monitorFor(null)); - } - } - } - } catch (CVSException ex) { - Util.logError(Policy.bind("ProjectDescriptionManager.cannotUpdateDesc"), ex); //$NON-NLS-1$ - } catch (CoreException ex) { - Util.logError(Policy.bind("ProjectDescriptionManager.cannotUpdateDesc"), ex); //$NON-NLS-1$ - } - } - - protected static IMarker createVCMMetaMarker(IResource resource) { - try { - IMarker[] markers = resource.findMarkers(VCMMETA_MARKER, false, IResource.DEPTH_ZERO); - if (markers.length == 1) { - return markers[0]; - } - IMarker marker = resource.createMarker(VCMMETA_MARKER); - marker.setAttribute(IMarker.MESSAGE, Policy.bind("ProjectDescriptionManager.vcmmetaMarker" , resource.getName(), resource.getProject().getName())); //$NON-NLS-1$ - return marker; - } catch (CoreException e) { - Util.logError(Policy.bind("ProjectDescriptionManager.markerError"), e); //$NON-NLS-1$ - } - return null; - } -} diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java deleted file mode 100644 index d49624873..000000000 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/util/ProjectDescriptionWriter.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2003 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.team.internal.ccvs.core.util; - -import java.util.*; -import org.eclipse.core.resources.*; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; - -import java.io.*; - -// NIK: Maybe we should make the Strings constants ? - -public class ProjectDescriptionWriter { - private static void appendEscapedChar(StringBuffer buffer, char c) { - String replacement = getReplacement(c); - if (replacement != null) { - buffer.append('&'); - buffer.append(replacement); - buffer.append(';'); - } else { - if ((c >= ' ' && c <= 0x7E) || c == '\n' || c == '\r' || c == '\t') { - buffer.append(c); - } else { - buffer.append("&#"); //$NON-NLS-1$ - buffer.append(Integer.toString(c)); - buffer.append(';'); - } - } - } - public static String getEscaped(String s) { - StringBuffer result = new StringBuffer(s.length() + 10); - for (int i = 0; i < s.length(); ++i) - appendEscapedChar(result, s.charAt(i)); - return result.toString(); - } - private static String getReplacement(char c) { - // Encode special XML characters into the equivalent character references. - // These five are defined by default for all XML documents. - switch (c) { - case '<' : - return "lt"; //$NON-NLS-1$ - case '>' : - return "gt"; //$NON-NLS-1$ - case '"' : - return "quot"; //$NON-NLS-1$ - case '\'' : - return "apos"; //$NON-NLS-1$ - case '&' : - return "amp"; //$NON-NLS-1$ - } - return null; - } - public static void writeProjectDescription( - IProjectDescription desc, - OutputStream os) - throws IOException { - PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, "UTF8")); //$NON-NLS-1$ - writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$ - writer.println("<project-description>"); //$NON-NLS-1$ - - String comment = desc.getComment(); - if (comment != null) { - writer.print("\t<comment>"); //$NON-NLS-1$ - writer.print(getEscaped(desc.getComment())); - writer.println("</comment>"); //$NON-NLS-1$ - } - - String[] natures = desc.getNatureIds(); - for (int i = 0; i < natures.length; i++) { - if ( ! natures[i].equals(CVSProviderPlugin.getTypeId())) - writer.println("\t<nature id=\"" + getEscaped(natures[i]) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - IProject[] references = desc.getReferencedProjects(); - for (int i = 0; i < references.length; i++) { - writer.println( - "\t<reference project-name=\"" + getEscaped(references[i].getName()) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - ICommand[] commands = desc.getBuildSpec(); - for (int i = 0; i < commands.length; i++) { - writer.println( - "\t<builder name=\"" + getEscaped(commands[i].getBuilderName()) + "\">"); //$NON-NLS-1$ //$NON-NLS-2$ - Map args = commands[i].getArguments(); - for (Iterator it = args.keySet().iterator(); it.hasNext();) { - String argName = (String) it.next(); - String argValue = (String) args.get(argName); - writer.println( - "\t\t<arg name=\"" //$NON-NLS-1$ - + getEscaped(argName) - + "\" value=\"" //$NON-NLS-1$ - + getEscaped(argValue) - + "\"/>"); //$NON-NLS-1$ - } - writer.println("\t</builder>"); //$NON-NLS-1$ - } - - writer.println("</project-description>"); //$NON-NLS-1$ - writer.flush(); - } -} diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java index 20df10c4d..58461b07f 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/operations/HasProjectMetaFileOperation.java @@ -18,7 +18,7 @@ import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; import org.eclipse.team.internal.ccvs.ui.Policy; /** - * Operation which checks for the existance of the .project file (or .vcm_meta file) + * Operation which checks for the existance of the .project file * in a remote folder. The operation can be run using the <code>hasMetaFile</code> * static method of by executing the operation and then checking <code>metaFileExists</code> */ @@ -40,7 +40,7 @@ public class HasProjectMetaFileOperation extends CVSOperation { /* * Return true if the provided remote folder contains a valid meta-file - * (i.e. .project or the older .vcm_meta file). + * (i.e. .project file). */ private boolean hasMetaFile(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException { @@ -60,13 +60,6 @@ public class HasProjectMetaFileOperation extends CVSOperation { } catch (TeamException e) { // We couldn't retrieve the meta file so assume it doesn't exist } - // If the above failed, look for the old .vcm_meta file - try { - folder.getFile(".vcm_meta"); //$NON-NLS-1$ - return true; - } catch (TeamException e) { - // We couldn't retrieve the meta file so assume it doesn't exist - } return false; } diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java index 878222083..eee7f8953 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryManager.java @@ -242,7 +242,7 @@ public class RepositoryManager { } /* - * Fetches tags from .project and .vcm_meta if they exist. Then fetches tags from the user defined auto-refresh file + * Fetches tags from auto-refresh files if they exist. Then fetches tags from the user defined auto-refresh file * list. The fetched tags are cached in the CVS ui plugin's tag cache. */ public void refreshDefinedTags(ICVSFolder project, boolean replace, boolean notify, IProgressMonitor monitor) throws TeamException { @@ -569,7 +569,7 @@ public class RepositoryManager { private String getCurrentComment() { if (previousComments.length == 0) return ""; //$NON-NLS-1$ - return (String)previousComments[0]; + return previousComments[0]; } /** diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java index c78467b60..dccb1b6f3 100644 --- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java +++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/repo/RepositoryRoot.java @@ -43,7 +43,7 @@ import org.eclipse.team.internal.ccvs.ui.XMLWriter; public class RepositoryRoot extends PlatformObject { - public static final String[] DEFAULT_AUTO_REFRESH_FILES = { ".project", ".vcm_meta" }; //$NON-NLS-1$ //$NON-NLS-2$ + public static final String[] DEFAULT_AUTO_REFRESH_FILES = { ".project" }; //$NON-NLS-1$ //$NON-NLS-2$ private static final String DEFINED_MODULE_PREFIX = "module:"; //$NON-NLS-1$ ICVSRepositoryLocation root; |