PetriEnglishTranslationErrata

Errata for "The Developer's Guide to NetBeans Platform 6.9" by Jurgen Petri

General

  • Inconsistent capitalization of section headings.
  • Problems with code formatting throughout.

Specific

page 18

"To create your own module installer, right-click the Project node of the HelloService project, choose New | Other | Module Installer, "

to become

"To create your own module installer, right-click the Project node of the HelloService project, choose New | Other | Module Development | Installer/Activator,"

page 20 line -1

a "subpackage" is simply a package inside another package.

page 23 lines 5 and 10

Change children to getChildren() otherwise undue changes could be made on children.

page 24 line -6

"You can prepare for this by exposing the API package to the rest of the application, as described earlier in this chapter, which adds the "Task" interface to the public interfaces of the module."

should be

"You can prepare for this by exposing the com.netbeansrcp.taskmodel.api package to the rest of the application, as described earlier in this chapter, which adds the "Task" interface to the public interfaces of the module. Right-click the TaskModel module and select Clean and Build for the changes to take effect."

page 27

"In the same way as done in the previous chapter, create a new module. "

to become

"In the same way as done in the previous chapter, create a new module, but make sure that you select “Generate XML Layer” check-box this time."

Otherwise, the layer.xml won't exist as stated on page 46.

page 29 line 9

Change JLabel1 to jLabel1

page 30 line -8

"screenshot on page 9" should be "screenshot on page 32"

page 31

Add the following after the last line:

"Right-click on Libraries | Add Module Dependency and add the Utilities API module. This will remove the errors."

page 32 line -1

private Task task = new TaskImpl(); To write this, both the com.netbeansrcp.taskmodel and com.netbeansrcp.taskmodel.api packages have to be declared public! Only when TaskManager and TaskManagerImpl will be available (from page 92 on) could the package com.netbeansrcp.taskmodel be made private.

page 33 line 13

Change JSlider1 to jSlider1

page 34 lines 12 and 15

Change ChangeEventevt to ChangeEvent evt

page 34

"Now let's register two ChangeListeners on the sliders. These call our update task method whenever the values of the sliders change. Right-click the first slider,"

to become

"Now let's register two ChangeListeners on the sliders. These call our update task method whenever the values of the sliders change. Switch to the Design view. Right-click the first slider,"

page 35

"Post-Listeners Code." --> "Post-Creation Code."

and add the following before "Extending the palette"

"Clean and build TaskEditor module."

page 36 line 4

It's worth mentioning that one has to build the application before being able to install the TaskEditorPanel in the Palette. Also read here for help.

page 44 line 17

The generated TopComponent does not have a private constructor, as shown on page 42 line 1. You need to manually change it from private to public. In other words, this sentence is not valid:

"A private constructor prohibits its incorrect usage from outside by disallowing direct instantiation of the class."

page 45 line -4

WSTCREF is more likely for Window System Top Component REFerence

page 45

"This becomes clearer with the following file." --> "This becomes clearer with the previous file."

page 46 line -18

Change com to com-

page 46

"This is not true for the following file, the layer.xml,"

Layer.xml will only appear unless you followed the erratum on page 27 above.

page 47

"using the via a registration entry" --> "using a registration entry"

page 48

"1. Create a new NetBeans Platform application and name it WindowSystemExamples." --> "1. Create a new NetBeans Platform application and name it WindowSystemExamples. Make sure that you select “Generate XML Layer” check-box."

page 50

"requestVisible(): Requests to select to TopComponent" --> "requestVisible(): Requests to select the TopComponent"

page 53

"1. Add to the WindowSystemExamples application a new module named Modes, with the Code Name Base com.netbeansrcp.modes." --> "1. Add to the WindowSystemExamples application a new module named Modes, with the Code Name Base com.netbeansrcp.modes. Make sure that you select “Generate XML Layer” check-box."

page 56

"1. Create a new module named CustomModes, with Code Name Base com.netbeansrcp.custommodes, within the existing WindowSystemExamples application." --> "1. Create a new module named CustomModes, with Code Name Base com. netbeansrcp.custommodes, within the existing WindowSystemExamples application. Make sure that you select the “Generate XML Layer” check-box."

page 62

TopComponentGroup myGroup
 WindowManager.getDefault().findTopComponentGroup("colorgroup");

to become

TopComponentGroup myGroup =
 WindowManager.getDefault().findTopComponentGroup("colorgroup");

page 68

Modify the last line: "Declare the package com.netbeansrcp.taskidgenerator.api as part of the public interface of the module." as so: "Declare the package com.netbeansrcp.taskidgenerator.api as part of the public interface of the module. Clean and build the module for the changes to take effect."

and add another line before it: "Right-click on Libraries and add a new module dependency to the Lookup API."

page 71

Before step 4, add "Do a Clean and Build."

page 71 line 14

I know this was just meant to be an illustration but a meaningful implementation of validate() would have shown some interesting points. First it shows that, for all the tasks to be accessible, we need the centrally managed service facade for creation of tasks introduced on page 92 with the TaskManager class. But as this class is in the TaskModel module, declaring a dependency of the TaskIdGenerator module on the TaskModel module would introduce a cyclic dependency, as the TaskModel module already depends on the TaskIdGenerator module. The NotNegativeIdValidator module depends on TaskIdGenerator but not on the TaskModel module. So it would have been more astute to do the opposite to what is done in the book, mainly to put the NotNegativeIdValidator class (which doesn't need to know about other tasks) inside the TaskIdGenerator module and to put the UniqueIdValidator class inside a module of its own as this one could have now declared a dependancy on TaskModel.

page 73 line -8

Replace extended by extends

page 74 line -19

Change modified to modifier

page 74 line -4, page 82 line -2, page 83 line 9

Cast to TaskEditorPanel is not necessary

page 74

"To make the Task publicly available, change its modifier from private to public in the TaskEditorPanel, shown as follows:

 public Task task = new TaskImpl();"

convert to

"Create a getter method:

   public Task getTask() {
       return task;
   }

" and modify the last line as follows:

 this.associateLookup(Lookups.singleton(this.taskEditorPanel1.getTask()));

page 80 line 21

A JPanel like any Component has a PropertyChangeSupport already build in, it can be used for user-defined properties. No need to had another one. Just use on page 82 line -4 :

 this.taskEditorPanel1.addPropertyChangeListener (TaskEditorPanel.PROP_TASK, taskChangeListener);

and don't override : addPropertyChangeListener(PropertyChangeListener listener) and removePropertyChangeListener(PropertyChangeListener listener) on page 80.

page 82-83

Make sure you modify the code like so:

  public TaskEditorTopComponent() {
       initComponents();
       this.taskEditorPanel1.addPropertyChangeListener(taskChangeListener);
       this.ic.add(this.taskEditorPanel1.getTask());
       this.associateLookup(new AbstractLookup(this.ic));
   }
   
   private class ListenForTaskChanges implements PropertyChangeListener {
       @Override
       public void propertyChange(PropertyChangeEvent arg0) {
           if (TaskEditorPanel.PROP_TASK.equals(arg0.getPropertyName())) {
               List<Task> newContent = new ArrayList<Task>();
               newContent.add(TaskEditorTopComponent.this.taskEditorPanel1.getTask());
               TaskEditorTopComponent.this.ic.set(newContent, null);
           }
       }
   }

page 84 line 12

To prevent several ocurrences of the same task to be listed in the TaskLogTopComponent replace

this.listModel.addElement(task); 

by

 if (!this.listModel.contains(task)){
   this.listModel.addElement(task);
 } 

page 87 line 19

 toArray(new com.netbeansrcp.taskmodel.TaskImpl[]{}); 

needs the com.netbeansrcp.taskmodel package to be public. Better is

 toArray(new Task[]{}); 

page 87 line -6

Task t = new TaskImpl(); needs the com.netbeansrcp.taskmodel package to be public. Only when TaskManager and TaskManagerImpl will be available (from page 92 on) could the package be made private.

page 92 line -7

The Task interface is already in the com.netbeansrcp.taskmodel.api package as stated page 20 line -12 and this package is already public as stated page 24 line 5.

page 94 line 13 and 14

The identation is not adequate.

page 94

The code

   @Override
   public List<Task> getTopLevelTasks() {
      return Collections.unmodifiableList(this.topLevelTasks);
   }

isn't thread safe and will result in ConcurrentModificationException because it doesn't guarantee that a thread won't modify the topLevelTasks list at the same time when another accesses it via the above method. Even if you declare topLevelTasks as:

 this.topLevelTasks = Collections.synchronizedList(new ArrayList<Task>());

the ConcurrentModificationException will appear one day. A simple solutions is:

   @Override
   public List<Task> getTopLevelTasks() {
       return new CopyOnWriteArrayList<Task>(this.topLevelTasks);
   }

page 96

Change has also to be made to the implementation of page 80 line -8 to line -2 of the Create New Task button of the class TaskEditorPanel to make use of TaskManager instead of TaskImpl.

 private void jButton1ActionPerformed(ActionEvent evt)  {                                         
    if (null != this.taskMgr) {
        Task oldTask = this.task;
        this.task = this.taskMgr.createTask();
        this.pcs.firePropertyChange(PROP_TASK, oldTask, this.task);
        this.updateForm();
    }
 }        

while in the constructor it is:

 this.pcs = new PropertyChangeSupport(this);

and not

 this.pss = new PropertyChangeSupport(this);

page 100

Remove line:

  this.pcs = new PropertyChangeSupport(this);

and change line

  this.pcs.firePropertyChange(PROP_TASK, oldTask, this.task);

to

  this.firePropertyChange(PROP_TASK, oldTask, this.task);

The constructor should be:

   public TaskEditorPanel() {
       if (null == this.taskMgr) {
           this.taskMgr = Lookup.getDefault().lookup(TaskManager.class);
       }
       initComponents();
   }

page 101 line -17

Add also:

 private static TaskManager taskMgr;

page 101

Change newListenForRemovedNodes() to new ListenForRemovedNodes()

page 101 line -1

 private class ListenForRemovedNodes implements PropertyChangeListener {

modify to

 private static class ListenForRemovedNodes implements PropertyChangeListener {

page 102

Modify last lines as so:

   private TaskEditorTopComponent(Task task) {
       initComponents();
       this.taskEditorPanel1.addPropertyChangeListener(TaskEditorPanel.PROP_TASK, taskChangeListener);
       this.taskEditorPanel1.updateTask(task);
       this.ic.add(this.taskEditorPanel1.getTask());
       this.associateLookup(new AbstractLookup(this.ic));
       tcByTask.put(task, this);
   }
   public String getTaskId() {
       Task task = this.taskEditorPanel1.getTask();
       return (null != task) ? task.getId() : "";
   }

and change parameterless constructor to public to remove compiler errors:

   public TaskEditorTopComponent() {
       this(Lookup.getDefault().lookup(TaskManager.class));
   }

page 102 line -4 to line -1

Method getTaskId() is never used

page 107 line -4

Change comnetbeansrcp-taskeditor-NewTaskAction.instance to com-netbeansrcp-taskeditor-NewTaskAction.instance

page 109 line -14

Change comnetbeansrcp-taskeditor-NewTaskAction.instance to com-netbeansrcp-taskeditor-NewTaskAction.instance

page 114 lines 17 and 18

It is written in the text : “Refer to the chapter on the DataSystems API for more information on this node implementation.” but nothing on DataNode in that chapter.

page 114 line -1

You need also to add a dependency on the "Utilities API".

page 118 line 9 and line -11 to line -6

Remove line 9 :

task.addPropertyChangeListener(this); 

and remove line -11 to line -6 :

if ( (arg0.getSource() instanceof Task) &&            
  TaskManager.PROP_TASKLIST_ADD.equals(arg0.getPropertyName()) ||
  TaskManager.PROP_TASKLIST_REMOVE.equals (arg0.getPropertyName())) {
    this.updateNodes(); 
} 

page 119 line -10

It is not “the name of the property” but “the property for the name”.

page 123 line -5

Replace LookupUtils by ExplorerUtils

page 124 line -14 and -13

Remove InputMap keys = this.getInputMap(JComponent.WHEN_ ANCESTOR_OF_FOCUSED_COMPONENT);

page 128 line 22

Change setDisplayName(arg0.getNewValue() + ""); to setDisplayName(((Task)arg0.getSource()).getName() + ""); fireDisplayNameChange(null, null); Otherwise if the change is in the priority property, the new name will be the new priority of the task.

page 130 line -9

Change If to if

page 131 line -4 and -3

Remove

  InputMap keys = this.getInputMap(JComponent.WHEN_ ANCESTOR_OF_FOCUSED_COMPONENT); 

page 133

In the illustration the button to create tasks is called OK whereas it was called Create New Task before.

page 142 line 15

The TaskActions module has not been created.

page 142 line 20

You also need to set dependencies on Window System API, TaskModel and TaskEditor. However, you need to set the com.netbeansrcp.taskeditor package public before you can add TaskEditor.

page 143 line 12

Change

  newImageIcon

to

  new ImageIcon

page 143 line 17

Change

  this.resultChanged(new LookupEvent(result); 

to

  this.resultChanged(new LookupEvent(result));

page 144 line 8

A } is missing before getToolbarPresenter() method. Also add @Override before this method.

page 144 line 20

If you implement the ContextAwareAction interface and the createContextAwareInstance() method as is described on the next page, you will see that the Edit Task action is disabled in the context menu. This is because, that method creates a new EditAction each time it is called which doesn't initialise toolbarBtn in the getToolbarPresenter() method and as a result resultChanged() sets it as disabled. It is also very inefficient to create a new action every time. The solution is simple: do not implement the ContextAwareAction interface and the createContextAwareInstance() method.

page 145 line 18

Here is an AddAction coming from nowhere ! Is this the NewTaskAction from page 105 ?

page 147 line 8

Clean and build TaskActions module for the changes to take effect.

Then, it says choose a task, and then click Edit Task in the toolbar. Choose a task from where?

And a bit later, this time from the TaskNode, and then select Edit Task there. Where is TaskNode?

I assume the first time it means from the Overview Window while the second time from the popup menu by right-clicking on a tree node on the Overview Window.

page 150 line -19

Remove ContextAwareAction from the list of interfaces.

page 150 line -4

this.resultChanged(null); can be erased.

page 151 line -18

Remove implementation of createContextAwareInstance().

page 152 line -19

Remove ContextAwareAction from the list of interfaces.

page 153 line 8

Remove implementation of createContextAwareInstance().

page 154 line 13 and 14

Delete lines 13 and 14, they are the same as lines 11 and 12.

page 154 line -21 and line -23

Replace AddAction by AddNewAction

page 158 line -4

"That is where you create the create PriorityFilterNode." --> "That is where you create the PriorityFilterNode."

page 162 line 1

In the text a Clear button is mentioned, whereas the illustration shows a Reset button.

page 167 line 4

Change elipsis to ellipsis

page 167 line 14

Change PriorityEditorSupport to PropertyEditorSupport

page 171 line 8

"org.netbeansrcp.taskorganizer" --> "com.netbeansrcp.taskorganizer"

page 171 line 17

"Right-click the application node, that is, the TaskManager node, choose Properties, and then put a checkmark next to the Visual Library item in the platform cluster within the Libraries panel." --> "Right-click the application node, that is, the TaskManager node, choose Properties, then select the category Libraries and then put a checkmark next to the Visual Library item in the platform cluster within the Libraries panel."

page 174 line 11 To avoid an error message when dragging and dropping either a node and one of his children or the same node twice replace

  ((VMDPinWidget) addPin(nodeID, pinID)).setPinName(pinID);

by

  ((VMDPinWidget) addPin(nodeID, “Pin” + pinID)).setPinName(pinID);

and add

  if (isNode(task.getName())) return;

before createNode(task.getName()); line -2 page 173

page 176 line -11

Add a dependency to the File System API and Utilities API modules in the TaskModel.

page 177 line 15 to 19

It's worth mentioning that these lines should be placed in the TaskManager interface (in the same way it's done on page 197).

page 184 line 18

Change In order to create a FileObject for the DataObject

to

In order to create a DataObject for the FileObject.

page 187 line 14

Replace

  TopLevelTaskDataLoader loader)

with

  MultiFileLoader loader)

page 188 lines 1-12

These changes to the TaskNode have already been performed.

page 188 line 15

It is not good practice to add a dependency to DataObject and Nodes API modules in the TaskModel module. TaskManager's implementation could be simpler if any service is not provided by other modules. TaskFileSupport module should provide TaskManagerImpl with a way on how to store and load Tasks. The TaskManager interface shouldn't contain a reference to DataObject.

page 188 line -7

  public class TaskManagerImpl implements TaskManager {
     // ...
     private Map<Task, DataObject> doByTask;
  
     public TaskManagerImpl() {
        this.doByTask = Collections.synchronizedMap(new HashMap<Task, DataObject>());
        this.topLevelTasks = Collections.synchronizedList(new ArrayList<Task>()); 
      // ..

page 189 line 4

   if (null != dao) {
      this.doByTask.put(task, dao);
   }
   this.topLevelTasks.add(task);
   this.pss.firePropertyChange(PROP_TASKLIST_ADD, null,  
             task);

to

   if (null != dao) {
      this.doByTask.put(task, dao);
      this.topLevelTasks.add(task);
      this.pss.firePropertyChange(PROP_TASKLIST_ADD, null, task);
   }

page 189 line -4

Make sure that you rename pss with pcs. Change

  @Override
  public List<DataObject> getTopLevelTasks() {
     return Collections.unmodifiableList
       (new ArrayList<DataObject>(this.doByTask.values()));
  }

to

  @Override
  public List<DataObject> getTopLeveltTasks() {
       return new CopyOnWriteArrayList<DataObject>(this.doByTask.values());
   }

page 190 line -14

  after setting a dependency on the Datasystems API:

to become

  after setting a dependency on the Datasystems and Nodes APIs:

page 191 line 3

  dependency on the Datasystems API. Next, change the actionPerformed() method as follows:

to become

  dependency on the Datasystems and Nodes APIs. 
  Next, change the actionPerformed() method of the NewTaskAction class as follows:

page 191 line 12

  Next, in the same vein, still in the TaskEditor module, change this line:

to become

  Next, in the same vein, still in the TaskEditor module, change this line in TaskEditorPanel:

page 191 line -12 till end of page

To be replaced by

  Both the AddDuplicateAction and the AddNewAction classes need to change, 
  in accordance with the change you made in the TaskModel module. Don't forget to add a 
  dependency on the Datasystems and Nodes APIs, too.

AddDuplicateAction

  public void actionPerformed(ActionEvent arg0) {
      if (null != this.result && 0 < this.result.allInstances().size()) {
      // ...
      } else {
          newTask =
             taskMgr.createTask().getLookup().lookup(Task.class);
          newTask.setName(original.getName());
      }
      // ...

AddNewAction

  public void actionPerformed(ActionEvent arg0) {
      if (null != this.result && 0 < this.result.allInstances().size()) {
      // ...
      } else {
          newTask =
             taskMgr.createTask().getLookup().lookup(Task.class);
      }
      // ...

page 192 lines 6-14

To be replaced by:

  @Override
   protected void addNotify() {
       super.addNotify();
       if (null != this.taskMgr) {
           this.setKeys(this.taskMgr.getTopLevelTasks());
       }
   }
   @Override
   protected Node[] createNodes(DataObject arg0) {
       return new Node[]{arg0.getNodeDelegate()};
   }
   @Override
   public void propertyChange(PropertyChangeEvent arg0) {
       if (null != this.taskMgr) {
           if (TaskManager.PROP_TASKLIST_ADD.equals(arg0.getPropertyName())
                   || TaskManager.PROP_TASKLIST_REMOVE.equals(arg0.getPropertyName())) {
               this.setKeys(this.taskMgr.getTopLevelTasks());
           }
       }
   }

Don't forget to add a dependency on the Datasystems and Nodes APIs, too. Now you have updated all the classes that use TaskManager.

page 193 line 1

Change

  remove the call to loadTasks() from the constructor of the TaskManagerImpl class. 

by

  remove the call to loadTasks() from the constructor of the TaskManagerImpl class 
  and add if (!tasksLoaded) loadTasks(); to the getTopLevelTasks() method.

page 193 line 15

Replace

  if (null != dao) 

by

  if (null != dao && null != dao.getLookup().lookup (Task.class) ) 

otherwise a null object could be put in the map doByTask and will appear in the explorer view

page 196 line -19

Change

  this.ic.add(new TopLevelTaskSaveCookie());

to

  this.ic.add(new TopLevelTaskSaveCapability());

page 196 line -16

Change

  private class TopLevelTaskSaveCookie implements SaveCookie {

to

  private class TopLevelTaskSaveCapability implements SaveCookie {

page 197 line 11

Missing instruction subTask.addPropertyChangeListener(this); after subTask.removePropertyChangeListener(this); so that changes in subtask can be propagated to top level task and the saveable state of the top level task can be updated.

page 200

com.netbeansrcp.overview.TaskNode must implement LookupListener.

page 200 line -14

Change lookup(SaveCookie.class); to lookupResult(SaveCookie.class);

page 200 line -11 to line -5

If you register SaveAction in the layer within the Tasks/Nodes/Task/Actions folder, as stated page on 200 lines 4 to 8, then it is not necessary to make any change to getActions(boolean) in TaskNode.

page 201

getOpenedIcon() needs also to be overriden otherwise when we expand the nodes we won't see the state of the node, saveable or not.

page 201 line 13

("com/netbeansrcp/overview/Orange Ball small.png"); to become ("com/netbeansrcp/taskactions/Orange Ball small.png");

page 204 line 10

Change

  NotifyDescriptor.INFORMATION.MESSAGE 

to

  NotifyDescriptor.INFORMATION_MESSAGE

page 205 line 14

In the text (page 204 line 10) one speaks about NotifyDescriptor.INFORMATION_MESSAGE whereas, in the code (page 205 line 14) and the illustration, one finds NotifyDescriptor.WARNING_MESSAGE

page 206 line -13

Change

 “Delete Task”NotifyDescriptor.YES_NO_OPTION 

to

 “Delete Task”, NotifyDescriptor.YES_NO_OPTION

page 210 line 7

RemoveAction has been added to Edit toolbar, not Task toolbar.

page 210 line -17

Replace display() by notify()

page 211 line -15

You might encounter the following error during build:

  ...\netbeans\harness\build.xml:174: Module org.jdesktop.layout excluded from the target platform
  BUILD FAILED (total time: 5 seconds)

Open NetBeans Platform Config property file inside Important Files of the module suite and delete the line org.jdesktop.layout,\. Do another clean and build. It should compile fine now.

page 215 line -4

Replace “four” by “five”

page 217 line 11

Replace “Make these components available to the other classes in the module via getter methods” by “Make the JTextArea available to the other classes in the module via a getter method”

page 218 line 14

Replace “and add” by “, addChangeListener(...)”

page 218 line -9 to line -6 indentation

page 218 line -1

Change “a subtask” to “a message saying that you want to create a subtask” and change “a TopLevelTask” to “a message saying that you want to create a top level task”

page 219 line -13

Replace txt = "You want a Task without parent" +" Create Task..."; by txt = "You want to create a Task without parent";

page 219 line 10

It is worth mentioning that the type of component has been changed from Component to NewTaskVisualPanel1

page 220 line 16

It is worth mentioning that the type of component has been changed from Component to NewTaskVisualPanel2

page 223 line 6

It is worth mentioning that the type of component has been changed from Component to NewTaskVisualPanel3

page 224

Replace this.actionPerformed(“”); by this.performAction(null); and change

  public void actionPerformed(String parentId) {

to

  public void performAction(String parentId) {

page 224 line -6

In order to use the code of page 228, NewTaskWizardAction must extend SystemAction:

   @Override
   public String getName() {
       return "New Task Action";
   }
   @Override
   public HelpCtx getHelpCtx() {
       return HelpCtx.DEFAULT_HELP;
   }

page 225 line 6

Replace Utilities by ImageUtilities

page 225 lines -20 to -18

Change

   task =  
       taskMgr.createTask().getLookup 
        ().lookup(Task.class);

to

   task =  taskMgr.createTask();

page 227 third line under the table

Change WizardDesriptor to WizardDescriptor

page 228 line 1

The result of the wizard is given by wizardDescriptor.getValue() on page 225 line 15

page 228 line 7 and line 8

Change AddNewWizardAction to NewTaskWizardAction

page 228

In the code snippet of page 228 the instruction EditAction.openInTaskEditor(task); of page 149 line 16 is lost. One can put it in the code of page 225 before line -2

page 233 line 4

Change “Create a new class named PreferencesImpl” by “Create a new class named PreferencesImpl in the org.netbeansrcp.preferences package”

page 233 line -5

Replace this.getPersistencePath() by this.getPersistencePath().getAbsolutePath()

page 235 last picture

Replace org.netbeansrcp.preferences by com.netbeansrcp.preferences'.'

page 236 line -5

Replace Open the PreferencesPanel and change the layout to BorderLayout. to Open the PreferencesPanel.

page 238

The link between the Preferences module and the rest of the TaskManager application is missing.

First the package org.netbeansrcp.preferences.api must be declared public. Then a dependency of the TaskModel module on the Preferences module has to be declared. And changes have to be made in TaskManagerImpl:

1. Change

File file = new File("/Users/jpe/tasks/"); 

to

File file = new LocalFileSystem().getRootDirectory();
Preferences prefs = Lookup.getDefault().lookup(Preferences.class);
if (null != prefs) {
    file = prefs.getPersistencePath();
    prefs.addPropertyChangeListener(this);
}

2. TaskManagerImpl has to implement PropertyChangeListener

3. In TaskManagerImpl add the propertyChange(PropertyChangeEvent arg0) method as follows:

public void propertyChange(PropertyChangeEvent arg0) {
    if (Preferences.PATH_CHANGED.equals(arg0.getPropertyName())) {
        try {
            File file = new File("" + arg0.getNewValue());
            LocalFileSystem fs = new LocalFileSystem();
            fs.setRootDirectory(file);
            this.root = fs.getRoot();
        } catch (PropertyVetoException ex) {
            Exceptions.printStackTrace(ex);
        } catch (IOException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
}

page 239 line -8, page 243 line 10 and page 247 line -13

To show a help topic by pressing the F1 key you have to have the following in the layer file:

<folder name="Shortcuts">
   <file name="F1.shadow">
       <attr name="originalFile" stringvalue="Actions/Help/org-netbeans-modules-javahelp-HelpAction.instance"/>
   </file>
</folder>

page 241 line 8

Replace <title></title> by <title>Task</title> When you use the Search tab of the Help window this will be shown instead of No Title

page 243 line 14

Replace

  String id = "here is the help id from the mapping file"; 

by

  here is the help id from the mapping file
  String id = "com.netbeansrcp.overview.TaskNode"; 

page 244 line 8

Replace <title></title> by <title>Introduction</title> When you use the Search tab of the Help window this will be shown instead of No Title

page 244 line -5

Replace <title></title> by <title>Details</title> When you use the Search tab of the Help window this will be shown instead of No Title

page 244 line -20

The object tag starts an external browser only if the class HtmlBrowser.URLDisplayer is extended and the extension is registered as a service provider in the META-INF/services folder, otherwise it is the default implementation in the internal Swing HTML browser which is started.

page 245 line 6

Replace “detailes” by “detailed”

page 245 line 10

Change en.wikipedia.ork to en.wikipedia.org

page 245 line 22

Replace <title></title> by <title>Description</title> When you use the Search tab of the Help window this will be shown instead of No Title

Not logged in. Log in, Register

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