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 56177 Details for
Bug 162608
[Project Sets] Be able to import a .psf file directly from a URL
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]
Patch
clipboard38400.txt (text/plain), 12.54 KB, created by
Willian Mitsuda
on 2006-12-25 19:10:15 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Willian Mitsuda
Created:
2006-12-25 19:10:15 EST
Size:
12.54 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.ui >Index: src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java,v >retrieving revision 1.19 >diff -u -r1.19 ProjectSetImportWizard.java >--- src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java 5 Jul 2006 15:42:21 -0000 1.19 >+++ src/org/eclipse/team/internal/ui/wizards/ProjectSetImportWizard.java 26 Dec 2006 00:05:33 -0000 >@@ -10,6 +10,8 @@ > *******************************************************************************/ > package org.eclipse.team.internal.ui.wizards; > >+import java.io.IOException; >+import java.io.InputStream; > import java.lang.reflect.InvocationTargetException; > > import org.eclipse.core.resources.IProject; >@@ -45,12 +47,17 @@ > try { > getContainer().run(true, true, new WorkspaceModifyOperation(null) { > public void execute(IProgressMonitor monitor) throws InvocationTargetException { >- String psfFile = mainPage.getFileName(); >- PsfFilenameStore.remember(psfFile); >- IProject[] newProjects= ProjectSetImporter.importProjectSet(psfFile, getShell(), monitor); >- if (workingSetName != null) >- createWorkingSet(workingSetName, newProjects); >- result[0] = true; >+ try { >+ String psfFile = mainPage.getFileName(); >+ InputStream is = mainPage.getInputStream(); >+ PsfFilenameStore.remember(psfFile); >+ IProject[] newProjects= ProjectSetImporter.importProjectSet(is, getShell(), monitor); >+ if (workingSetName != null) >+ createWorkingSet(workingSetName, newProjects); >+ result[0] = true; >+ } catch (IOException e) { >+ throw new InvocationTargetException(e); >+ } > } > }); > } catch (InterruptedException e) { >Index: src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java,v >retrieving revision 1.15 >diff -u -r1.15 ImportProjectSetMainPage.java >--- src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java 5 Jul 2006 15:42:21 -0000 1.15 >+++ src/org/eclipse/team/internal/ui/wizards/ImportProjectSetMainPage.java 26 Dec 2006 00:05:33 -0000 >@@ -10,16 +10,18 @@ > *******************************************************************************/ > package org.eclipse.team.internal.ui.wizards; > >-import java.io.File; >+import java.io.*; >+import java.net.MalformedURLException; >+import java.net.URL; > > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.jface.dialogs.Dialog; > import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.layout.GridDataFactory; > import org.eclipse.jface.resource.ImageDescriptor; > import org.eclipse.jface.window.Window; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.SelectionAdapter; >-import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.*; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >@@ -29,9 +31,14 @@ > import org.eclipse.ui.PlatformUI; > > public class ImportProjectSetMainPage extends TeamWizardPage { >+ private Button fileRadio; > Combo fileCombo; > String file = ""; //$NON-NLS-1$ >+ private URL url; >+ private Button fileBrowseButton; > Button browseButton; >+ private Button urlRadio; >+ private Text urlText; > Button addToWorkingSet; > Text workingSetField; > >@@ -39,6 +46,7 @@ > private String workingSetName = ""; //$NON-NLS-1$ > > private boolean haveBrowsed; >+ private boolean fileSelected; > > // constants > //private static final int SIZING_TEXT_FIELD_WIDTH = 80; >@@ -66,7 +74,9 @@ > layout.marginWidth = 0; > inner.setLayout(layout); > >- createLabel(inner, TeamUIMessages.ImportProjectSetMainPage_Project_Set_File_Name__2); >+ fileRadio = new Button(inner, SWT.RADIO); >+ fileRadio.setText(TeamUIMessages.ImportProjectSetMainPage_Project_Set_File_Name__2); >+ fileRadio.setSelection(true); > > fileCombo = createDropDownCombo(inner); > file = PsfFilenameStore.getSuggestedDefault(); >@@ -79,14 +89,14 @@ > } > }); > >- browseButton = new Button(inner, SWT.PUSH); >- browseButton.setText(TeamUIMessages.ImportProjectSetMainPage_Browse_3); >+ fileBrowseButton = new Button(inner, SWT.PUSH); >+ fileBrowseButton.setText(TeamUIMessages.ImportProjectSetMainPage_Browse_3); > GridData data = new GridData(); > data.horizontalAlignment = GridData.FILL; > int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); >- data.widthHint = Math.max(widthHint, browseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); >- browseButton.setLayoutData(data); >- browseButton.addListener(SWT.Selection, new Listener() { >+ data.widthHint = Math.max(widthHint, fileBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x); >+ fileBrowseButton.setLayoutData(data); >+ fileBrowseButton.addListener(SWT.Selection, new Listener() { > public void handleEvent(Event event) { > FileDialog d = new FileDialog(getShell()); > d.setFilterExtensions(new String[] {"*.psf", "*"}); //$NON-NLS-1$ //$NON-NLS-2$ >@@ -109,6 +119,32 @@ > } > }); > >+ urlRadio = new Button(inner, SWT.RADIO); >+ urlRadio.setText(TeamUIMessages.ImportProjectSetMainPage_Project_Set_File_URL); >+ >+ urlText = new Text(inner, SWT.SINGLE | SWT.BORDER); >+ urlText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create()); >+ urlText.addModifyListener(new ModifyListener() { >+ >+ public void modifyText(ModifyEvent e) { >+ updateEnablement(); >+ } >+ >+ }); >+ >+ SelectionListener radioEnablement = new SelectionAdapter() { >+ >+ public void widgetSelected(SelectionEvent e) { >+ updateEnablement(); >+ } >+ >+ }; >+ fileRadio.addSelectionListener(radioEnablement); >+ urlRadio.addSelectionListener(radioEnablement); >+ >+ Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); >+ separator.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); >+ > addWorkingSetSection(composite); > setControl(composite); > updateEnablement(); >@@ -190,24 +226,46 @@ > boolean complete; > setMessage(null); > >+ fileSelected = fileRadio.getSelection(); >+ fileCombo.setEnabled(fileSelected); >+ fileBrowseButton.setEnabled(fileSelected); >+ urlText.setEnabled(!fileSelected); >+ > workingSetField.setEnabled(addToWorkingSet.getSelection()); > browseButton.setEnabled(addToWorkingSet.getSelection()); > >- if (file.length() == 0) { >- setPageComplete(false); >- return; >+ if (fileSelected) { >+ // Check file selection >+ if (file.length() == 0) { >+ setPageComplete(false); >+ return; >+ } else { >+ // See if the file exists >+ File f = new File(file); >+ if (!f.exists()) { >+ setMessage(TeamUIMessages.ImportProjectSetMainPage_The_specified_file_does_not_exist_4, ERROR); >+ setPageComplete(false); >+ return; >+ } else if (f.isDirectory()) { >+ setMessage(TeamUIMessages.ImportProjectSetMainPage_You_have_specified_a_folder_5, ERROR); >+ setPageComplete(false); >+ return; >+ } >+ } > } else { >- // See if the file exists >- File f = new File(file); >- if (!f.exists()) { >- setMessage(TeamUIMessages.ImportProjectSetMainPage_The_specified_file_does_not_exist_4, ERROR); >+ // Check URL selection >+ if (urlText.getText().trim().equals("")) { //$NON-NLS-1$ > setPageComplete(false); >+ setMessage(TeamUIMessages.ImportProjectSetMainPage_Inform_file_URL, ERROR); > return; >- } else if (f.isDirectory()) { >- setMessage(TeamUIMessages.ImportProjectSetMainPage_You_have_specified_a_folder_5, ERROR); >+ } >+ try { >+ url = new URL(urlText.getText().trim()); >+ } catch (MalformedURLException e) { > setPageComplete(false); >+ setMessage(TeamUIMessages.ImportProjectSetMainPage_URL_is_not_valid, ERROR); > return; >- } >+ } > } > > //If add to working set checkbox selected and the user has not selected >@@ -225,6 +283,13 @@ > public String getFileName() { > return file; > } >+ >+ public InputStream getInputStream() throws IOException { >+ if (fileSelected) { >+ return new FileInputStream(file); >+ } >+ return url.openStream(); >+ } > > public void setVisible(boolean visible) { > super.setVisible(visible); >@@ -240,4 +305,5 @@ > if (!createWorkingSet) return null; > return workingSetName; > } >+ > } >Index: src/org/eclipse/team/internal/ui/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties,v >retrieving revision 1.213 >diff -u -r1.213 messages.properties >--- src/org/eclipse/team/internal/ui/messages.properties 21 Dec 2006 17:38:20 -0000 1.213 >+++ src/org/eclipse/team/internal/ui/messages.properties 26 Dec 2006 00:05:29 -0000 >@@ -98,6 +98,8 @@ > ImportProjectSetMainPage_createWorkingSetLabel=&Create a working set containing the imported projects > ImportProjectSetMainPage_workingSetLabel=&Working Set Name: > ImportProjectSetMainPage_AddToWorkingSet=&Add the imported team project set to a working set >+ImportProjectSetMainPage_Inform_file_URL=Inform the .psf file URL >+ImportProjectSetMainPage_URL_is_not_valid=The URL is not valid > > ProjectSetContentHandler_Element_provider_must_be_contained_in_element_psf_4=Element provider must be contained in element psf > ProjectSetContentHandler_Element_project_must_be_contained_in_element_provider_7=Element project must be contained in element provider >@@ -125,6 +127,7 @@ > ImportProjectSetMainPage_allFiles=All Files (*.*) > ImportProjectSetAction_0=An error occurred importing this project set. > ImportProjectSetMainPage_Project_Set_Files_2=Team Project Set Files (*.psf) >+ImportProjectSetMainPage_Project_Set_File_URL=&URL: > ExportProjectSetMainPage__File_name__1=&File name: > ExportProjectSetMainPage_WorkspaceButton=W&orkspace > ExportProjectSetMainPage_ExportWorkingSets=Export working sets >Index: src/org/eclipse/team/internal/ui/TeamUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java,v >retrieving revision 1.51 >diff -u -r1.51 TeamUIMessages.java >--- src/org/eclipse/team/internal/ui/TeamUIMessages.java 21 Dec 2006 17:38:09 -0000 1.51 >+++ src/org/eclipse/team/internal/ui/TeamUIMessages.java 26 Dec 2006 00:05:28 -0000 >@@ -99,6 +99,12 @@ > > public static String ImportProjectSetMainPage_Browse; > >+ public static String ImportProjectSetMainPage_Inform_file_URL; >+ >+ public static String ImportProjectSetMainPage_Project_Set_File_URL; >+ >+ public static String ImportProjectSetMainPage_URL_is_not_valid; >+ > public static String information; > > public static String ConfigureProjectAction_configureProject; >Index: src/org/eclipse/team/internal/ui/ProjectSetImporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java,v >retrieving revision 1.4 >diff -u -r1.4 ProjectSetImporter.java >--- src/org/eclipse/team/internal/ui/ProjectSetImporter.java 12 Jul 2006 19:46:52 -0000 1.4 >+++ src/org/eclipse/team/internal/ui/ProjectSetImporter.java 26 Dec 2006 00:05:28 -0000 >@@ -25,9 +25,23 @@ > public class ProjectSetImporter { > > public static IProject[] importProjectSet(String filename, Shell shell, IProgressMonitor monitor) throws InvocationTargetException { >+ try { >+ return importProjectSet(new FileInputStream(filename), filename, shell, monitor); >+ } catch (FileNotFoundException e) { >+ throw new InvocationTargetException(e); >+ } >+ } >+ >+ public static IProject[] importProjectSet(InputStream is, Shell shell, IProgressMonitor monitor) >+ throws InvocationTargetException { >+ return importProjectSet(is, null, shell, monitor); >+ } >+ >+ private static IProject[] importProjectSet(InputStream is, String filename, Shell shell, >+ IProgressMonitor monitor) throws InvocationTargetException { > InputStreamReader reader = null; > try { >- reader = new InputStreamReader(new FileInputStream(filename), "UTF-8"); //$NON-NLS-1$ >+ reader = new InputStreamReader(is, "UTF-8"); //$NON-NLS-1$ > > XMLMemento xmlMemento = XMLMemento.createReadRoot(reader); > String version = xmlMemento.getString("version"); //$NON-NLS-1$
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 162608
:
56177
|
56178
|
179256
|
179298
|
179300
|
179444
|
179445