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 204531 Details for
Bug 305172
[common navigator] Project Explorer not fully updating with jar classpath container changes.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch for R3_6_maintenance
bug305172_36x.patch (text/plain), 11.29 KB, created by
Jay Arthanareeswaran
on 2011-10-04 13:18:35 EDT
(
hide
)
Description:
Patch for R3_6_maintenance
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2011-10-04 13:18:35 EDT
Size:
11.29 KB
patch
obsolete
>From d9d84327b12166a3941a125acffce39d4746ab47 Mon Sep 17 00:00:00 2001 >From: Jayaprakash Arthanareeswaran <jarthana@in.ibm.com> >Date: Tue, 4 Oct 2011 22:34:51 +0530 >Subject: [PATCH] R3_6_maintenance - Fix for 305172: [common navigator] > Project Explorer not fully updating with jar classpath > container changes. > >--- > .../core/tests/model/JavaElementDeltaTests.java | 23 +++++- > .../eclipse/jdt/internal/core/DeltaProcessor.java | 95 +++++++++++++++---- > .../eclipse/jdt/internal/core/util/Messages.java | 3 +- > .../jdt/internal/core/util/messages.properties | 3 +- > 4 files changed, 101 insertions(+), 23 deletions(-) > >diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java >index 2531b96..5d6e1ce 100644 >--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java >+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaElementDeltaTests.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -3030,5 +3030,26 @@ public void testWorkingCopyCommit() throws CoreException { > deleteProject("P"); > } > } >+public void testChangeExternalJar() throws CoreException { >+ String jarName = "externalLib.jar"; >+ try { >+ createExternalFile(jarName, ""); >+ IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath(jarName)}, ""); >+ refreshExternalArchives(p); >+ >+ startDeltas(); >+ touch(getExternalFile(jarName)); >+ refresh(p); >+ assertDeltas( >+ "Unexpected delta", >+ "P[*]: {CHILDREN}\n" + >+ " "+ getExternalPath() + "externalLib.jar[*]: {CONTENT | ARCHIVE CONTENT CHANGED}" >+ ); >+ } finally { >+ stopDeltas(); >+ deleteExternalResource(jarName); >+ deleteProject("P"); >+ } >+} > } > >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java >index d92c42c..c2d1bbb 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -25,6 +25,7 @@ import org.eclipse.core.resources.IWorkspace; > import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.IWorkspaceRunnable; > import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.resources.WorkspaceJob; > import org.eclipse.core.runtime.*; > import org.eclipse.jdt.core.*; > import org.eclipse.jdt.core.compiler.CharOperation; >@@ -35,6 +36,7 @@ import org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy; > import org.eclipse.jdt.internal.core.search.AbstractSearchScope; > import org.eclipse.jdt.internal.core.search.JavaWorkspaceScope; > import org.eclipse.jdt.internal.core.search.indexing.IndexManager; >+import org.eclipse.jdt.internal.core.util.Messages; > import org.eclipse.jdt.internal.core.util.Util; > > /** >@@ -686,11 +688,15 @@ public class DeltaProcessor { > this.currentElement = (Openable)element; > return this.currentElement; > } >+ >+ public void checkExternalArchiveChanges(IJavaElement[] elementsScope, IProgressMonitor monitor) throws JavaModelException { >+ checkExternalArchiveChanges(elementsScope, false, monitor); >+ } > /* > * Check all external archive (referenced by given roots, projects or model) status and issue a corresponding root delta. > * Also triggers index updates > */ >- public void checkExternalArchiveChanges(IJavaElement[] elementsScope, IProgressMonitor monitor) throws JavaModelException { >+ private void checkExternalArchiveChanges(IJavaElement[] elementsScope, boolean asynchronous, IProgressMonitor monitor) throws JavaModelException { > if (monitor != null && monitor.isCanceled()) > throw new OperationCanceledException(); > try { >@@ -724,26 +730,51 @@ public class DeltaProcessor { > JavaProject javaProject = (JavaProject)delta.getElement(); > projectsToTouch[i] = javaProject.getProject(); > } >- >- // touch the projects to force them to be recompiled while taking the workspace lock >- // so that there is no concurrency with the Java builder >- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96575 >- IWorkspaceRunnable runnable = new IWorkspaceRunnable() { >- public void run(IProgressMonitor progressMonitor) throws CoreException { >- for (int i = 0; i < length; i++) { >- IProject project = projectsToTouch[i]; >- >- // touch to force a build of this project >- if (JavaBuilder.DEBUG) >- System.out.println("Touching project " + project.getName() + " due to external jar file change"); //$NON-NLS-1$ //$NON-NLS-2$ >- project.touch(progressMonitor); >+ if (projectsToTouch.length > 0) { >+ if (asynchronous){ >+ WorkspaceJob touchJob = new WorkspaceJob(Messages.updating_external_archives_jobName) { >+ >+ public IStatus runInWorkspace(IProgressMonitor progressMonitor) throws CoreException { >+ try { >+ if (progressMonitor != null) >+ progressMonitor.beginTask("", projectsToTouch.length); //$NON-NLS-1$ >+ touchProjects(projectsToTouch, progressMonitor); >+ } >+ finally { >+ if (progressMonitor != null) >+ progressMonitor.done(); >+ } >+ return Status.OK_STATUS; >+ } >+ >+ public boolean belongsTo(Object family) { >+ return ResourcesPlugin.FAMILY_MANUAL_REFRESH == family; >+ } >+ }; >+ touchJob.schedule(); >+ } >+ else { >+ // touch the projects to force them to be recompiled while taking the workspace lock >+ // so that there is no concurrency with the Java builder >+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96575 >+ IWorkspaceRunnable runnable = new IWorkspaceRunnable() { >+ public void run(IProgressMonitor progressMonitor) throws CoreException { >+ for (int i = 0; i < projectsToTouch.length; i++) { >+ IProject project = projectsToTouch[i]; >+ >+ // touch to force a build of this project >+ if (JavaBuilder.DEBUG) >+ System.out.println("Touching project " + project.getName() + " due to external jar file change"); //$NON-NLS-1$ //$NON-NLS-2$ >+ project.touch(progressMonitor); >+ } >+ } >+ }; >+ try { >+ ResourcesPlugin.getWorkspace().run(runnable, monitor); >+ } catch (CoreException e) { >+ throw new JavaModelException(e); > } > } >- }; >- try { >- ResourcesPlugin.getWorkspace().run(runnable, monitor); >- } catch (CoreException e) { >- throw new JavaModelException(e); > } > > if (this.currentDelta != null) { // if delta has not been fired while creating markers >@@ -758,6 +789,19 @@ public class DeltaProcessor { > if (monitor != null) monitor.done(); > } > } >+ >+ protected void touchProjects(final IProject[] projectsToTouch, IProgressMonitor progressMonitor) >+ throws CoreException { >+ for (int i = 0; i < projectsToTouch.length; i++) { >+ IProgressMonitor monitor = progressMonitor == null ? null: new SubProgressMonitor(progressMonitor, 1); >+ IProject project = projectsToTouch[i]; >+ // touch to force a build of this project >+ if (JavaBuilder.DEBUG) >+ System.out.println("Touching project " + project.getName() + " due to external jar file change"); //$NON-NLS-1$ //$NON-NLS-2$ >+ project.touch(monitor); >+ } >+ } >+ > /* > * Check if external archives have changed for the given elements and create the corresponding deltas. > * Returns whether at least one delta was created. >@@ -1890,6 +1934,17 @@ public class DeltaProcessor { > //https://bugs.eclipse.org/bugs/show_bug.cgi?id=302295 > // Refresh all project references together in a single job > JavaModelManager.getExternalManager().refreshReferences(projects, null); >+ >+ IJavaProject[] javaElements = new IJavaProject[projects.length]; >+ for (int index = 0; index < projects.length; index++) { >+ javaElements[index] = JavaCore.create(projects[index]); >+ } >+ try { >+ checkExternalArchiveChanges(javaElements, true, null); >+ } catch (JavaModelException e) { >+ if (!e.isDoesNotExist()) >+ Util.log(e, "Exception while updating external archives"); //$NON-NLS-1$ >+ } > return; > > case IResourceChangeEvent.POST_CHANGE : >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java >index fa27ea7..a214df4 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -186,6 +186,7 @@ public final class Messages extends NLS { > public static String cache_invalidLoadFactor; > public static String savedState_jobName; > public static String refreshing_external_folders; >+ public static String updating_external_archives_jobName; > public static String convention_unit_nullName; > public static String convention_unit_notJavaName; > public static String convention_classFile_nullName; >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties >index 78a1922..4ae7156 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties >@@ -1,5 +1,5 @@ > ############################################################################### >-# Copyright (c) 2000, 2010 IBM Corporation and others. >+# Copyright (c) 2000, 2011 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 >@@ -185,6 +185,7 @@ path_mustBeAbsolute = Path must be absolute > cache_invalidLoadFactor = Incorrect load factor > savedState_jobName = Processing Java changes since last activation > refreshing_external_folders = Refreshing external folders >+updating_external_archives_jobName = Refreshing external archives > > ## java model initialization > javamodel_initialization = Initializing Java tooling >-- >1.7.6.msysgit.0 >
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 305172
:
161479
|
164062
|
180488
|
180576
|
180858
|
183740
|
204444
|
204488
| 204531