? src/org/netbeans/core/spi/multiview/SourceViewMarker.java Index: manifest.mf =================================================================== RCS file: /cvs/core/multiview/manifest.mf,v retrieving revision 1.12 diff -u -r1.12 manifest.mf --- manifest.mf 7 Aug 2007 22:42:04 -0000 1.12 +++ manifest.mf 11 Sep 2007 08:08:42 -0000 @@ -1,6 +1,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.core.multiview/1 -OpenIDE-Module-Specification-Version: 1.9 +OpenIDE-Module-Specification-Version: 1.10 OpenIDE-Module-Localizing-Bundle: org/netbeans/core/multiview/resources/Bundle.properties OpenIDE-Module-Layer: org/netbeans/core/multiview/resources/mf-layer.xml AutoUpdate-Essential-Module: true Index: api/doc/changes/apichanges.xml =================================================================== RCS file: /cvs/core/multiview/api/doc/changes/apichanges.xml,v retrieving revision 1.5 diff -u -r1.5 apichanges.xml --- api/doc/changes/apichanges.xml 1 Jul 2006 08:51:41 -0000 1.5 +++ api/doc/changes/apichanges.xml 11 Sep 2007 08:08:42 -0000 @@ -85,6 +85,21 @@ + Added marker interface SourceViewMarker to identify elements with sourcecode. + + + + + +Adding a marker interface for MultiViewDescription instances that allows to identify them + as containing source code. The associated MultiViewElement's visual representation + is assumed to implement CloneableEditorSupport.Pane interface. + + + + + + Added factory methods to create multiview component Index: src/org/netbeans/core/multiview/MultiViewCloneableTopComponent.java =================================================================== RCS file: /cvs/core/multiview/src/org/netbeans/core/multiview/MultiViewCloneableTopComponent.java,v retrieving revision 1.17 diff -u -r1.17 MultiViewCloneableTopComponent.java --- src/org/netbeans/core/multiview/MultiViewCloneableTopComponent.java 22 Aug 2007 06:03:53 -0000 1.17 +++ src/org/netbeans/core/multiview/MultiViewCloneableTopComponent.java 11 Sep 2007 08:08:42 -0000 @@ -23,6 +23,8 @@ import java.util.Collection; import java.util.Iterator; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.Action; import javax.swing.SwingUtilities; import org.netbeans.core.multiview.MultiViewModel.ActionRequestObserverFactory; @@ -30,6 +32,7 @@ import org.netbeans.core.spi.multiview.MultiViewDescription; import org.netbeans.core.spi.multiview.MultiViewElement; import org.netbeans.core.spi.multiview.MultiViewElementCallback; +import org.netbeans.core.spi.multiview.SourceViewMarker; import org.openide.awt.UndoRedo; import org.openide.text.CloneableEditorSupport; import org.openide.util.HelpCtx; @@ -218,6 +221,20 @@ // fingers crossed and hope for the best... could result in bad results once // we have multiple editors in the multiview component. return el; + } + } + + MultiViewDescription[] descs = peer.model.getDescriptions(); + for (MultiViewDescription desc : descs) { + if (desc instanceof SourceViewMarker) { + peer.tabs.changeVisibleManually(desc); + el = peer.model.getActiveElement(); + if (el.getVisualRepresentation() instanceof CloneableEditorSupport.Pane) { + return el; + } else { + Logger.getLogger(getClass().getName()).info("MultiViewDescription " + desc.getDisplayName() + "(" + desc.getClass() + + ") claimed to contain sources, but it's MutliViewElement.getVisualRepresentation() didn't return a valid CloeanbleEditorSupport.Pane instance."); + } } } // hopeless case, don't try to create new elements. it's users responsibility to