Re: Use MultiView APIs
geertjan wielenga <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.modules.openide.devel |
|---|---|
| Organization | Oracle Corporation |
| Message-ID | <[email protected]> |
https://blogs.oracle.com/geertjan/entry/empty_node_populated_on_the The above would be how to do it. I've made a start here: https://github.com/GeertjanWielenga/NetApacheSyncopeBeans/tree/master/NASB See attached screenshot. Doesn't work yet completely, though it's a start. Gj On 14-7-2016 23:34, geertjan wielenga wrote: > > On 14-7-2016 22:05, Nuwan Sameera wrote: >> Hi, >> >> Now I understand what you say. :) Thank you very much to move me to >> correct way. >> >> But, finally I can faced same problem with open multiview. How I open >> separate tabs in same editor component ? > > You're not going to be able to do what you want while you have a > JTree. You can write back and forth but the answer will be the same. > > Take a look at the Services window (Ctrl-5). What you should be trying > to create is actually a new top level node in the Services window, not > a new TopComponent from the Window menu. > > Gj > >> Given Mail Templates and Report Templates have many types called >> HTML, TEXT etc. I need open these types in tabs after double clicking >> given element. >> >> How I do this? Please help me for this. Am I wrong way. Give me >> better way to do this. >> >> Regards, >> Nuwan Sameera. >> >> On Fri, Jul 15, 2016 at 1:16 AM, geertjan wielenga >> <[email protected] <mailto:[email protected]>> >> wrote: >> >> >> You're not going to be able to do what you want while you have a >> JTree. You can write back and forth but the answer will be the same. >> >> Take a look at the Services window (Ctrl-5). What you should be >> trying to create is actually a new top level node in the Services >> window, not a new TopComponent from the Window menu. >> >> Gj >> >> >> On 14-7-2016 21:44, Nuwan Sameera wrote: >>> >>> Hi, >>> >>> Thank you. I undeatand about useage about Nodes. I will use it. >>> >>> But I don't undestand "don't use seperate TopCompinent,instead >>> ectend the Services window" >>> >>> Also how I resolve my issue. How I open multi view with text editor. >>> >>> Regards, >>> Nuwan Sameera. >>> >>> On 15 Jul 2016 12:58 a.m., "geertjan wielenga" >>> <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> >>> >>> Please, move to the Nodes API from your JTree. Once you have >>> Nodes, you'll have many other useful features too. Plus, I >>> recommend that you don't use a separate TopComponent, >>> instead extend the Services window: >>> >>> http://bits.netbeans.org/dev/javadoc/org-netbeans-core-ide/org/netbeans/api/core/ide/ServicesTabNodeRegistration.html >>> >>> Example: >>> >>> https://blogs.oracle.com/geertjan/entry/servicestabnoderegistration >>> >>> Gj >>> >>> >>> On 14-7-2016 21:22, Nuwan Sameera wrote: >>>> Hi, >>>> >>>> Thank you for the support. >>>> >>>> Yes problem occurred line 508. But problem is not >>>> DefaultMutableTreeNode. Because without multiview it works >>>> fine. >>>> >>>> We need to provide Lookup object with >>>> CloneableEditorSupport instance instead Lookup.EMPTY. I >>>> this this is the problem. >>>> >>>> Regards, >>>> Nuwan Sameera. >>>> >>>> >>>> On Fri, Jul 15, 2016 at 12:37 AM, geertjan wielenga >>>> <[email protected] >>>> <mailto:[email protected]>> wrote: >>>> >>>> >>>> The stacktrace is much more detailed to what you provided: >>>> >>>> java.lang.IllegalArgumentException: We expect >>>> CloneableEditorSupport in >>>> org.openide.util.Lookup$Empty@cce1139 >>>> at >>>> org.netbeans.core.spi.multiview.text.MultiViewEditorElement.<init>(MultiViewEditorElement.java:97) >>>> at >>>> org.apache.syncope.netbeans.plugin.view.ResourceExplorerTopComponent$7.createElement(ResourceExplorerTopComponent.java:508) >>>> at >>>> org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:222) >>>> at >>>> org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:132) >>>> at >>>> org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:128) >>>> at >>>> org.netbeans.core.multiview.MultiViewPeer.assignLookup(MultiViewPeer.java:261) >>>> at >>>> org.netbeans.core.multiview.MultiViewTopComponent.getLookup(MultiViewTopComponent.java:117) >>>> at >>>> org.netbeans.modules.localhistory.LocalHistory$OpenedFilesListener.handleTCFiles(LocalHistory.java:535) >>>> at >>>> org.netbeans.modules.localhistory.LocalHistory$OpenedFilesListener.propertyChange(LocalHistory.java:464) >>>> at >>>> java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335) >>>> at >>>> java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327) >>>> at >>>> java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263) >>>> at >>>> org.netbeans.core.windows.RegistryImpl.doFirePropertyChange(RegistryImpl.java:329) >>>> at >>>> org.netbeans.core.windows.RegistryImpl.topComponentOpened(RegistryImpl.java:187) >>>> at >>>> org.netbeans.core.windows.WindowManagerImpl.notifyRegistryTopComponentOpened(WindowManagerImpl.java:1183) >>>> at >>>> org.netbeans.core.windows.WindowManagerImpl.notifyTopComponentOpened(WindowManagerImpl.java:1151) >>>> at >>>> org.netbeans.core.windows.Central.addModeOpenedTopComponent(Central.java:798) >>>> at >>>> org.netbeans.core.windows.ModeImpl.addOpenedTopComponent(ModeImpl.java:354) >>>> at >>>> org.netbeans.core.windows.WindowManagerImpl.topComponentOpenAtTabPosition(WindowManagerImpl.java:1261) >>>> at >>>> org.netbeans.core.windows.WindowManagerImpl.topComponentOpen(WindowManagerImpl.java:1226) >>>> at >>>> org.openide.windows.TopComponent.open(TopComponent.java:497) >>>> at >>>> org.openide.windows.TopComponent.open(TopComponent.java:477) >>>> at >>>> org.apache.syncope.netbeans.plugin.view.ResourceExplorerTopComponent.openMailEditor(ResourceExplorerTopComponent.java:580) >>>> at >>>> org.apache.syncope.netbeans.plugin.view.ResourceExplorerTopComponent.resourceExplorerTreeMouseClicked(ResourceExplorerTopComponent.java:170) >>>> at >>>> org.apache.syncope.netbeans.plugin.view.ResourceExplorerTopComponent.access$000(ResourceExplorerTopComponent.java:98) >>>> at >>>> org.apache.syncope.netbeans.plugin.view.ResourceExplorerTopComponent$1.mouseClicked(ResourceExplorerTopComponent.java:143) >>>> at >>>> java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270) >>>> at >>>> java.awt.Component.processMouseEvent(Component.java:6528) >>>> at >>>> javax.swing.JComponent.processMouseEvent(JComponent.java:3321) >>>> at java.awt.Component.processEvent(Component.java:6290) >>>> at java.awt.Container.processEvent(Container.java:2234) >>>> at >>>> java.awt.Component.dispatchEventImpl(Component.java:4881) >>>> at >>>> java.awt.Container.dispatchEventImpl(Container.java:2292) >>>> at >>>> java.awt.Component.dispatchEvent(Component.java:4703) >>>> at >>>> java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898) >>>> at >>>> java.awt.LightweightDispatcher.processMouseEvent(Container.java:4542) >>>> at >>>> java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462) >>>> at >>>> java.awt.Container.dispatchEventImpl(Container.java:2278) >>>> at java.awt.Window.dispatchEventImpl(Window.java:2739) >>>> at >>>> java.awt.Component.dispatchEvent(Component.java:4703) >>>> at >>>> java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746) >>>> at java.awt.EventQueue.access$400(EventQueue.java:97) >>>> at java.awt.EventQueue$3.run(EventQueue.java:697) >>>> at java.awt.EventQueue$3.run(EventQueue.java:691) >>>> at >>>> java.security.AccessController.doPrivileged(Native Method) >>>> at >>>> java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) >>>> at >>>> java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86) >>>> at java.awt.EventQueue$4.run(EventQueue.java:719) >>>> at java.awt.EventQueue$4.run(EventQueue.java:717) >>>> at >>>> java.security.AccessController.doPrivileged(Native Method) >>>> at >>>> java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75) >>>> at >>>> java.awt.EventQueue.dispatchEvent(EventQueue.java:716) >>>> at >>>> org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159) >>>> [catch] at >>>> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) >>>> at >>>> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) >>>> at >>>> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) >>>> at >>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) >>>> at >>>> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) >>>> at >>>> java.awt.EventDispatchThread.run(EventDispatchThread.java:82) >>>> >>>> >>>> Here's what I see at line 508, which is the line shown >>>> above as being problematic: >>>> >>>> @Override >>>> public MultiViewElement createElement() { >>>> return new >>>> MultiViewEditorElement(Lookup.EMPTY); >>>> } >>>> >>>> That looks quite suspicious. >>>> >>>> I'd suggest you start by rewriting your code to use >>>> Nodes instead of DefaultMutableTreeNode, etc. >>>> >>>> I.e., rewrite your JTree to use Nodes instead: >>>> >>>> https://platform.netbeans.org/tutorials/nbm-nodesapi2.html >>>> >>>> Gj >>>> >>>> >>>> >>>> On 14-7-2016 20:55, Nuwan Sameera wrote: >>>>> Hi, >>>>> >>>>> After run the project, >>>>> >>>>> Go *Window-> Apache Syncope >>>>> >>>>> * >>>>> Enter following details, >>>>> >>>>> *Server URL - >>>>> http://syncope-vm.apache.org:9080/syncope/rest >>>>> User Name - admin >>>>> Password - password* >>>>> >>>>> Then go to tree in left side called Apache Syncope and >>>>> expand it. >>>>> >>>>> Expand *Mail Templates*. >>>>> >>>>> *Double click any element - Use First Element*. >>>>> >>>>> Then show different tabs saying "*Test 1 , Test 2, >>>>> Test 3*". But nothing open editor pane and given >>>>> runtime error. >>>>> >>>>> I think you can reproduce issue. >>>>> >>>>> Thanks and Regards, >>>>> Nuwan Samaeera. >>>>> >>>>> On Fri, Jul 15, 2016 at 12:14 AM, geertjan wielenga >>>>> <[email protected] >>>>> <mailto:[email protected]>> wrote: >>>>> >>>>> >>>>> >>>>> Well, you're going to need to provide a lot of >>>>> information -- otherwise I can't help. >>>>> >>>>> What must I do to see the problem myself? When I >>>>> open the window, I am asked for a user and >>>>> password and various things -- I don't know what >>>>> to fill in there, so I cannot reproduce the problem. >>>>> >>>>> Pretend you're me and provide the info I need, >>>>> assuming that I know nothing at all about your >>>>> problem, up to the point where I can actually see >>>>> the problem myself. >>>>> >>>>> Gj >>>>> >>>>> >>>>> >>>>> >>>>> On 14-7-2016 20:40, Nuwan Sameera wrote: >>>>>> Hi, >>>>>> >>>>>> I tried with this change. But same error >>>>>> occurred. How I change 505. Error given from that >>>>>> line. >>>>>> >>>>>> Thanks and Regards, >>>>>> Nuwan Sameera >>>>>> >>>>>> On Thu, Jul 14, 2016 at 11:59 PM, geertjan >>>>>> wielenga <[email protected] >>>>>> <mailto:[email protected]>> wrote: >>>>>> >>>>>> >>>>>> Possibly this is all you need -- change the >>>>>> class signature to this: >>>>>> >>>>>> public final class >>>>>> ResourceExplorerTopComponent extends >>>>>> CloneableTopComponent >>>>>> >>>>>> Gj >>>>>> >>>>>> >>>>>> On 14-7-2016 20:11, Nuwan Sameera wrote: >>>>>>> Hi, >>>>>>> >>>>>>> Thank you. My source codes available in [1] >>>>>>> >>>>>>> [1] >>>>>>> https://github.com/NuwanSameera/syncope/blob/master/netbeans-plugin/src/main/java/org/apache/syncope/netbeans/plugin/view/ResourceExplorerTopComponent.java >>>>>>> >>>>>>> Line 479 - 581 >>>>>>> >>>>>>> Please check and support to solve issue. >>>>>>> >>>>>>> I need to open empty editor and editor with >>>>>>> content. >>>>>>> >>>>>>> Regards, >>>>>>> Nuwan Sameera. >>>>>>> >>>>>>> >>>>>>> On Thu, Jul 14, 2016 at 11:27 PM, geertjan >>>>>>> wielenga <[email protected] >>>>>>> <mailto:[email protected]>> wrote: >>>>>>> >>>>>>> >>>>>>> Is the source code on GitHub or >>>>>>> somewhere like that? Would be happy to >>>>>>> help you, but need more context than the >>>>>>> below, i.e., ideally the full source code. >>>>>>> >>>>>>> Gj >>>>>>> >>>>>>> >>>>>>> On 14-7-2016 19:30, Nuwan Sameera wrote: >>>>>>>> Hi all, >>>>>>>> >>>>>>>> I am developing netbeans plugin for >>>>>>>> apache syncope. I need to open editors >>>>>>>> in different tabs in same instance like >>>>>>>> SOURCE and HISTORY. I am tried to using >>>>>>>> following code. >>>>>>>> >>>>>>>> MultiViewDescription[] descriptionArray >>>>>>>> = new MultiViewDescription[0]; >>>>>>>> descriptionArray[0] = new >>>>>>>> MultiViewDescription() { >>>>>>>> @Override >>>>>>>> public int getPersistenceType() { >>>>>>>> return 0; >>>>>>>> } >>>>>>>> >>>>>>>> @Override >>>>>>>> public String getDisplayName() { >>>>>>>> return "Test 1"; >>>>>>>> } >>>>>>>> >>>>>>>> @Override >>>>>>>> public Image getIcon() { >>>>>>>> return null; >>>>>>>> } >>>>>>>> >>>>>>>> @Override >>>>>>>> public HelpCtx getHelpCtx() { >>>>>>>> return null; >>>>>>>> } >>>>>>>> >>>>>>>> @Override >>>>>>>> public String preferredID() { >>>>>>>> return "A"; >>>>>>>> } >>>>>>>> >>>>>>>> @Override >>>>>>>> public MultiViewElement createElement() { >>>>>>>> return new >>>>>>>> MultiViewEditorElement(Lookup.EMPTY); >>>>>>>> *//GIVEN RUNTIME ERROR >>>>>>>> * >>>>>>>> } >>>>>>>> }; >>>>>>>> >>>>>>>> TopComponent ctc = >>>>>>>> MultiViewFactory.createMultiView(descriptionArray, >>>>>>>> descriptionArray[0]); >>>>>>>> ctc.open(); >>>>>>>> ctc.requestActive(); >>>>>>>> >>>>>>>> *//GIVEN RUNTIME ERROR Line give >>>>>>>> *|IllegalArgumentException >>>>>>>> <http://download.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true> >>>>>>>> saying |||CloneableEditorSupport| >>>>>>>> <http://bits.netbeans.org/8.0/javadoc/org-openide-text/org/openide/text/CloneableEditorSupport.html?is-external=true> >>>>>>>> is not present in provided |Lookup| >>>>>>>> <http://bits.netbeans.org/8.0/javadoc/org-openide-util/org/openide/util/Lookup.html?is-external=true>. >>>>>>>> >>>>>>>> | >>>>>>>> |I search method to create Lookup >>>>>>>> object with ClonableEditorSupport. I >>>>>>>> don't found suitable solution. >>>>>>>> >>>>>>>> | >>>>>>>> |Please help me. >>>>>>>> >>>>>>>> | >>>>>>>> |Thanks and Regards. | >>>>>>>> -- >>>>>>>> Nuwan Sameera. >>>>>>>> Undergraduate, >>>>>>>> Electronic and Telecommunication >>>>>>>> Engineering, >>>>>>>> University of Moratuwa. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Nuwan Sameera. >>>>>>> Undergraduate, >>>>>>> Electronic and Telecommunication Engineering, >>>>>>> University of Moratuwa. >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> Nuwan Sameera. >>>>>> Undergraduate, >>>>>> Electronic and Telecommunication Engineering, >>>>>> University of Moratuwa. >>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Nuwan Sameera. >>>>> Undergraduate, >>>>> Electronic and Telecommunication Engineering, >>>>> University of Moratuwa. >>>> >>>> >>>> >>>> >>>> -- >>>> Nuwan Sameera. >>>> Undergraduate, >>>> Electronic and Telecommunication Engineering, >>>> University of Moratuwa. >>> >> >> >> >> >> -- >> Nuwan Sameera. >> Undergraduate, >> Electronic and Telecommunication Engineering, >> University of Moratuwa. >
syncope-1.png
(image/png, 9.7 KB) - not displayed