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 66833 Details for
Bug 185452
[search] for all packages seems hung
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
185452.patch (text/plain), 6.78 KB, created by
Martin Aeschlimann
on 2007-05-11 06:24:34 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Martin Aeschlimann
Created:
2007-05-11 06:24:34 EDT
Size:
6.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/dialogs/PackageSelectionDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/dialogs/PackageSelectionDialog.java,v >retrieving revision 1.11 >diff -u -r1.11 PackageSelectionDialog.java >--- ui/org/eclipse/jdt/internal/ui/dialogs/PackageSelectionDialog.java 11 Jan 2007 10:32:32 -0000 1.11 >+++ ui/org/eclipse/jdt/internal/ui/dialogs/PackageSelectionDialog.java 11 May 2007 10:13:24 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 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 >@@ -16,10 +16,14 @@ > > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.core.runtime.SubProgressMonitor; > > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IPackageFragment; > import org.eclipse.jdt.core.IPackageFragmentRoot; >+import org.eclipse.jdt.core.JavaModelException; > import org.eclipse.jdt.core.search.IJavaSearchConstants; > import org.eclipse.jdt.core.search.IJavaSearchScope; > import org.eclipse.jdt.core.search.SearchEngine; >@@ -102,26 +106,24 @@ > final ArrayList packageList= new ArrayList(); > > IRunnableWithProgress runnable= new IRunnableWithProgress() { >- public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ if (monitor == null) { >+ monitor= new NullProgressMonitor(); >+ } >+ boolean hideEmpty= (fFlags & F_HIDE_EMPTY_INNER) != 0; >+ monitor.beginTask(JavaUIMessages.PackageSelectionDialog_progress_search, hideEmpty ? 2 : 1); > try { > SearchRequestor requestor= new SearchRequestor() { > private HashSet fSet= new HashSet(); > private final boolean fAddDefault= (fFlags & F_HIDE_DEFAULT_PACKAGE) == 0; > private final boolean fDuplicates= (fFlags & F_REMOVE_DUPLICATES) == 0; > private final boolean fIncludeParents= (fFlags & F_SHOW_PARENTS) != 0; >- private final boolean fHideEmptyInner= (fFlags & F_HIDE_EMPTY_INNER) != 0; > > public void acceptSearchMatch(SearchMatch match) throws CoreException { > IJavaElement enclosingElement= (IJavaElement) match.getElement(); > String name= enclosingElement.getElementName(); > if (fAddDefault || name.length() > 0) { > if (fDuplicates || fSet.add(name)) { >- if (fHideEmptyInner) { >- IPackageFragment pkg= (IPackageFragment) enclosingElement; >- if (pkg.getCompilationUnits().length == 0 && pkg.getClassFiles().length == 0) { >- return; >- } >- } > packageList.add(enclosingElement); > if (fIncludeParents) { > addParentPackages(enclosingElement, name); >@@ -145,12 +147,42 @@ > SearchPattern pattern= SearchPattern.createPattern("*", //$NON-NLS-1$ > IJavaSearchConstants.PACKAGE, IJavaSearchConstants.DECLARATIONS, > SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE); >- new SearchEngine().search(pattern, SearchUtils.getDefaultSearchParticipants(), fScope, requestor, monitor); >+ new SearchEngine().search(pattern, SearchUtils.getDefaultSearchParticipants(), fScope, requestor, new SubProgressMonitor(monitor, 1)); >+ >+ if (monitor.isCanceled()) { >+ throw new InterruptedException(); >+ } >+ >+ if (hideEmpty) { >+ removeEmptyPackages(new SubProgressMonitor(monitor, 1)); >+ } > } catch (CoreException e) { > throw new InvocationTargetException(e); >- } >- if (monitor.isCanceled()) { >+ } catch (OperationCanceledException e) { > throw new InterruptedException(); >+ } finally { >+ monitor.done(); >+ } >+ } >+ >+ private void removeEmptyPackages(IProgressMonitor monitor) throws JavaModelException, InterruptedException { >+ monitor.beginTask(JavaUIMessages.PackageSelectionDialog_progress_findEmpty, packageList.size()); >+ try { >+ ArrayList res= new ArrayList(packageList.size()); >+ for (int i= 0; i < packageList.size(); i++) { >+ IPackageFragment pkg= (IPackageFragment) packageList.get(i); >+ if (pkg.hasChildren() || !pkg.hasSubpackages()) { >+ res.add(pkg); >+ } >+ monitor.worked(1); >+ if (monitor.isCanceled()) { >+ throw new InterruptedException(); >+ } >+ } >+ packageList.clear(); >+ packageList.addAll(res); >+ } finally{ >+ monitor.done(); > } > } > }; >Index: ui/org/eclipse/jdt/internal/ui/JavaUIMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaUIMessages.properties,v >retrieving revision 1.270 >diff -u -r1.270 JavaUIMessages.properties >--- ui/org/eclipse/jdt/internal/ui/JavaUIMessages.properties 9 May 2007 21:06:03 -0000 1.270 >+++ ui/org/eclipse/jdt/internal/ui/JavaUIMessages.properties 11 May 2007 10:13:24 -0000 >@@ -55,7 +55,9 @@ > PackageSelectionDialog_error3Message=Unexpected exception. See log for details. > PackageSelectionDialog_error_title=Error > PackageSelectionDialog_nopackages_title=Package Selection >+PackageSelectionDialog_progress_search=Searching for all packages in workspace > PackageSelectionDialog_nopackages_message=No packages available. >+PackageSelectionDialog_progress_findEmpty=Find empty packages > > BuildPathDialog_title= Java Build Path for {0} > >Index: ui/org/eclipse/jdt/internal/ui/JavaUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaUIMessages.java,v >retrieving revision 1.39 >diff -u -r1.39 JavaUIMessages.java >--- ui/org/eclipse/jdt/internal/ui/JavaUIMessages.java 9 May 2007 21:05:11 -0000 1.39 >+++ ui/org/eclipse/jdt/internal/ui/JavaUIMessages.java 11 May 2007 10:13:24 -0000 >@@ -38,6 +38,8 @@ > public static String JavaUI_defaultDialogMessage; > > public static String MultiElementListSelectionDialog_pageInfoMessage; >+ public static String PackageSelectionDialog_progress_findEmpty; >+ public static String PackageSelectionDialog_progress_search; > > public static String TypeSelectionDialog_errorMessage; > public static String TypeSelectionDialog_dialogMessage;
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 185452
:
66522
| 66833