This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 190176

Summary: Local toolbars not loaded
Product: platform Reporter: crosati <crosati>
Component: Data SystemsAssignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description crosati 2010-09-06 08:36:30 UTC
Product Version = NetBeans IDE 6.9.1 (Build 201007282301)
Operating System = Mac OS X version 10.6.4 running on i386
Java; VM; Vendor = 1.6.0_20
Runtime = Java HotSpot(TM) Client VM 16.3-b01-279

Hi,

I'm trying to create a local toolbar to be installed into my top component.

Here what inside my layer.xml file:


  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN"  "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
  <filesystem>
    <folder name="Actions">
      <folder name="View">
        <file name="it-acsys-projects-kaos-core-viewers-pdf-action-FitWidthAction.instance">
          <attr name="delegate" newvalue="it.acsys.projects.kaos.core.viewers.pdf.action.FitWidthAction"/>
          <attr name="displayName" bundlevalue="it.acsys.projects.kaos.core.viewers.pdf.action.Bundle#CTL_FitWidthAction"/>
          <attr name="iconBase" stringvalue="it/acsys/projects/kaos/core/viewers/pdf/resources/fit_to_width.png"/>
          <attr name="instanceCreate" methodvalue="org.openide.awt.Actions.alwaysEnabled"/>
          <attr name="noIconInMenu" boolvalue="false"/>
        </file>
      </folder>
    </folder>
    <folder name="PDFViewer">
      <folder name="Toolbars">
        <folder name="ZoomToolbar">
          <attr name="position" intvalue="100"/>
          <file name="it-acsys-projects-kaos-core-viewers-pdf-action-FitWidthAction.shadow">
            <attr name="originalFile" stringvalue="Actions/View/it-acsys-projects-kaos-core-viewers-pdf-action-FitWidthAction.instance"/>
          </file>
        </folder>
      </folder>
    </folder>
  </filesystem>


Then I try to build a ToolbarPool using the following code:


  FileObject root              = FileUtil.getConfigRoot();
  FileObject toolbarsFileObjct = null;

  try
  {
    toolbarsFileObjct = FileUtil.createFolder(root, "PDFViewer/Toolbars");
  }
  catch ( IOException ex )
  {
    Exceptions.printStackTrace(ex);
  }

  if ( toolbarsFileObjct == null )
    throw new IllegalStateException("No PDFViewer/Toolbars/"); // NOI18N

  DataFolder  dataFolder  = DataFolder.findFolder(toolbarsFileObjct);
  ToolbarPool toolbarPool = new ToolbarPool(dataFolder);

  System.out.println("Toolbar exists: " + String.valueOf(toolbarPool.getToolbars().length));


but every time I execute my NB-based application, the found toolbars are always 0.
Comment 1 crosati 2010-09-06 12:16:10 UTC
After looking at NetBeans source code I've found that waitFinished() must be called on a ToolbarPool to wait for content loading.

Thus I've lowered this issue priority. I think that to close the issue a class description on how to use it to load local toolbar (with a code example) should be added.
Comment 2 Jaroslav Tulach 2010-09-07 10:26:57 UTC
core-main#ba169aecc1c1
Comment 3 Quality Engineering 2010-09-08 03:29:34 UTC
Integrated into 'main-golden', will be available in build *201009080000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ba169aecc1c1
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #190176: waitFinished() before returning values from getToolbars() or getConfigurations()
Comment 4 Jaroslav Tulach 2010-09-08 14:10:45 UTC
The fix caused deadlocks on start, see bug 190226. Reverting the fix in 2b08d72f24dc.
Comment 5 Jaroslav Tulach 2010-09-09 08:12:47 UTC
One again and this time with a hope the IDE starts at least sometimes: core-main#1482ef3b369d