Bug 192517 - [Schema][Editors] Clicking on "Extends", "Implements" hyperlink does not preload package, class name into Java wizard fields
Summary: [Schema][Editors] Clicking on "Extends", "Implements" hyperlink does not prel...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.4 M1   Edit
Assignee: Adam Archer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 186653 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-13 15:17 EDT by Mike Pawlowski CLA
Modified: 2007-07-11 17:17 EDT (History)
2 users (show)

See Also:
mike.pawlowski: review+


Attachments
patch (4.85 KB, patch)
2007-07-10 18:19 EDT, Adam Archer CLA
mike.pawlowski: review-
Details | Diff
Updated patch fixing minor problems (5.26 KB, patch)
2007-07-10 20:38 EDT, Mike Pawlowski CLA
no flags Details | Diff
patch fixing remaining problems (5.39 KB, patch)
2007-07-11 15:55 EDT, Adam Archer CLA
mike.pawlowski: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Pawlowski CLA 2007-06-13 15:17:30 EDT
Steps To Reproduce:

(1) Create new extension point schema
(2) Switch to "Definition" page
(3) Create a new element
(4) Create a new attribute for that element
(5) Set the new attribute's type as "java"
(6) Specify "org.eclipse.ui.NonExistingClass" in the "Extends" field
(7) Click the "Extends" hyperlink
    -> "New Java Class" wizard opens
    -> BUG:  The following wizard fields are not preloaded with values:
       "Source folder", "Package", "Name"
    -> BUG:  Same problem exists for the "Implements" hyperlink.

Expected Behaviour:

Wizard fields are preloaded with appropriate values (see "class" attribute hyperlinks in Plug-in Manifest Editor) with clicking on the "Extends" or 
"Implements" hyperlink using contents from "Extends" or "Implements" field.
Comment 1 Mike Pawlowski CLA 2007-07-09 16:36:32 EDT
*** Bug 186653 has been marked as a duplicate of this bug. ***
Comment 2 Adam Archer CLA 2007-07-10 18:19:05 EDT
Created attachment 73489 [details]
patch
Comment 3 Mike Pawlowski CLA 2007-07-10 20:28:18 EDT
Comment on attachment 73489 [details]
patch

Tested good; but, a few minor problems. See next comment for details.
Comment 4 Mike Pawlowski CLA 2007-07-10 20:34:06 EDT
Fixed Minor Problems (See updated patch)

* NLS Escaped String  "."
* Updated copyright
* Suppressed printing out of Java exception stack trace

Minor Problems Still Present:

* Inputting "." in either field produces an exception when the hyperlink is clicked:

java.lang.IllegalArgumentException: Path must include project and resource name: /org.example.rcp
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:62)
	at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:1625)
	at org.eclipse.core.internal.resources.Container.getFolder(Container.java:130)
	at org.eclipse.pde.internal.ui.editor.schema.NewClassCreationWizard.initializeValues(NewClassCreationWizard.java:95)
	at org.eclipse.pde.internal.ui.editor.schema.NewClassCreationWizard.<init>(NewClassCreationWizard.java:36)
	at org.eclipse.pde.internal.ui.editor.schema.SchemaAttributeDetails.handleLinkActivated(SchemaAttributeDetails.java:490)

* The text field populates the wizard page with invalid class / interface characters (e.g. @#$ and spaces, etc.)

Use of this utility before setting on wizard will help:
String name = TextUtil.trimNonAlphaChars(text.getText()).replace('$', '.');
Comment 5 Mike Pawlowski CLA 2007-07-10 20:38:11 EDT
Created attachment 73499 [details]
Updated patch fixing minor problems
Comment 6 Adam Archer CLA 2007-07-11 15:55:39 EDT
Created attachment 73594 [details]
patch fixing remaining problems

Trimming non alpha characters off the input resolved the IllegalArgumentException as an input of "." will now be turned into "".

Also eliminated one case from an if that is handled the same by leaving it for the String.substring(int) method called in the else block.
Comment 7 Mike Pawlowski CLA 2007-07-11 17:14:32 EDT
Comment on attachment 73594 [details]
patch fixing remaining problems

Tested well, Adam.  Thanks
Comment 8 Mike Pawlowski CLA 2007-07-11 17:17:07 EDT
Patch applied to HEAD.

Target:  3.4 M1