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 162389 Details for
Bug 296456
[Import/Export] File -> Import filesystem w/cyclical symbolic folder links causes OOME
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 v01
OOME Import 01.txt (text/plain), 7.41 KB, created by
Prakash Rangaraj
on 2010-03-18 07:16:02 EDT
(
hide
)
Description:
Patch v01
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2010-03-18 07:16:02 EDT
Size:
7.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.ide >Index: src/org/eclipse/ui/internal/ide/filesystem/FileSystemStructureProvider.java >=================================================================== >RCS file: src/org/eclipse/ui/internal/ide/filesystem/FileSystemStructureProvider.java >diff -N src/org/eclipse/ui/internal/ide/filesystem/FileSystemStructureProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/ui/internal/ide/filesystem/FileSystemStructureProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,122 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2010 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 >+ *******************************************************************************/ >+package org.eclipse.ui.internal.ide.filesystem; >+ >+import java.io.File; >+import java.io.FileInputStream; >+import java.io.FileNotFoundException; >+import java.io.IOException; >+import java.io.InputStream; >+import java.util.ArrayList; >+import java.util.HashSet; >+import java.util.List; >+import java.util.Set; >+ >+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; >+import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider; >+ >+/** >+ * This class provides information regarding the structure and >+ * content of specified file system File objects. >+ * >+ * class copied from org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider as its singleton >+ */ >+public class FileSystemStructureProvider implements IImportStructureProvider { >+ >+ private Set visitedDirs; >+ >+ /* (non-Javadoc) >+ * Method declared on IImportStructureProvider >+ */ >+ public List getChildren(Object element) { >+ File folder = (File) element; >+ String[] children = folder.list(); >+ int childrenLength = children == null ? 0 : children.length; >+ List result = new ArrayList(childrenLength); >+ >+ for (int i = 0; i < childrenLength; i++) { >+ File file = new File(folder, children[i]); >+ if(isRecursiveLink(file)) >+ continue; >+ result.add(file); >+ } >+ >+ return result; >+ } >+ >+ private void initVisitedDirs(){ >+ if(visitedDirs == null){ >+ visitedDirs = new HashSet(); >+ } >+ } >+ >+ private boolean isRecursiveLink(File childFile) { >+ >+ if (childFile.isDirectory()) { >+ try { >+ String canonicalPath = childFile.getCanonicalPath(); >+ initVisitedDirs(); >+ return !visitedDirs.add(canonicalPath); >+ } catch (IOException e) { >+ IDEWorkbenchPlugin.log(e.getMessage(), e); >+ } >+ } >+ return false; >+ } >+ >+ /* (non-Javadoc) >+ * Method declared on IImportStructureProvider >+ */ >+ public InputStream getContents(Object element) { >+ try { >+ return new FileInputStream((File) element); >+ } catch (FileNotFoundException e) { >+ IDEWorkbenchPlugin.log(e.getLocalizedMessage(), e); >+ return null; >+ } >+ } >+ >+ /* (non-Javadoc) >+ * Method declared on IImportStructureProvider >+ */ >+ public String getFullPath(Object element) { >+ return ((File) element).getPath(); >+ } >+ >+ /* (non-Javadoc) >+ * Method declared on IImportStructureProvider >+ */ >+ public String getLabel(Object element) { >+ >+ //Get the name - if it is empty then return the path as it is a file root >+ File file = (File) element; >+ String name = file.getName(); >+ if (name.length() == 0) { >+ return file.getPath(); >+ } >+ return name; >+ } >+ >+ /* (non-Javadoc) >+ * Method declared on IImportStructureProvider >+ */ >+ public boolean isFolder(Object element) { >+ return ((File) element).isDirectory(); >+ } >+ >+ /** >+ * Clears the visited dir information >+ */ >+ public void clearVisitedDirs() { >+ if(visitedDirs!=null) >+ visitedDirs.clear(); >+ } >+} >Index: src/org/eclipse/ui/internal/wizards/datatransfer/WizardFileSystemResourceImportPage1.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardFileSystemResourceImportPage1.java,v >retrieving revision 1.15 >diff -u -r1.15 WizardFileSystemResourceImportPage1.java >--- src/org/eclipse/ui/internal/wizards/datatransfer/WizardFileSystemResourceImportPage1.java 22 Jul 2009 10:59:33 -0000 1.15 >+++ src/org/eclipse/ui/internal/wizards/datatransfer/WizardFileSystemResourceImportPage1.java 18 Mar 2010 11:12:40 -0000 >@@ -57,9 +57,9 @@ > import org.eclipse.ui.dialogs.FileSystemElement; > import org.eclipse.ui.dialogs.WizardResourceImportPage; > import org.eclipse.ui.internal.ide.dialogs.IElementFilter; >+import org.eclipse.ui.internal.ide.filesystem.FileSystemStructureProvider; > import org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog; > import org.eclipse.ui.model.WorkbenchContentProvider; >-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; > import org.eclipse.ui.wizards.datatransfer.IImportStructureProvider; > import org.eclipse.ui.wizards.datatransfer.ImportOperation; > >@@ -87,6 +87,8 @@ > > //A boolean to indicate if the user has typed anything > private boolean entryChanged = false; >+ >+ private FileSystemStructureProvider fileSystemStructureProvider = new FileSystemStructureProvider(); > > // dialog store id constants > private final static String STORE_SOURCE_NAMES_ID = "WizardFileSystemResourceImportPage1.STORE_SOURCE_NAMES_ID";//$NON-NLS-1$ >@@ -354,6 +356,8 @@ > setSourceName(sourceNameField.getText()); > //Update enablements when this is selected > updateWidgetEnablements(); >+ fileSystemStructureProvider.clearVisitedDirs(); >+ > } > > /** >@@ -482,7 +486,7 @@ > if (o instanceof MinimizedFileSystemElement) { > MinimizedFileSystemElement element = (MinimizedFileSystemElement) o; > return element.getFiles( >- FileSystemStructureProvider.INSTANCE).getChildren( >+ fileSystemStructureProvider).getChildren( > element); > } > return new Object[0]; >@@ -503,7 +507,7 @@ > } > > return selectFiles(sourceDirectory, >- FileSystemStructureProvider.INSTANCE); >+ fileSystemStructureProvider); > } > > /** >@@ -516,7 +520,7 @@ > if (o instanceof MinimizedFileSystemElement) { > MinimizedFileSystemElement element = (MinimizedFileSystemElement) o; > return element.getFolders( >- FileSystemStructureProvider.INSTANCE).getChildren( >+ fileSystemStructureProvider).getChildren( > element); > } > return new Object[0]; >@@ -648,7 +652,7 @@ > */ > protected boolean importResources(List fileSystemObjects) { > ImportOperation operation = new ImportOperation(getContainerFullPath(), >- getSourceDirectory(), FileSystemStructureProvider.INSTANCE, >+ getSourceDirectory(), fileSystemStructureProvider, > this, fileSystemObjects); > > operation.setContext(getShell());
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 296456
: 162389