PY-13986 View -> Open In Browser unavailable for Django projects
authorIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Thu, 4 Dec 2014 18:48:25 +0000 (21:48 +0300)
committerIlya.Kazakevich <Ilya.Kazakevich@jetbrains.com>
Thu, 4 Dec 2014 18:48:25 +0000 (21:48 +0300)
platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/Utils.java
python/openapi/src/com/jetbrains/python/templateLanguages/PythonTemplateLanguage.java
xml/impl/src/com/intellij/ide/browsers/impl/WebBrowserServiceImpl.java
xml/xml-psi-api/src/com/intellij/lang/html/HTMLLanguage.java
xml/xml-psi-api/src/com/intellij/lang/html/HtmlCompatibleLanguage.java [new file with mode: 0644]

index 9af1d30c28bf4e7e7a555dfa7fd4a1f8fd4a35c5..b7e6a185b8b6a31a3aa693199a2a3f6c495f2ebd 100644 (file)
@@ -117,7 +117,9 @@ public class Utils{
       actionManager,
       0
     );
-    if (!doUpdate(group, e, presentation)) return;
+    if (!doUpdate(group, e, presentation)) {
+      return;
+    }
 
     if (!presentation.isVisible()) { // don't process invisible groups
       return;
@@ -136,7 +138,9 @@ public class Utils{
       e1.setInjectedContext(child.isInInjectedContext());
 
       if (transparentOnly && child.isTransparentUpdate() || !transparentOnly) {
-        if (!doUpdate(child, e1, presentation)) continue;
+        if (!doUpdate(child, e1, presentation)) {
+          continue;
+        }
       }
 
       if (!presentation.isVisible() || (!presentation.isEnabled() && hideDisabled)) { // don't create invisible items in the menu
@@ -176,6 +180,7 @@ public class Utils{
         list.add(child);
       }
     }
+    int i = 1;
   }
 
   // returns false if exception was thrown and handled
index 28a7e082ec650517ec9f1067e89cdb8d1a65b559..64c867f6961fcf751e8d9bd4415e5b8bd91f0264 100644 (file)
@@ -1,22 +1,23 @@
 package com.jetbrains.python.templateLanguages;
 
 import com.intellij.lang.Language;
-import com.intellij.openapi.module.Module;
 import com.intellij.psi.templateLanguages.TemplateLanguage;
 import org.jetbrains.annotations.NonNls;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
+ * TODO: Make this class implemeent {@link com.intellij.lang.html.HtmlCompatibleLanguage} to prevent copy/paste by fixing dependencies
  * Python template language
+ *
  * @author Ilya.Kazakevich
  */
 public abstract class PythonTemplateLanguage extends Language implements TemplateLanguage {
 
 
   protected PythonTemplateLanguage(@Nullable final Language baseLanguage,
-                                @NotNull @NonNls final String ID,
-                                @NotNull @NonNls final String... mimeTypes) {
+                                   @NotNull @NonNls final String ID,
+                                   @NotNull @NonNls final String... mimeTypes) {
     super(baseLanguage, ID, mimeTypes);
   }
 
index 3d0451d71b3d75fd71fa2be4ac796b45f88a82c0..723d64bd1193a293d756fe3a438af5db740cf260 100644 (file)
@@ -20,6 +20,7 @@ import com.intellij.ide.browsers.WebBrowserService;
 import com.intellij.ide.browsers.WebBrowserUrlProvider;
 import com.intellij.lang.Language;
 import com.intellij.lang.html.HTMLLanguage;
+import com.intellij.lang.html.HtmlCompatibleLanguage;
 import com.intellij.lang.xhtml.XHTMLLanguage;
 import com.intellij.lang.xml.XMLLanguage;
 import com.intellij.openapi.project.DumbService;
@@ -40,6 +41,9 @@ import java.util.Collections;
 public class WebBrowserServiceImpl extends WebBrowserService {
   public static boolean isHtmlOrXmlFile(@NotNull PsiElement element) {
     Language language = element.getLanguage();
+    if (language instanceof HtmlCompatibleLanguage) {
+      return true;
+    }
     return language == HTMLLanguage.INSTANCE || language == XHTMLLanguage.INSTANCE || language == XMLLanguage.INSTANCE;
   }
 
index b401e7a65496b948b48019dfb8b26858502ec02c..4df6a9be82a7ede6cc68e2cf3f8c989c7e302910 100644 (file)
@@ -20,7 +20,7 @@ import com.intellij.lang.xml.XMLLanguage;
 /**
  * @author max
  */
-public class HTMLLanguage extends XMLLanguage {
+public class HTMLLanguage extends XMLLanguage implements HtmlCompatibleLanguage {
 
   public static final HTMLLanguage INSTANCE = new HTMLLanguage();
 
diff --git a/xml/xml-psi-api/src/com/intellij/lang/html/HtmlCompatibleLanguage.java b/xml/xml-psi-api/src/com/intellij/lang/html/HtmlCompatibleLanguage.java
new file mode 100644 (file)
index 0000000..77aaf44
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.lang.html;
+
+/**
+ * Language that is based on HTML (like some template languages)
+ * @author Ilya.Kazakevich
+ */
+public interface HtmlCompatibleLanguage {
+}