Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 177531 - Edit button for wrapped JAR src & javadoc is initially disabled
Edit button for wrapped JAR src & javadoc is initially disabled
Status: RESOLVED FIXED
Product: apisupport
Classification: Unclassified
Component: Project
6.x
All All
: P4 with 2 votes (vote)
: 8.0
Assigned To: Martin Kozeny
issues@apisupport
:
: 205051 (view as bug list)
Depends on:
Blocks: 171125
  Show dependency treegraph
 
Reported: 2009-11-24 09:15 UTC by Jesse Glick
Modified: 2014-01-06 12:58 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-11-24 09:15:55 UTC
See https://netbeans.org/bugzilla/show_bug.cgi?id=171125#c4 for description.
Comment 1 Jesse Glick 2010-05-04 20:33:39 UTC
ClassPathSupport.getSourceProperty => null since property = "release/modules/ext/whatever.jar", not matching the reference pattern, so Item.canEdit => false.

The following makes the Edit button be enabled, but setting a source association then has no effect:

diff --git a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java b/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
--- a/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
+++ b/apisupport.project/src/org/netbeans/modules/apisupport/project/ui/customizer/SingleModuleProperties.java
@@ -779,7 +779,11 @@
         for (String s : cpExt) {
             sb.append(s);
         }
-        return getClassPathSupport().itemsIterator(sb.toString(), CPEXT);
+        List<Item> items = getClassPathSupport().itemsList(sb.toString(), CPEXT);
+        for (Item item : items) {
+            item.setReference("${file.reference." + item.getReference() + "}");
+        }
+        return items.iterator();
     }
 
     DefaultListModel getWrappedJarsListModel() {

I'm afraid I hardly understand what any of this code does and it is likely any changes would result in regressions. Perhaps it would be better to stop using ClassPathUiSupport and just write a simple data model from scratch; apisupport's storage of JARs is not much like that of other Ant-based projects.

Workaround is to make source/Javadoc associations when adding the JAR; if already added, delete and readd.
Comment 2 Jesse Glick 2011-11-16 01:12:09 UTC
*** Bug 205051 has been marked as a duplicate of this bug. ***
Comment 3 Jesse Glick 2011-11-16 16:55:18 UTC
Does not matter as much in 7.1 since you do not really need this UI any more; independent of project type, you are offered the opportunity to associate source or Javadoc with a JAR at the point where you actually need it (e.g. code completion in the editor). Possibly the special association system should simply be removed altogether, to simplify code in apisupport.
Comment 4 aldobrucale 2011-11-25 09:05:15 UTC
I had not noticed the "Attach javadoc..." link. I think that the "Edit" button should be preserved, in case one has set the wrong directory.

I still can't find how to attach the sources.
Comment 5 Jesse Glick 2011-11-30 13:43:53 UTC
(In reply to comment #4)
> I think that the "Edit" button
> should be preserved, in case one has set the wrong directory.

Probably needs to be addressed more generically in source attacher in java.j2seplatform, though I am not sure what the UI should be - maybe some dialog listing previously attached source and Javadoc locations with a Remove button.

> I still can't find how to attach the sources.

Whenever you get a generated source skeleton - Ctrl-B, Ctrl-O, etc. on a class in the library - there will be a button at the top of the editor to attach real sources.
Comment 6 aldobrucale 2011-12-01 14:21:13 UTC
Thank you, I've just seen it. The "Attach sources" button on the far right of the editor window is not very noticeable, expecially on 16:9 displays... And it doesn't seem to work in nb 7.1 RC1, I'll file separate issues about this.
Comment 7 Martin Kozeny 2014-01-06 12:58:31 UTC
Using Jesse's solution: https://hg.netbeans.org/core-main/rev/248186aaf91f, probably there is no other. Connected to https://netbeans.org/bugzilla/show_bug.cgi?id=240022.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo