Skip to content

Commit 68fbc76

Browse files
authored
Merge pull request #611 from ebarboni/palettetutorial
a few code block rewrite to get it pretty
2 parents d469be9 + c2a8aa1 commit 68fbc76

31 files changed

Lines changed: 299 additions & 438 deletions

netbeans.apache.org/src/content/tutorials/68/nbm-google.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ image::images/google_60_add-module-dependency.png[] Click OK, then click OK agai
189189
1. Right-click in the Source Editor and choose Fix Imports (Alt+Shift+F). The Fix All Imports dialog displays, listing suggested paths for unrecognized classes:
190190
image::images/google_60_fix-all-imports.png[] Click OK. The IDE creates the following import statements for ``GooglePanel.java`` :
191191

192-
[source,java]
192+
[source,java,subs="macros"]
193193
----
194194
195195
import java.net.URL;
196-
import link:http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlBrowser.URLDisplayer.html[org.openide.awt.HtmlBrowser.URLDisplayer];
196+
import link:http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlBrowser.URLDisplayer.html[org.openide.awt.HtmlBrowser.URLDisplayer];
197197
198198
----
199199

netbeans.apache.org/src/content/tutorials/71/nbm-idioms.asciidoc

Lines changed: 0 additions & 19 deletions
This file was deleted.

netbeans.apache.org/src/content/tutorials/72/nbm-idioms.asciidoc

Lines changed: 0 additions & 19 deletions
This file was deleted.

netbeans.apache.org/src/content/tutorials/73/nbm-idioms.asciidoc

Lines changed: 0 additions & 19 deletions
This file was deleted.

netbeans.apache.org/src/content/tutorials/74/nbm-idioms.asciidoc

Lines changed: 0 additions & 19 deletions
This file was deleted.

netbeans.apache.org/src/content/tutorials/80/nbm-idioms.asciidoc

Lines changed: 0 additions & 19 deletions
This file was deleted.

netbeans.apache.org/src/content/tutorials/nbm-copyfqn.asciidoc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ In this section, we begin using one of the new "Retouche" APIs, called link:htt
207207
[start=1]
208208
1. Fill out the ``actionPerformed`` method by adding the lines highlighted below:
209209

210-
[source,java]
210+
[source,java,subs="macros,quotes"]
211211
----
212212
213213
public void actionPerformed(ActionEvent ev) {
214214
215215
*FileObject fileObject = context.getPrimaryFile();
216216
217-
link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/JavaSource.html[JavaSource] javaSource = link:https://bits.netbeans.org/dev/javadocorg-netbeans-modules-java-source/org/netbeans/api/java/source/JavaSource.html#forFileObject(org.openide.filesystems.FileObject)[JavaSource.forFileObject(fileObject)];
217+
link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/JavaSource.html[JavaSource] javaSource = link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/JavaSource.html#forFileObject-org.openide.filesystems.FileObject-[JavaSource.forFileObject(fileObject)];
218218
if (javaSource == null) {
219219
StatusDisplayer.getDefault().setStatusText("Not a Java file: " + fileObject.getPath());
220220
} else {
@@ -257,10 +257,10 @@ In this section, we are introduced to our first explicitly invoked "Retouche" ta
257257
[start=1]
258258
1. Replace the "Hurray!" message in the ``actionPerformed`` method with this line: link:http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/JavaSource.html#runUserActionTask(org.netbeans.api.java.source.Task,%20boolean)[javaSource.runUserActionTask]
259259

260-
[source,java]
260+
[source,java,subs="verbatim,macros,quotes"]
261261
----
262262
263-
(new link:http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/Task.html[Task]< link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/CompilationController.html[CompilationController]>());
263+
(new link:http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/Task.html[Task]< link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/CompilationController.html[CompilationController]>());
264264
----
265265

266266
You should now see a lightbulb in the editor's left sidebar, as shown here:
@@ -279,7 +279,7 @@ Click the lightbulb in the editor. Alternatively, put the caret in the line and
279279
[start=2]
280280
1. Tweak the generated method slightly, by adding a ``true`` boolean to the end of the method, and letting the IDE wrap the snippet in a try/catch block. At the end, the result should be as follows:
281281

282-
[source,java]
282+
[source,java,subs="verbatim,quotes"]
283283
----
284284
285285
public void actionPerformed(ActionEvent ev) {
@@ -310,15 +310,15 @@ public void actionPerformed(ActionEvent ev) {
310310
[start=3]
311311
1. Implement the ``run()`` method as follows:
312312

313-
[source,java]
313+
[source,java,subs="macros"]
314314
----
315315
316316
@Override
317317
public void run(CompilationController compilationController) throws Exception {
318318
319-
link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/CompilationController.html#toPhase(org.netbeans.api.java.source.JavaSource.Phase)[compilationController.toPhase(Phase.ELEMENTS_RESOLVED)];
319+
link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/CompilationController.html#toPhase(org.netbeans.api.java.source.JavaSource.Phase)[compilationController.toPhase(Phase.ELEMENTS_RESOLVED)];
320320
321-
link:https://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/text/Document.html[Document] document = link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/CompilationController.html#getDocument()[compilationController.getDocument()];
321+
link:https://docs.oracle.com/javase/1.5.0/docs/api/javax/swing/text/Document.html[Document] document = link:https://bits.netbeans.org/dev/javadoc/org-netbeans-modules-java-source/org/netbeans/api/java/source/CompilationController.html#getDocument()[compilationController.getDocument()];
322322
if (document != null) {
323323
StatusDisplayer.getDefault().setStatusText("Hurray, the Java file is open!");
324324
} else {
@@ -370,7 +370,7 @@ In this section, now that we know that we are dealing with a Java file and that
370370
[start=2]
371371
1. Replace the "Hurray!" message in the ``run()`` method with the lines highlighted below:
372372

373-
[source,java]
373+
[source,java,subs="quotes"]
374374
----
375375
376376
public void run(CompilationController compilationController) throws Exception {
@@ -449,7 +449,7 @@ image::images/copyfqn_72_four1.png[]
449449
[start=5]
450450
1. Next, instead of printing all the elements to the Output window, we will only print the element under the caret. Only replace the ``visitClass`` method, with the code highlighted below:
451451

452-
[source,java]
452+
[source,java,subs="quotes"]
453453
----
454454
455455
private class MemberVisitor extends TreePathScanner<Void, Void> {
@@ -509,7 +509,7 @@ image::images/copyfqn_72_four2.png[]
509509
[start=7]
510510
1. But we can detect a lot more than just the name of the element under the caret. In the ``visitClass`` method, replace the lines in bold below:
511511

512-
[source,java]
512+
[source,java,subs="quotes"]
513513
----
514514
515515
@Override

netbeans.apache.org/src/content/tutorials/nbm-crud.asciidoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ public class CustomerChildFactory extends ChildFactory<Customer> {
417417
[start=6]
418418
1. Back in the ``CustomerViewerTopComponent`` , use the ``ExplorerManager`` to pass the result list from the JPA query in to the ``Node`` :
419419

420-
[source,java]
420+
[source,java,subs="quotes"]
421421
----
422422
423423
EntityManager entityManager = Persistence.createEntityManagerFactory("CustomerLibraryPU").createEntityManager();
@@ -500,7 +500,7 @@ In this section, you allow the user to show the currently selected Customer obje
500500
[start=1]
501501
1. Start by tweaking the ``CustomerViewer`` module so that the current ``Customer`` object is added to the viewer window's ``Lookup`` whenever a new ``Node`` is selected. Do this by adding the current ``Customer`` object to the ``Lookup`` of the Node, as follows (note the parts in bold):
502502

503-
[source,java]
503+
[source,java,subs="quotes"]
504504
----
505505
506506
@Override
@@ -744,7 +744,7 @@ When the ``handleSave`` method is invoked, the ``Savable`` is unregistered f
744744
NOTE: All the code below is an inner class within ``CustomerEditorTopComponent`` .
745745

746746

747-
[source,java]
747+
[source,java,subs="macros"]
748748
----
749749
750750
private static final Icon ICON = ImageUtilities.loadImageIcon("org/shop/editor/Icon.png", true);
@@ -1021,7 +1021,7 @@ public void resetFields() {
10211021
[start=2]
10221022
1. In the `` link:http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/netbeans/spi/actions/AbstractSavable.html[AbstractSavable]`` , ensure that a return of ``null`` indicates that a new entry is saved, instead of an existing entry being updated:
10231023

1024-
[source,java]
1024+
[source,java,subs="verbatim,quotes"]
10251025
----
10261026
10271027
@Override

netbeans.apache.org/src/content/tutorials/nbm-emf.asciidoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -338,17 +338,17 @@ The other OSGi-related dependencies you see in the screenshot above were added b
338338
1. Create a new Java class named `LibraryNode`, which provides a new Node for the Library object, as well as a new Node for the Book object and Borrower object:
339339

340340

341-
[source,java]
341+
[source,java,subs="verbatim,macros"]
342342
----
343343
344-
public class LibraryNode extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/AbstractNode.html[AbstractNode] {
344+
public class LibraryNode extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/AbstractNode.html[AbstractNode] {
345345
346346
public LibraryNode(Library library) {
347347
super(Children.create(new BookOrBorrowerChildFactory(library), true));
348348
setDisplayName(library.getName());
349349
}
350350
351-
private static class BookOrBorrowerChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Object> {
351+
private static class BookOrBorrowerChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Object> {
352352
353353
private final Library library;
354354
@@ -371,7 +371,7 @@ public class LibraryNode extends link:http://bits.netbeans.org/dev/javadoc/org-
371371
372372
@Override
373373
protected Node createNodeForKey(Object key) {
374-
link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/BeanNode.html[BeanNode] childNode = null;
374+
link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/BeanNode.html[BeanNode] childNode = null;
375375
try {
376376
childNode = new BeanNode(key);
377377
if (key instanceof Book) {
@@ -399,10 +399,10 @@ link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/Be
399399
1. Create a new Java class named `LibraryChildFactory`, which is a factory class for creating new `LibraryNode`s:
400400

401401

402-
[source,java]
402+
[source,java,subs="verbatim,macros"]
403403
----
404404
405-
public class LibraryChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Library> {
405+
public class LibraryChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Library> {
406406
407407
@Override
408408
protected boolean createKeys(List<Library> list) {
@@ -467,10 +467,10 @@ public class LibraryChildFactory extends link:http://bits.netbeans.org/dev/java
467467
1. Create a new Java class named `LibraryViewer`, which provides the window where the `LibraryNode` will be displayed:
468468

469469

470-
[source,java]
470+
[source,java,subs="macros"]
471471
----
472472
473-
public class LibraryViewer extends link:http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html[TopComponent] implements link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/ExplorerManager.Provider.html[ExplorerManager.Provider] {
473+
public class LibraryViewer extends link:http://bits.netbeans.org/dev/javadoc/org-openide-windows/org/openide/windows/TopComponent.html[TopComponent] implements link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/ExplorerManager.Provider.html[ExplorerManager.Provider] {
474474
475475
private ExplorerManager em = new ExplorerManager();
476476
@@ -480,7 +480,7 @@ public class LibraryViewer extends link:http://bits.netbeans.org/dev/javadoc/or
480480
//Set the layout of the window:
481481
setLayout(new BorderLayout());
482482
//Create a new BeanTreeView:
483-
link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/view/BeanTreeView.html[BeanTreeView] btv = new BeanTreeView();
483+
link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/view/BeanTreeView.html[BeanTreeView] btv = new BeanTreeView();
484484
//Hide the root node:
485485
btv.setRootVisible(false);
486486
//Add the BeanTreeView:

0 commit comments

Comments
 (0)