Summary: | Plugins from workspace not picked up by runtime workbench. | ||
---|---|---|---|
Product: | [Eclipse Project] PDE | Reporter: | Konrad Kolosowski <konradk> |
Component: | UI | Assignee: | Dejan Glozic <dejan> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | critical | ||
Priority: | P1 | ||
Version: | 2.0 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
This is a valid problem. Non-duplicate external plug-ins are added to the list too many times: private void mergeWithoutDuplicates(ArrayList wsmodels, ArrayList exmodels, ArrayList result) { boolean duplicates=false; for (int i=0; i<wsmodels.size(); i++) { result.add(wsmodels.get(i)); } for (int i=0; i<exmodels.size(); i++) { IPluginModelBase exmodel = (IPluginModelBase) exmodels.get(i); for (int j=0; j<wsmodels.size(); j++) { IPluginModelBase wsmodel = (IPluginModelBase) wsmodels.get(j); if (isDuplicate(wsmodel, exmodel)) { duplicates=true; } else result.add(exmodel); } } if (duplicates) { showWarningDialog("The list of plug-ins to run contains duplicates. Plug-ins from the workspace will be used. To fix the problem, uncheck offending external plug-ins in the Launch Configurations"); } } In the code above, the problem is in the inner 'for' loop. If duplicate is detected, 'duplicate' boolean flag is set to true. Otherwise, external plug-in is added to the list. The problem is that it is added in the INNER for loop. This means that if there are M workspace plug-ins and N external ones, external plug-ins will be added M*N times unless there are duplicates. In case of duplicates, each external plug-in will be added M-1 times. This results in a huge list of plug-ins with many duplicates even though the routine should produce a duplicate-free list. Another minor problem of this method is that the warning message somehow escaped translation. This is a serious problem that is worth fixing for 2.0. The solution is to use inner loop for duplicate detection only and add external plug-ins to the list in the outer loop as follows: private void mergeWithoutDuplicates(ArrayList wsmodels, ArrayList exmodels, ArrayList result) { boolean duplicates=false; for (int i=0; i<wsmodels.size(); i++) { result.add(wsmodels.get(i)); } for (int i=0; i<exmodels.size(); i++) { IPluginModelBase exmodel = (IPluginModelBase) exmodels.get(i); boolean localDuplicate = false; for (int j=0; j<wsmodels.size(); j++) { IPluginModelBase wsmodel = (IPluginModelBase) wsmodels.get(j); if (isDuplicate(wsmodel, exmodel)) { localDuplicate=true; break; } } if (localDuplicate) duplicates=true; else result.add(exmodel); } if (duplicates) { showWarningDialog("The list of plug-ins to run contains duplicates. Plug-ins from the workspace will be used. To fix the problem, uncheck offending external plug-ins in the Launch Configurations"); } } In the fix above, we are setting local variable 'localDuplicate' to true if duplicate is detected and exit the inner loop. In the outer loop, we are setting the main 'duplicates' variable or add the external plug-in to the list. The fix has no effect on binary self-hosting because there are no external plug-ins to deal with. It only affects simple and mixed self-hosting i.e. whenever external plug-ins are used exlusively or mixed with binary workspace plug-ins. Value: High - the current code is plain wrong and will cause a lot of confusion Risk: Low - we will simply do what the implementation should have been in the first place. I cannot see how we can make things worse than they are now - the current code just makes no sense. Risk: Small, code is in hand Effort: Small, code is in hand Fixed in GM3 Fixed in G3 |
20020624 integration build. Steps to reproduce: 1.Start Eclipse 2.File->New->Project... , Plug-in Development, Plug-in Project, Next, Type "Test" in project name, Next, Next, Choose Hello World, Next, Next, Finish. 3.Dialog titled: "New Hello World plug-in project" saying: "Plug-ins required to compile Java classes in this plug-in are currently disabled. The wizard must enable them to avoid compile errors" apears. Click OK. 4.Click RunningMan drop downV->Run As->Run-time workbench. 5.Close runtime workbench. 6.Open CVS perspective, create Anonymous repository location to eclipse.org, select org.eclipse.help project from HEAD, right click->Check out as project. 7.File->Import, External plug-ins and Fragments, Next, Next, click Existing Project, click Invert Selection, click Finish. 8.Open Java perspective, expand org.eclipse.help->src- >org.eclipse.help.internal. Double click HelpPlugin.java. 9.Insert line System.out.println("Help system startup"); before line HelpSystem.startup(); Save HelpPlugin.java in the editor. 10.Click RunningMan drop downV -> Runtime-Workbench 11.Dialog titled "Runtime-Workbench Launcher" appears, saying: "The list of plug-ins to run contains duplicates. Plug-ins from the workspace will be used. To fix the problem, uncheck offending external plugins in the Launch Configuration. 12.Click OK. 13.Runtime-workbench will come up. __Problem 1 - I did not get a chance to change the change the Launch Configuration.__ 14.Launch help in runtime workbench. __ Problem 2 - The console stays empty meaning the edited HelpPlugins.java does not get picked up.__