Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a few code block rewrite to get it pretty #611

Merged
merged 1 commit into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ image::images/google_60_add-module-dependency.png[] Click OK, then click OK agai
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:
image::images/google_60_fix-all-imports.png[] Click OK. The IDE creates the following import statements for ``GooglePanel.java`` :

[source,java]
[source,java,subs="macros"]
----

import java.net.URL;
import link:http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlBrowser.URLDisplayer.html[org.openide.awt.HtmlBrowser.URLDisplayer];
import link:http://bits.netbeans.org/dev/javadoc/org-openide-awt/org/openide/awt/HtmlBrowser.URLDisplayer.html[org.openide.awt.HtmlBrowser.URLDisplayer];

----

Expand Down
19 changes: 0 additions & 19 deletions netbeans.apache.org/src/content/tutorials/71/nbm-idioms.asciidoc

This file was deleted.

19 changes: 0 additions & 19 deletions netbeans.apache.org/src/content/tutorials/72/nbm-idioms.asciidoc

This file was deleted.

19 changes: 0 additions & 19 deletions netbeans.apache.org/src/content/tutorials/73/nbm-idioms.asciidoc

This file was deleted.

19 changes: 0 additions & 19 deletions netbeans.apache.org/src/content/tutorials/74/nbm-idioms.asciidoc

This file was deleted.

19 changes: 0 additions & 19 deletions netbeans.apache.org/src/content/tutorials/80/nbm-idioms.asciidoc

This file was deleted.

22 changes: 11 additions & 11 deletions netbeans.apache.org/src/content/tutorials/nbm-copyfqn.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ In this section, we begin using one of the new "Retouche" APIs, called link:htt
[start=1]
1. Fill out the ``actionPerformed`` method by adding the lines highlighted below:

[source,java]
[source,java,subs="macros,quotes"]
----

public void actionPerformed(ActionEvent ev) {

*FileObject fileObject = context.getPrimaryFile();

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)];
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)];
if (javaSource == null) {
StatusDisplayer.getDefault().setStatusText("Not a Java file: " + fileObject.getPath());
} else {
Expand Down Expand Up @@ -257,10 +257,10 @@ In this section, we are introduced to our first explicitly invoked "Retouche" ta
[start=1]
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]

[source,java]
[source,java,subs="verbatim,macros,quotes"]
----

(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]>());
(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]>());
----

You should now see a lightbulb in the editor's left sidebar, as shown here:
Expand All @@ -279,7 +279,7 @@ Click the lightbulb in the editor. Alternatively, put the caret in the line and
[start=2]
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:

[source,java]
[source,java,subs="verbatim,quotes"]
----

public void actionPerformed(ActionEvent ev) {
Expand Down Expand Up @@ -310,15 +310,15 @@ public void actionPerformed(ActionEvent ev) {
[start=3]
1. Implement the ``run()`` method as follows:

[source,java]
[source,java,subs="macros"]
----

@Override
public void run(CompilationController compilationController) throws Exception {

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)];
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)];

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()];
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()];
if (document != null) {
StatusDisplayer.getDefault().setStatusText("Hurray, the Java file is open!");
} else {
Expand Down Expand Up @@ -370,7 +370,7 @@ In this section, now that we know that we are dealing with a Java file and that
[start=2]
1. Replace the "Hurray!" message in the ``run()`` method with the lines highlighted below:

[source,java]
[source,java,subs="quotes"]
----

public void run(CompilationController compilationController) throws Exception {
Expand Down Expand Up @@ -449,7 +449,7 @@ image::images/copyfqn_72_four1.png[]
[start=5]
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:

[source,java]
[source,java,subs="quotes"]
----

private class MemberVisitor extends TreePathScanner<Void, Void> {
Expand Down Expand Up @@ -509,7 +509,7 @@ image::images/copyfqn_72_four2.png[]
[start=7]
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:

[source,java]
[source,java,subs="quotes"]
----

@Override
Expand Down
8 changes: 4 additions & 4 deletions netbeans.apache.org/src/content/tutorials/nbm-crud.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ public class CustomerChildFactory extends ChildFactory<Customer> {
[start=6]
1. Back in the ``CustomerViewerTopComponent`` , use the ``ExplorerManager`` to pass the result list from the JPA query in to the ``Node`` :

[source,java]
[source,java,subs="quotes"]
----

EntityManager entityManager = Persistence.createEntityManagerFactory("CustomerLibraryPU").createEntityManager();
Expand Down Expand Up @@ -500,7 +500,7 @@ In this section, you allow the user to show the currently selected Customer obje
[start=1]
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):

[source,java]
[source,java,subs="quotes"]
----

@Override
Expand Down Expand Up @@ -744,7 +744,7 @@ When the ``handleSave`` method is invoked, the ``Savable`` is unregistered f
NOTE: All the code below is an inner class within ``CustomerEditorTopComponent`` .


[source,java]
[source,java,subs="macros"]
----

private static final Icon ICON = ImageUtilities.loadImageIcon("org/shop/editor/Icon.png", true);
Expand Down Expand Up @@ -1021,7 +1021,7 @@ public void resetFields() {
[start=2]
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:

[source,java]
[source,java,subs="verbatim,quotes"]
----

@Override
Expand Down
18 changes: 9 additions & 9 deletions netbeans.apache.org/src/content/tutorials/nbm-emf.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,17 @@ The other OSGi-related dependencies you see in the screenshot above were added b
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:


[source,java]
[source,java,subs="verbatim,macros"]
----

public class LibraryNode extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/AbstractNode.html[AbstractNode] {
public class LibraryNode extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/AbstractNode.html[AbstractNode] {

public LibraryNode(Library library) {
super(Children.create(new BookOrBorrowerChildFactory(library), true));
setDisplayName(library.getName());
}

private static class BookOrBorrowerChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Object> {
private static class BookOrBorrowerChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Object> {

private final Library library;

Expand All @@ -371,7 +371,7 @@ public class LibraryNode extends link:http://bits.netbeans.org/dev/javadoc/org-

@Override
protected Node createNodeForKey(Object key) {
link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/BeanNode.html[BeanNode] childNode = null;
link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/BeanNode.html[BeanNode] childNode = null;
try {
childNode = new BeanNode(key);
if (key instanceof Book) {
Expand Down Expand Up @@ -399,10 +399,10 @@ link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/Be
1. Create a new Java class named `LibraryChildFactory`, which is a factory class for creating new `LibraryNode`s:


[source,java]
[source,java,subs="verbatim,macros"]
----

public class LibraryChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Library> {
public class LibraryChildFactory extends link:http://bits.netbeans.org/dev/javadoc/org-openide-nodes/org/openide/nodes/ChildFactory.html[ChildFactory]<Library> {

@Override
protected boolean createKeys(List<Library> list) {
Expand Down Expand Up @@ -467,10 +467,10 @@ public class LibraryChildFactory extends link:http://bits.netbeans.org/dev/java
1. Create a new Java class named `LibraryViewer`, which provides the window where the `LibraryNode` will be displayed:


[source,java]
[source,java,subs="macros"]
----

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] {
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] {

private ExplorerManager em = new ExplorerManager();

Expand All @@ -480,7 +480,7 @@ public class LibraryViewer extends link:http://bits.netbeans.org/dev/javadoc/or
//Set the layout of the window:
setLayout(new BorderLayout());
//Create a new BeanTreeView:
link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/view/BeanTreeView.html[BeanTreeView] btv = new BeanTreeView();
link:http://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/view/BeanTreeView.html[BeanTreeView] btv = new BeanTreeView();
//Hide the root node:
btv.setRootVisible(false);
//Add the BeanTreeView:
Expand Down
Loading