diff --git a/tomcat5/nbproject/project.xml b/tomcat5/nbproject/project.xml
--- a/tomcat5/nbproject/project.xml
+++ b/tomcat5/nbproject/project.xml
@@ -92,6 +92,15 @@
+ org.netbeans.core.multiview
+
+
+
+ 1
+ 1.26
+
+
+
org.netbeans.libs.xerces
diff --git a/tomcat5/src/org/netbeans/modules/tomcat5/nodes/Bundle.properties b/tomcat5/src/org/netbeans/modules/tomcat5/nodes/Bundle.properties
--- a/tomcat5/src/org/netbeans/modules/tomcat5/nodes/Bundle.properties
+++ b/tomcat5/src/org/netbeans/modules/tomcat5/nodes/Bundle.properties
@@ -50,3 +50,4 @@
MSG_AuthorizationFailed=Access to Tomcat server has not been authorized. Set the \
correct username and password with the \"{0}\" role in the Tomcat customizer \
in the Server Manager.
+CTL_SourceTabCaption=Source
diff --git a/tomcat5/src/org/netbeans/modules/tomcat5/nodes/TomcatInstanceNode.java b/tomcat5/src/org/netbeans/modules/tomcat5/nodes/TomcatInstanceNode.java
--- a/tomcat5/src/org/netbeans/modules/tomcat5/nodes/TomcatInstanceNode.java
+++ b/tomcat5/src/org/netbeans/modules/tomcat5/nodes/TomcatInstanceNode.java
@@ -48,6 +48,8 @@
import java.util.LinkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
+import org.netbeans.core.spi.multiview.MultiViewElement;
+import org.netbeans.core.spi.multiview.text.MultiViewEditorElement;
import org.netbeans.modules.tomcat5.TomcatManager;
import org.netbeans.modules.tomcat5.nodes.actions.AdminConsoleAction;
import org.netbeans.modules.tomcat5.nodes.actions.ServerLogAction;
@@ -69,6 +71,7 @@
import org.openide.nodes.AbstractNode;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
+import org.openide.windows.TopComponent;
/**
@@ -177,4 +180,23 @@
public boolean hasServerLog() {
return tm.logManager().hasServerLog();
}
+
+ /**
+ * Overrides the compatible XML DO behaviour for files without data objects
+ * @param context
+ * @return
+ */
+ @MultiViewElement.Registration(
+ displayName="org.netbeans.modules.tomcat5.nodes.Bundle#CTL_SourceTabCaption",
+ iconBase="org/netbeans/modules/tomcat5/resources/tomcat5.gif",
+ persistenceType=TopComponent.PERSISTENCE_ONLY_OPENED,
+ preferredID="xml.text",
+ mimeType="text/tomcat5+xml",
+ position=1
+ )
+ public static MultiViewEditorElement createMultiViewEditorElement(Lookup context) {
+ return new MultiViewEditorElement(context);
+ }
+
+
}
diff --git a/xml/nbproject/project.xml b/xml/nbproject/project.xml
--- a/xml/nbproject/project.xml
+++ b/xml/nbproject/project.xml
@@ -77,6 +77,15 @@
+ org.netbeans.modules.editor.mimelookup
+
+
+
+ 1
+ 1.24
+
+
+
org.netbeans.modules.projectapi
diff --git a/xml/src/org/netbeans/modules/xml/text/TextEditorSupport.java b/xml/src/org/netbeans/modules/xml/text/TextEditorSupport.java
--- a/xml/src/org/netbeans/modules/xml/text/TextEditorSupport.java
+++ b/xml/src/org/netbeans/modules/xml/text/TextEditorSupport.java
@@ -45,16 +45,18 @@
import org.netbeans.modules.xml.util.Util;
import java.io.*;
-import java.text.*;
import java.util.Enumeration;
import java.lang.ref.WeakReference;
import java.beans.PropertyChangeEvent;
+import java.util.Collection;
import javax.swing.Timer;
import javax.swing.event.*;
import javax.swing.text.*;
+import org.netbeans.api.editor.mimelookup.MimeLookup;
import org.netbeans.core.api.multiview.MultiViews;
+import org.netbeans.core.spi.multiview.MultiViewDescription;
import org.netbeans.modules.xml.api.EncodingUtil;
import org.openide.*;
import org.openide.awt.StatusDisplayer;
@@ -69,7 +71,7 @@
import org.openide.filesystems.FileLock;
import org.netbeans.modules.xml.*;
-import org.netbeans.modules.xml.lib.*;
+import org.netbeans.modules.xml.XMLDataObject;
import org.netbeans.modules.xml.sync.*;
import org.netbeans.modules.xml.cookies.*;
import org.netbeans.modules.xml.text.syntax.XMLKit;
@@ -154,10 +156,34 @@
@Override
protected Pane createPane() {
+ // defect #202766: whatever+xml gets multiview, although there is nobody
+ // who would register the editor. M
+ if (getDataObject().getClass() == XMLDataObject.class &&
+ !mimeType.equals(XMLDataObject.MIME_PLAIN_XML) &&
+ !hasMultiTextEditor()) {
+ return super.createCloneableEditor();
+ }
return (CloneableEditorSupport.Pane)MultiViews.createCloneableMultiView(mimeType,
getDataObject());
}
+ /**
+ * Detects whether XML source editor is registered: must start with 'xml.text'. If
+ * a module registers such multiview, it's responsible for displaying source in this
+ * pane.
+ *
+ * @return true, if multiview source editor is available and multiview pane should be created
+ */
+ boolean hasMultiTextEditor() {
+ Collection extends MultiViewDescription> all = MimeLookup.getLookup(mimeType).lookupAll(MultiViewDescription.class);
+ for (MultiViewDescription d : all) {
+ if (d.preferredID().startsWith("xml.text")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/*
* Add listeners at Document and document memory status (loading).
*/