1 /*
2 * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
107 }
108
109 private void initReceivers() {
110
111 final GroupCallback callback = new GroupCallback() {
112
113 @Override
114 public void started(Group g) {
115 synchronized(OutlineTopComponent.this) {
116 getDocument().addElement(g);
117 }
118 }
119 };
120
121 server = new Server(getDocument(), callback, false);
122 binaryServer = new Server(getDocument(), callback, true);
123 }
124
125 public void clear() {
126 document.clear();
127 }
128
129 @Override
130 public ExplorerManager getExplorerManager() {
131 return manager;
132 }
133
134 public GraphDocument getDocument() {
135 return document;
136 }
137
138 /**
139 * Gets default instance. Do not use directly: reserved for *.settings files only,
140 * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
141 * To obtain the singleton instance, use {@link findInstance}.
142 */
143 public static synchronized OutlineTopComponent getDefault() {
144 if (instance == null) {
145 instance = new OutlineTopComponent();
146 }
|
1 /*
2 * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
107 }
108
109 private void initReceivers() {
110
111 final GroupCallback callback = new GroupCallback() {
112
113 @Override
114 public void started(Group g) {
115 synchronized(OutlineTopComponent.this) {
116 getDocument().addElement(g);
117 }
118 }
119 };
120
121 server = new Server(getDocument(), callback, false);
122 binaryServer = new Server(getDocument(), callback, true);
123 }
124
125 public void clear() {
126 document.clear();
127 root = new FolderNode(document);
128 manager.setRootContext(root);
129 }
130
131 @Override
132 public ExplorerManager getExplorerManager() {
133 return manager;
134 }
135
136 public GraphDocument getDocument() {
137 return document;
138 }
139
140 /**
141 * Gets default instance. Do not use directly: reserved for *.settings files only,
142 * i.e. deserialization routines; otherwise you could get a non-deserialized instance.
143 * To obtain the singleton instance, use {@link findInstance}.
144 */
145 public static synchronized OutlineTopComponent getDefault() {
146 if (instance == null) {
147 instance = new OutlineTopComponent();
148 }
|