Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 248286 - Scopes are not properly initialized on workbench restart/project re-open
Summary: Scopes are not properly initialized on workbench restart/project re-open
Status: RESOLVED FIXED
Alias: None
Product: PTP
Classification: Tools
Component: RDT (show other bugs)
Version: 2.1M3   Edit
Hardware: All All
: P1 critical (vote)
Target Milestone: 2.1M4   Edit
Assignee: Vivian Kong CLA
QA Contact: Greg Watson CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-23 11:02 EDT by Chris Recoskie CLA
Modified: 2008-09-24 08:55 EDT (History)
1 user (show)

See Also:
recoskie: iplog+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Recoskie CLA 2008-09-23 11:02:55 EDT
When you open the project again, the subsystem reconnects and tries to set the project scope.  However, the project contents are not available yet, so it sends an empty scope.  As a result indexing operations don't work properly until you explicitly reopen the project.

We'll need to have a resource change listener that listens for projects opening and properly initializes the scope.  The initialization that happens on subsystem connect should be checking to make sure the projects are open and populated before sending the scope contents.
Comment 1 Vivian Kong CLA 2008-09-23 13:11:00 EDT
Also saw the following error:

org.eclipse.ptp.rdt.services.core.ProjectNotConfiguredException
	at org.eclipse.ptp.rdt.services.core.ServiceModelManager.getConf(ServiceModelManager.java:127)
	at org.eclipse.ptp.rdt.services.core.ServiceModelManager.getActiveConfiguration(ServiceModelManager.java:135)
	at org.eclipse.ptp.rdt.ui.subsystems.RemoteCIndexSubsystem.initializeScope(RemoteCIndexSubsystem.java:913)
	at org.eclipse.ptp.rdt.ui.subsystems.RemoteCIndexSubsystem.checkProject(RemoteCIndexSubsystem.java:904)
	at org.eclipse.ptp.rdt.ui.subsystems.ProjectChangeListener$1.visit(ProjectChangeListener.java:67)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:68)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:79)
	at org.eclipse.core.internal.events.ResourceDelta.accept(ResourceDelta.java:48)
	at org.eclipse.ptp.rdt.ui.subsystems.ProjectChangeListener.resourceChanged(ProjectChangeListener.java:46)
	at org.eclipse.core.internal.events.NotificationManager$2.run(NotificationManager.java:288)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:282)
	at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:148)
	at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:313)
	at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1022)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 2 Vivian Kong CLA 2008-09-23 15:38:54 EDT
Just realize my project service provider configuration are not set when I open this project up so this error trace is invalid.

(In reply to comment #1)
> Also saw the following error...
Comment 3 Vivian Kong CLA 2008-09-23 16:43:56 EDT
Chris do you see this error stack in the back end too?

java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:189)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
        at java.io.FilterInputStream.read(FilterInputStream.java:66)
        at org.eclipse.rse.internal.dstore.universal.miners.command.OutputHandler.readLines(OutputHandler.java:165)
        at org.eclipse.rse.internal.dstore.universal.miners.command.OutputHandler.handle(OutputHandler.java:88)
        at org.eclipse.dstore.core.model.Handler.finish(Handler.java:102)
        at org.eclipse.rse.internal.dstore.universal.miners.command.OutputHandler.handle(OutputHandler.java:106)
        at org.eclipse.dstore.core.model.Handler.run(Handler.java:135)
Comment 4 Chris Recoskie CLA 2008-09-23 16:46:34 EDT
(In reply to comment #3)
> Chris do you see this error stack in the back end too?
> java.io.IOException: Stream closed
>         at
> java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:145)


I've seen it before.  I'm not positive why it happens but I've wondered if it's due to Build Automatically being turned on.
Comment 5 Vivian Kong CLA 2008-09-23 17:19:39 EDT
I see that the list of project files is actually being passed to the dataStore command in the subsystem.  But when the command is run the files didn't get add to the scope...so I don't think the problem is at the subsystem.

How do you get the scope to generate properly in your workbench?  I haven't been able to do that.
Comment 6 Chris Recoskie CLA 2008-09-23 17:23:50 EDT
(In reply to comment #5)
> I see that the list of project files is actually being passed to the dataStore
> command in the subsystem.  But when the command is run the files didn't get add
> to the scope...so I don't think the problem is at the subsystem.
> How do you get the scope to generate properly in your workbench?  I haven't
> been able to do that.

Either create a new project, or reindex the project.
Comment 7 Vivian Kong CLA 2008-09-23 22:10:09 EDT
I think I might have found the problem.  The files in the project didn't get added to the dstore command because of "return" in a if clause.  It seems to work for me.  Patch is small so I'll just paste it here:

### Eclipse Workspace Patch 1.0
#P org.eclipse.ptp.rdt.ui
Index: src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem.java
===================================================================
RCS file: /cvsroot/tools/org.eclipse.ptp/rdt/org.eclipse.ptp.rdt.ui/src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem.java,v
retrieving revision 1.3
diff -u -r1.3 RemoteCIndexSubsystem.java
--- src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem.java	23 Sep 2008 19:58:39 -0000	1.3
+++ src/org/eclipse/ptp/rdt/ui/subsystems/RemoteCIndexSubsystem.java	24 Sep 2008 02:07:38 -0000
@@ -523,7 +523,6 @@
 		// if it's a translation unit, we can just add it
 		if(element instanceof ITranslationUnit) {
 			filePath = convertURIToRemotePath(element.getLocationURI());
-			return;
 		}
 		
 		else {
Comment 8 Chris Recoskie CLA 2008-09-24 08:54:38 EDT
Awesome.  Works great.  Applied to HEAD.  Thanks