Bug 208085 - [LinkedResources] Prompt when importing project with undefined resource link location
Summary: [LinkedResources] Prompt when importing project with undefined resource link ...
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2007-10-30 14:44 EDT by David Wegener CLA
Modified: 2019-09-06 16:18 EDT (History)
3 users (show)

See Also:


Attachments
Initial work on a patch to resolve this request (9.38 KB, patch)
2007-11-12 20:22 EST, David Wegener CLA
no flags Details | Diff
Next version of patch (14.96 KB, patch)
2007-11-25 14:35 EST, David Wegener CLA
no flags Details | Diff
mylyn/context/zip (9.29 KB, application/octet-stream)
2007-11-25 14:35 EST, David Wegener CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Wegener CLA 2007-10-30 14:44:06 EDT
Build ID: M20071023-1652

Steps To Reproduce:
1.Create a new Java project
2.Create a linked source folder to a location outside of the workspace using the Variable button on Link to folder in the file system.
3.Delete the project but don't delete project contents.  The project will need to be imported in a later step.
4. Delete the Link Resource variable from the Linked Resource preference dialog.
5. Import the project using File->Import->Existing Project into workspace wizard.

The linked source folder will cause a build path error.  However, it is difficult to figure out which Linked Resource variable is missing.


More information:
When importing a Java project that references a resource link variable that isn't defined in the workspace, the import wizard should prompt the user to define the resource link variable.  This will alert the user to any missing link variables.  This would be a welcomed enhancement to people who share projects that contain linked resources.
Comment 1 Boris Bokowski CLA 2007-11-12 12:10:43 EST
Copied from a message from Davif to platform-ui-dev:

I'm working on implementing an enhancement request that I have submitted
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=208085).

It involves notifying the user that a project being imported references
a resource variable that isn't defined in the workspace.

I'm looking in the
org.eclipse.ui.internal.wizards.datatransfer.WizardProjectsImportPage
page createExistingProject method.

I'm able to access the project members and determine which ones are
links after the project has been created and opened.  From here, I use
the Workspace.validateLinkLocation method to determine whether the link
is resolved or not by checking the returned status for a value of
VARIABLE_NOT_DEFINED_WARNING.

Does this sound like I'm heading in the right direction?  Are there any
special considerations I need to handle that might not be initially
obvious?

I'm also looking for some help with the next steps to take.  I was
hoping to pop up a dialog displaying a list of undefined Resource
Variables.  The dialog would have a button that allowed the user to
define the variables.  Does this sound doable?  I am currently able to
display an ErrorDialog using the Display.asyncExec method.  Is this the
correct approach?
Comment 2 Boris Bokowski CLA 2007-11-12 12:11:04 EST
Sorry. s/Davif/David/
Comment 3 Boris Bokowski CLA 2007-11-12 12:17:13 EST
(In reply to comment #1)
> Does this sound like I'm heading in the right direction?

Yes, what you wrote makes sense to me.  How about you attach a patch that we can look at and comment on?  It doesn't have to be production-quality right away :-)

> I'm also looking for some help with the next steps to take.  I was
> hoping to pop up a dialog displaying a list of undefined Resource
> Variables.  The dialog would have a button that allowed the user to
> define the variables.  Does this sound doable? 

Yes.  By opening a dialog, you are forcing the user to deal with the problem right there and then (or to ignore it).  If the dialog is modal, this would prevent the user from using the IDE to correct the problem.  It definitely sounds better than not showing any indication at all though.

> I am currently able to
> display an ErrorDialog using the Display.asyncExec method.  Is this the
> correct approach?

Yes, you could open the dialog with the list of undefined resource variables from an asyncExec.
Comment 4 David Wegener CLA 2007-11-12 20:22:45 EST
Created attachment 82722 [details]
Initial work on a patch to resolve this request

Here is a patch file that can be applied against the org.eclipse.ui.ide plugin project.

You can see how it works using the following steps:
1. Make sure that Linked Resources are enabled and create two new Resource Variables (LinkLocation1 and LinkLocation2)
2. Create a new project.
3. Create a new folder link extending LinkLocation1.
4. Create a new folder link extending LinkLocation2.
5. Delete the new project but not the contents of the project
6. Delete the Resource Link variables created in step 1.
7. Import the deleted project using File->Import->Existing Project Into Workspace.  Point to the directory with the project and click on Finish.

There will be a dialog displayed that shows the missing Resoure Link names.

There isn't any code yet to actually add the links.

Comments and criticisms are greatly appreciated.
Comment 5 Boris Bokowski CLA 2007-11-13 15:23:48 EST
It looks like you are going in the right direction. You could probably use a PathVariablesGroup when it comes to defining the path variables, it would just have to be a little more flexible. For example, you could create the missing path variables automatically but then you would want to display only those.
Comment 6 David Wegener CLA 2007-11-25 14:35:40 EST
Created attachment 83721 [details]
Next version of patch

I've made some more progress on the patch for this feature.  The approach I took was to change the PathVariableGroup to display a list of resources that refer to a missing path variable.  The list is only displayed if passed in on a new constructor.  As missing path variables are added, the missing list is updated to only display resources that still don't have their path variables defined.

Please look at the changes and provide comments.

This patch still isn't production ready.  It doesn't have any checks to make sure that the workspace supports linked resources.  It also has some hard coded strings to display dialog titles and description text.

Should the MissingPathVariableDialog add the ability to turn on workspace linked resource support?

I also need some help on what needs to be done to externalize the strings.

Finally, do anyone have suggestions about adding tests to verify the changes?
Comment 7 David Wegener CLA 2007-11-25 14:35:44 EST
Created attachment 83722 [details]
mylyn/context/zip
Comment 8 Boris Bokowski CLA 2009-11-26 16:23:10 EST
Oleg is now responsible for watching bugs in the [LinkedResources] component area.
Comment 9 Eclipse Webmaster CLA 2019-09-06 16:18:21 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.