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 64151 Details for
Bug 150009
[build path] allow selecting a working set for new Java project
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]
fix 12
fix_150009.txt (text/plain), 11.47 KB, created by
Benno Baumgartner
on 2007-04-18 05:38:45 EDT
(
hide
)
Description:
fix 12
Filename:
MIME Type:
Creator:
Benno Baumgartner
Created:
2007-04-18 05:38:45 EDT
Size:
11.47 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.ui >Index: ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.properties,v >retrieving revision 1.56 >diff -u -r1.56 PackagesMessages.properties >--- ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.properties 23 Nov 2006 09:23:46 -0000 1.56 >+++ ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.properties 18 Apr 2007 09:37:44 -0000 >@@ -85,6 +85,8 @@ > > PackageExplorerPart_workspace=Workspace > PackageExplorerPart_workingSetModel=Working Sets >+PackageExplorerPart_notFoundSepcific=Cannot reveal ''{0}''. Do you want to deselect the current working set ''{1}''? >+PackageExplorerPart_removeFiltersSpecific=Cannot reveal ''{0}''. Do you want to remove some filters to reveal the element? > > SelectionTransferDropAdapter_error_title=Drag and drop > SelectionTransferDropAdapter_error_message=Unexpected exception. See log for details >Index: ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.java,v >retrieving revision 1.10 >diff -u -r1.10 PackagesMessages.java >--- ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.java 23 Nov 2006 09:23:44 -0000 1.10 >+++ ui/org/eclipse/jdt/internal/ui/packageview/PackagesMessages.java 18 Apr 2007 09:37:44 -0000 >@@ -57,6 +57,8 @@ > public static String OpenResource_error_messageArgs; > public static String OpenResource_error_messageProblems; > public static String OpenResource_error_title; >+ public static String PackageExplorerPart_notFoundSepcific; >+ public static String PackageExplorerPart_removeFiltersSpecific; > public static String Sorter_expectPackage; > public static String ShowLibraries_hideReferencedLibs; > public static String ShowLibraries_showReferencedLibs; >Index: ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java,v >retrieving revision 1.294 >diff -u -r1.294 PackageExplorerPart.java >--- ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java 14 Mar 2007 14:33:14 -0000 1.294 >+++ ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java 18 Apr 2007 09:37:44 -0000 >@@ -1407,7 +1407,13 @@ > if (workingSetGroup != null) { > IWorkingSet workingSet= workingSetGroup.getWorkingSet(); > if (workingSetGroup.isFiltered(getVisibleParent(element), element)) { >- String message= Messages.format(PackagesMessages.PackageExplorer_notFound, workingSet.getLabel()); >+ String message; >+ if (element instanceof IJavaElement) { >+ String elementLabel= JavaElementLabels.getElementLabel((IJavaElement)element, JavaElementLabels.ALL_DEFAULT); >+ message= Messages.format(PackagesMessages.PackageExplorerPart_notFoundSepcific, new String[] {elementLabel, workingSet.getLabel()}); >+ } else { >+ message= Messages.format(PackagesMessages.PackageExplorer_notFound, workingSet.getLabel()); >+ } > if (MessageDialog.openQuestion(getSite().getShell(), PackagesMessages.PackageExplorer_filteredDialog_title, message)) { > workingSetGroup.setWorkingSet(null, true); > if (revealElementOrParent(element)) >@@ -1422,7 +1428,13 @@ > String[] currentFilters= filterGroup.internalGetEnabledFilterIds(); > String[] newFilters= filterGroup.removeFiltersFor(getVisibleParent(element), element, getTreeViewer().getContentProvider()); > if (currentFilters.length > newFilters.length) { >- String message= PackagesMessages.PackageExplorer_removeFilters; >+ String message; >+ if (element instanceof IJavaElement) { >+ String elementLabel= JavaElementLabels.getElementLabel((IJavaElement)element, JavaElementLabels.ALL_DEFAULT); >+ message= Messages.format(PackagesMessages.PackageExplorerPart_removeFiltersSpecific, elementLabel); >+ } else { >+ message= PackagesMessages.PackageExplorer_removeFilters; >+ } > if (MessageDialog.openQuestion(getSite().getShell(), PackagesMessages.PackageExplorer_filteredDialog_title, message)) { > filterGroup.setFilters(newFilters); > if (revealElementOrParent(element)) >@@ -1543,6 +1555,20 @@ > } > }); > } >+ >+ >+ /** >+ * @return the selected working set to filter if in root mode {@link ViewActionGroup#SHOW_PROJECTS} >+ */ >+ public IWorkingSet getFilterWorkingSet() { >+ if (!showProjects()) >+ return null; >+ >+ if (fActionSet == null) >+ return null; >+ >+ return fActionSet.getWorkingSetActionGroup().getFilterGroup().getWorkingSet(); >+ } > > public WorkingSetModel getWorkingSetModel() { > return fWorkingSetModel; >Index: ui/org/eclipse/jdt/internal/ui/wizards/JavaProjectWizard.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/wizards/JavaProjectWizard.java,v >retrieving revision 1.21 >diff -u -r1.21 JavaProjectWizard.java >--- ui/org/eclipse/jdt/internal/ui/wizards/JavaProjectWizard.java 17 Apr 2007 13:43:55 -0000 1.21 >+++ ui/org/eclipse/jdt/internal/ui/wizards/JavaProjectWizard.java 18 Apr 2007 09:37:44 -0000 >@@ -11,9 +11,6 @@ > package org.eclipse.jdt.internal.ui.wizards; > > import java.lang.reflect.InvocationTargetException; >-import java.util.ArrayList; >-import java.util.Arrays; >-import java.util.HashSet; > import java.util.List; > > import org.eclipse.core.runtime.CoreException; >@@ -28,6 +25,7 @@ > import org.eclipse.jface.viewers.ITreeSelection; > import org.eclipse.jface.viewers.TreePath; > >+import org.eclipse.ui.IWorkbenchPage; > import org.eclipse.ui.IWorkingSet; > import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; > >@@ -38,8 +36,8 @@ > import org.eclipse.jdt.internal.ui.JavaPluginImages; > import org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart; > import org.eclipse.jdt.internal.ui.util.ExceptionHandler; >-import org.eclipse.jdt.internal.ui.workingsets.OthersWorkingSetUpdater; >-import org.eclipse.jdt.internal.ui.workingsets.WorkingSetModel; >+import org.eclipse.jdt.internal.ui.workingsets.JavaWorkingSetUpdater; >+import org.eclipse.jdt.internal.ui.workingsets.ViewActionGroup; > > public class JavaProjectWizard extends NewElementWizard implements IExecutableExtension { > >@@ -79,38 +77,25 @@ > public boolean performFinish() { > boolean res= super.performFinish(); > if (res) { >+ IJavaElement newElement= getCreatedElement(); >+ > IWorkingSet[] workingSets= fFirstPage.getWorkingSets(); > for (int i= 0; i < workingSets.length; i++) { > IWorkingSet workingSet= workingSets[i]; > IAdaptable[] elements= workingSet.getElements(); > IAdaptable[] newElements= new IAdaptable[elements.length + 1]; > System.arraycopy(elements, 0, newElements, 0, elements.length); >- IJavaElement element= getCreatedElement(); >- newElements[newElements.length - 1]= element; >- workingSet.setElements(newElements); >- } >- >- PackageExplorerPart explorerPart= PackageExplorerPart.getFromActivePerspective(); >- if (explorerPart != null && workingSets.length > 0) { >- WorkingSetModel workingSetModel= explorerPart.getWorkingSetModel(); >- HashSet active= new HashSet(Arrays.asList(workingSetModel.getActiveWorkingSets())); >- >- boolean hasChange= false; >- for (int j= 0; j < workingSets.length; j++) { >- IWorkingSet workingSet= workingSets[j]; >- if (!active.contains(workingSet)) { >- active.add(workingSet); >- hasChange= true; >- } >- } >- >- if (hasChange) { >- workingSetModel.setActiveWorkingSets((IWorkingSet[])active.toArray(new IWorkingSet[active.size()])); >- } >+ newElements[newElements.length - 1]= newElement; >+ workingSet.setElements(workingSet.adaptElements(newElements)); > } > > BasicNewProjectResourceWizard.updatePerspective(fConfigElement); >- selectAndReveal(fSecondPage.getJavaProject().getProject()); >+ PackageExplorerPart activePackageExplorer= getActivePackageExplorer(); >+ if (activePackageExplorer == null) { >+ selectAndReveal(fSecondPage.getJavaProject().getProject()); >+ } else { >+ activePackageExplorer.tryToReveal(newElement); >+ } > } > return res; > } >@@ -167,47 +152,61 @@ > if (isValidWorkingSet((IWorkingSet)candidate)) > return new IWorkingSet[] {(IWorkingSet)candidate}; > } else { >- PackageExplorerPart explorerPart= PackageExplorerPart.getFromActivePerspective(); >+ PackageExplorerPart explorerPart= getActivePackageExplorer(); > if (explorerPart == null) > return null; > >- WorkingSetModel workingSetModel= explorerPart.getWorkingSetModel(); >- if (workingSetModel == null) >- return null; >- >- IWorkingSet[] activeWorkingSets= workingSetModel.getActiveWorkingSets(); >- >- ArrayList result= new ArrayList(); >- for (int i= 0; i < activeWorkingSets.length; i++) { >- IWorkingSet workingSet= activeWorkingSets[i]; >- if (contains(workingSet, candidate)) { >- if (isValidWorkingSet(workingSet)) >- result.add(workingSet); >- } >+ if (explorerPart.getRootMode() == ViewActionGroup.SHOW_PROJECTS) { >+ //Get active filter >+ IWorkingSet filterWorkingSet= explorerPart.getFilterWorkingSet(); >+ if (filterWorkingSet == null) >+ return null; >+ >+ if (!isValidWorkingSet(filterWorkingSet)) >+ return null; >+ >+ return new IWorkingSet[] {filterWorkingSet}; >+ } else if (explorerPart.getRootMode() == ViewActionGroup.SHOW_WORKING_SETS) { >+ //If we have been gone into a working set return the working set >+ Object input= explorerPart.getViewPartInput(); >+ if (!(input instanceof IWorkingSet)) >+ return null; >+ >+ IWorkingSet workingSet= (IWorkingSet)input; >+ if (!isValidWorkingSet(workingSet)) >+ return null; >+ >+ return new IWorkingSet[] {workingSet}; > } >- if (result.size() == 0) >- return null; >- >- return (IWorkingSet[])result.toArray(new IWorkingSet[result.size()]); > } > > return null; > } > >+ private PackageExplorerPart getActivePackageExplorer() { >+ PackageExplorerPart explorerPart= PackageExplorerPart.getFromActivePerspective(); >+ if (explorerPart == null) >+ return null; >+ >+ IWorkbenchPage activePage= explorerPart.getViewSite().getWorkbenchWindow().getActivePage(); >+ if (activePage == null) >+ return null; >+ >+ if (activePage.getActivePart() != explorerPart) >+ return null; >+ >+ return explorerPart; >+ } >+ > private boolean isValidWorkingSet(IWorkingSet workingSet) { >- if (OthersWorkingSetUpdater.ID.equals(workingSet.getId())) >+ String id= workingSet.getId(); >+ if (!JavaWorkingSetUpdater.ID.equals(id) && !"org.eclipse.ui.resourceWorkingSetPage".equals(id)) //$NON-NLS-1$ >+ return false; >+ >+ if (workingSet.isAggregateWorkingSet()) > return false; > > return true; > } >- >- private boolean contains(IWorkingSet workingSet, Object candidate) { >- IAdaptable[] elements= workingSet.getElements(); >- for (int i= 0; i < elements.length; i++) { >- if (candidate.equals(elements[i])) >- return true; >- } >- 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 150009
:
63899
|
64028
| 64151 |
64177