Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 25145 Details for
Bug 84808
(PatchAttached) Read project name from .project file in CVS checkout wizard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
A first level of patch: work in progress, and widly buggy
patch-to-fetch-project-name-from-metadata-2005-07-21.patch (text/plain), 12.72 KB, created by
Philippe Ombredanne
on 2005-07-21 14:19:30 EDT
(
hide
)
Description:
A first level of patch: work in progress, and widly buggy
Filename:
MIME Type:
Creator:
Philippe Ombredanne
Created:
2005-07-21 14:19:30 EDT
Size:
12.72 KB
patch
obsolete
>Index: src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java,v >retrieving revision 1.12 >diff -u -r1.12 CVSUIMessages.java >--- src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java 18 Jul 2005 14:58:00 -0000 1.12 >+++ src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java 21 Jul 2005 18:04:39 -0000 >@@ -762,6 +762,7 @@ > public static String CheckoutAsMainPage_projectNameLabel; > public static String CheckoutAsMainPage_multipleFolders; > public static String CheckoutAsMainPage_asProjects; >+ public static String CheckoutAsMainPage_asProjectsWithName; > public static String CheckoutAsMainPage_intoProject; > > public static String CheckoutAsLocationSelectionPage_title; >@@ -797,6 +798,7 @@ > public static String WorkspaceChangeSetCapability_8; > > public static String HasProjectMetaFile_taskName; >+ public static String FetchProjectDescription_taskName; > public static String TagFromWorkspace_taskName; > public static String TagFromRepository_taskName; > public static String UpdateOnlyMergeable_taskName; >Index: src/org/eclipse/team/internal/ccvs/ui/messages.properties >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties,v >retrieving revision 1.438 >diff -u -r1.438 messages.properties >--- src/org/eclipse/team/internal/ccvs/ui/messages.properties 18 Jul 2005 14:58:00 -0000 1.438 >+++ src/org/eclipse/team/internal/ccvs/ui/messages.properties 21 Jul 2005 18:04:40 -0000 >@@ -795,7 +795,8 @@ > CheckoutAsMainPage_asSimpleProject=Check out as a &project in the workspace > CheckoutAsMainPage_projectNameLabel=&Project Name: > CheckoutAsMainPage_multipleFolders=Choose how to check out the {0} folders >-CheckoutAsMainPage_asProjects=Check out into the &workspace as projects >+CheckoutAsMainPage_asProjects=Check out into the &workspace as projects using module name as project name >+CheckoutAsMainPage_asProjectsWithName=Check out into the workspace as projects using configured project &name > CheckoutAsMainPage_intoProject=Check out &into an existing project > > CheckoutAsLocationSelectionPage_title=Check Out As >@@ -835,6 +836,7 @@ > > > HasProjectMetaFile_taskName=Looking for a remote meta file >+FetchProjectDescription_taskName=Retrieving remote project meta file > TagFromWorkspace_taskName=Tagging from workspace > TagFromRepository_taskName=Tagging from repository > UpdateOnlyMergeable_taskName=Updating mergeable changes >Index: src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java,v >retrieving revision 1.14 >diff -u -r1.14 CheckoutAsMainPage.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java 31 May 2005 15:16:52 -0000 1.14 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsMainPage.java 21 Jul 2005 18:04:41 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.team.internal.ccvs.ui.wizards; > >+import java.lang.reflect.InvocationTargetException; >+ > import org.eclipse.core.resources.*; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Path; >@@ -24,6 +26,8 @@ > import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; > import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; > import org.eclipse.team.internal.ccvs.ui.IHelpContextIds; >+import org.eclipse.team.internal.ccvs.ui.operations.FetchProjectDescriptionOperation; >+import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.PlatformUI; > > /** >@@ -41,7 +45,8 @@ > private Button configuredProjectButton; > private Text projectNameField; > private ICVSRemoteFolder[] folders; >- >+ private IWorkbenchPart part; >+ > public static final String NAME = "CheckoutAsMainPage"; //$NON-NLS-1$ > > /** >@@ -50,12 +55,25 @@ > * @param titleImage > * @param description > */ >- public CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration) { >+ private CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration) { > super(NAME, CVSUIMessages.CheckoutAsMainPage_title, titleImage, CVSUIMessages.CheckoutAsMainPage_description); //$NON-NLS-1$ //$NON-NLS-2$ > this.folders = folders; > this.allowProjectConfiguration = allowProjectConfiguration; > } > >+ /** >+ * @param pageName >+ * @param title >+ * @param titleImage >+ * @param description >+ * @param part >+ */ >+ public CheckoutAsMainPage(ImageDescriptor titleImage, ICVSRemoteFolder[] folders, boolean allowProjectConfiguration, IWorkbenchPart part) { >+ this(titleImage, folders, allowProjectConfiguration); >+ this.part = part; >+ } >+ >+ > /* (non-Javadoc) > * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) > */ >@@ -87,7 +105,14 @@ > * For the single folder case, return the name of the folder > */ > private String getFolderName() { >- String name = folders[0].getName(); >+ String name ; >+ //attempt to get the name from the project meta data if possible >+ name = getFolderProjectName(); >+ if (name != null) { >+ return name; >+ } >+ //if not just use the folder name, ie "module" name >+ name = folders[0].getName(); > if (name .equals(".")) { //$NON-NLS-1$ > name = new Path(null, folders[0].getRepository().getRootDirectory()).lastSegment(); > } >@@ -95,6 +120,23 @@ > } > > /* >+ * For the single folder case, return the name of the project >+ * from the project description >+ */ >+ private String getFolderProjectName() { >+ IProjectDescription project; >+ try { >+ project = FetchProjectDescriptionOperation.getProjectDescription(part, folders[0]); >+ return project.getName(); >+ } catch (InvocationTargetException e) { >+ //ignore >+ } catch (InterruptedException e) { >+ //ignore >+ } >+ return null; >+ } >+ >+ /* > * Create the page contents for a single folder checkout > */ > private void createSingleFolderArea(Composite composite) { >Index: src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java,v >retrieving revision 1.15 >diff -u -r1.15 CheckoutAsWizard.java >--- src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java 30 Jun 2005 19:50:49 -0000 1.15 >+++ src/org/eclipse/team/internal/ccvs/ui/wizards/CheckoutAsWizard.java 21 Jul 2005 18:04:41 -0000 >@@ -94,7 +94,7 @@ > setNeedsProgressMonitor(true); > ImageDescriptor substImage = CVSUIPlugin.getPlugin().getImageDescriptor(ICVSUIConstants.IMG_WIZBAN_CHECKOUT); > >- mainPage = new CheckoutAsMainPage(substImage, remoteFolders, allowProjectConfiguration); >+ mainPage = new CheckoutAsMainPage(substImage, remoteFolders, allowProjectConfiguration, part); > addPage(mainPage); > > projectSelectionPage = new CheckoutAsProjectSelectionPage(substImage, remoteFolders); >Index: src/org/eclipse/team/internal/ccvs/ui/operations/FetchProjectDescriptionOperation.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/ui/operations/FetchProjectDescriptionOperation.java >diff -N src/org/eclipse/team/internal/ccvs/ui/operations/FetchProjectDescriptionOperation.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/ui/operations/FetchProjectDescriptionOperation.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,126 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ * nexB Inc. - implementation of patch for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=84808 >+ *******************************************************************************/ >+package org.eclipse.team.internal.ccvs.ui.operations; >+ >+import java.io.IOException; >+import java.io.InputStream; >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.core.resources.IProjectDescription; >+import org.eclipse.core.resources.IWorkspace; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.team.core.TeamException; >+import org.eclipse.team.internal.ccvs.core.CVSException; >+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFile; >+import org.eclipse.team.internal.ccvs.core.ICVSRemoteFolder; >+import org.eclipse.team.internal.ccvs.ui.CVSUIMessages; >+import org.eclipse.ui.IWorkbenchPart; >+ >+/** >+ * Operation which retrieves a .project file in a remote folder. The operation >+ * can be run using the <code>getProjectDescription</code> static method >+ * static method or by executing the operation and then checking <code>getProjectDescription()</code> >+ */ >+public class FetchProjectDescriptionOperation extends CVSOperation { >+ >+ private ICVSRemoteFolder remoteFolder; >+ private IProjectDescription projectDescription; >+ >+ public static IProjectDescription getProjectDescription(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) >+ throws InvocationTargetException, InterruptedException { >+ FetchProjectDescriptionOperation op = new FetchProjectDescriptionOperation(part, remoteFolder); >+ op.run(); >+ return op.getProjectDescription(); >+ } >+ >+ public FetchProjectDescriptionOperation(IWorkbenchPart part, ICVSRemoteFolder remoteFolder) { >+ super(part); >+ this.remoteFolder = remoteFolder; >+ } >+ >+ /* >+ * Return a Stream containing the .project file or null if retrieval failed >+ */ >+ private IProjectDescription fetchRemoteProjectDescription(ICVSRemoteFolder folder, IProgressMonitor monitor) throws CVSException { >+ >+ // make a copy of the folder so that we will not effect the original >+ // folder when we refetch the members >+ // TODO: this is a strange thing to need to do. We should fix this. >+ // Note: This behavior was inherited from HasProjectMetaFileOperation >+ folder = (ICVSRemoteFolder) folder.forTag(remoteFolder.getTag()); >+ >+ try { >+ folder.members(monitor); >+ } catch (TeamException e) { >+ throw CVSException.wrapException(e); >+ } >+ // Check for the existance of the .project file >+ // and attempt to create an IProjectDescription of it. >+ InputStream in = null; >+ try { >+ ICVSRemoteFile remote = (ICVSRemoteFile) folder.getFile(".project"); //$NON-NLS-1$ >+ in = remote.getContents(monitor); >+ if (in == null || monitor.isCanceled()) { >+ return null; >+ } >+ IWorkspace workspace = ResourcesPlugin.getWorkspace(); >+ IProjectDescription projectDesc = workspace.loadProjectDescription(in); >+ return projectDesc; >+ } catch (TeamException e) { >+ // We couldn't retrieve the project meta file so assume it doesn't exist >+ } catch (CoreException e) { >+ // We couldn't read the project description, so assume the >+ // metafile is not a metafile, or is incorrect >+ // which i as if it does not exist >+ } finally { >+ try { >+ if (in != null) >+ in.close(); >+ } catch (IOException e) { >+ // ignore >+ } >+ } >+ return null; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#execute(org.eclipse.core.runtime.IProgressMonitor) >+ */ >+ public void execute(IProgressMonitor monitor) throws CVSException, InterruptedException { >+ projectDescription= fetchRemoteProjectDescription(remoteFolder, monitor); >+ } >+ >+ /** >+ * Return the project description containing the remote project meta information >+ * if the .project file was properly retrieved or null if not. >+ * This method should only be invoked after the operation has been executed; >+ */ >+ public IProjectDescription getProjectDescription() { >+ return projectDescription; >+ } >+ >+ protected String getTaskName() { >+ return CVSUIMessages.FetchProjectDescription_taskName; //$NON-NLS-1$ >+ } >+ >+ /* >+ * (non-Javadoc) >+ * @see org.eclipse.team.internal.ccvs.ui.operations.CVSOperation#canRunAsJob() >+ */ >+ public boolean canRunAsJob() { >+ // This operation should never be run in the background. >+ return false; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 84808
:
25145
|
25640
|
25641
|
26058