mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 21:11:28 +07:00
javafx: relayout to support css in ultimate only
This commit is contained in:
1
.idea/modules.xml
generated
1
.idea/modules.xml
generated
@@ -74,6 +74,7 @@
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-runtime/java-runtime.iml" filepath="$PROJECT_DIR$/java/java-runtime/java-runtime.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/java-tests/java-tests.iml" filepath="$PROJECT_DIR$/java/java-tests/java-tests.iml" group="java" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/javaFX/javaFX.iml" filepath="$PROJECT_DIR$/plugins/javaFX/javaFX.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/javaFX/javaFX-CE/javaFX-CE.iml" filepath="$PROJECT_DIR$/plugins/javaFX/javaFX-CE/javaFX-CE.iml" group="community/plugins" />
|
||||
<module fileurl="file://$PROJECT_DIR$/java/compiler/javac2/javac2.iml" filepath="$PROJECT_DIR$/java/compiler/javac2/javac2.iml" group="java/compiler" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" filepath="$PROJECT_DIR$/plugins/cvs/javacvs-src/javacvs-src.iml" group="plugins/VCS/cvs" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" filepath="$PROJECT_DIR$/plugins/groovy/jetgroovy.iml" group="plugins/Groovy" />
|
||||
|
||||
@@ -183,6 +183,13 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
|
||||
layoutCommunityPlugins(home)
|
||||
|
||||
layoutPlugin("javaFX") {
|
||||
jar("javaFX") {
|
||||
module("JavaFX")
|
||||
module("JavaFX-CE")
|
||||
}
|
||||
}
|
||||
|
||||
dir("plugins") {
|
||||
dir("IntelliLang") {
|
||||
dir("lib") {
|
||||
@@ -207,7 +214,7 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
|
||||
|
||||
public def layoutCommunityPlugins(String home) {
|
||||
dir("plugins") {
|
||||
def simplePlugins = ["commander", "copyright", "properties", "javaFX", "java-i18n", "hg4idea", "github", "ui-designer-core", "tasks-time-tracking"]
|
||||
def simplePlugins = ["commander", "copyright", "properties", "java-i18n", "hg4idea", "github", "ui-designer-core", "tasks-time-tracking"]
|
||||
|
||||
simplePlugins.each {
|
||||
layoutPlugin it
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
<orderEntry type="module" module-name="devkit-jps-plugin" scope="TEST" />
|
||||
<orderEntry type="module" module-name="ui-designer-jps-plugin" scope="TEST" />
|
||||
<orderEntry type="module" module-name="colorSchemes" />
|
||||
<orderEntry type="module" module-name="javaFX-CE" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
13
plugins/javaFX/javaFX-CE/javaFX-CE.iml
Normal file
13
plugins/javaFX/javaFX-CE/javaFX-CE.iml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="javaFX" exported="" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
11
plugins/javaFX/javaFX-CE/src/META-INF/plugin.xml
Normal file
11
plugins/javaFX/javaFX-CE/src/META-INF/plugin.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<name>JavaFX</name>
|
||||
<id>org.jetbrains.plugins.javaFX</id>
|
||||
<version>1.0</version>
|
||||
<vendor>JetBrains</vendor>
|
||||
<description>
|
||||
This plugin provides JavaFX2 support.
|
||||
</description>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<xi:include href="/META-INF/common-javaFX-plugin.xml" xpointer="xpointer(/idea-plugin/*)"/>
|
||||
</idea-plugin>
|
||||
@@ -19,7 +19,6 @@
|
||||
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="java-impl" />
|
||||
<orderEntry type="module" module-name="java-indexing-api" />
|
||||
<orderEntry type="module" module-name="CSS" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
<idea-plugin>
|
||||
<name>JavaFX</name>
|
||||
<id>org.jetbrains.plugins.javaFX</id>
|
||||
<version>1.0</version>
|
||||
<vendor>JetBrains</vendor>
|
||||
<description>
|
||||
This plugin provides JavaFX2 support.
|
||||
</description>
|
||||
<depends optional="true" config-file="css-plugin.xml">com.intellij.css</depends>
|
||||
<depends>com.intellij.modules.java</depends>
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
<errorHandler implementation="com.intellij.diagnostic.ITNReporter"/>
|
||||
@@ -1,5 +0,0 @@
|
||||
<idea-plugin url="http://www.jetbrains.com/idea">
|
||||
<extensions xmlns="com.intellij">
|
||||
<psi.referenceContributor implementation="org.jetbrains.plugins.javaFX.css.refs.JavaFxCSSReferenceContributor"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
@@ -1,131 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 org.jetbrains.plugins.javaFX.css.refs;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.patterns.XmlAttributeValuePattern;
|
||||
import com.intellij.patterns.XmlPatterns;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.css.impl.util.references.CssClassOrIdReference;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
|
||||
import org.jetbrains.plugins.javaFX.fxml.refs.FxmlReferencesContributor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: 2/13/13
|
||||
*/
|
||||
public class JavaFxCSSReferenceContributor extends PsiReferenceContributor {
|
||||
@Override
|
||||
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
|
||||
final XmlAttributeValuePattern attributeValueInFxml = XmlPatterns.xmlAttributeValue().with(FxmlReferencesContributor.inFxmlCondition());
|
||||
registrar.registerReferenceProvider(XmlPatterns.xmlAttributeValue().withParent(XmlPatterns.xmlAttribute()
|
||||
.withName(FxmlConstants.STYLE_CLASS))
|
||||
.and(attributeValueInFxml), new JavaFxCssReferenceProvider());
|
||||
}
|
||||
|
||||
private static class JavaFxCssReferenceProvider extends PsiReferenceProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
|
||||
@NotNull ProcessingContext context) {
|
||||
return new PsiReference[]{new JavaFxCssReference(element)};
|
||||
}
|
||||
}
|
||||
|
||||
private static class JavaFxCssReference extends CssClassOrIdReference {
|
||||
|
||||
private Set<VirtualFile> myCssFiles = new HashSet<VirtualFile>();
|
||||
|
||||
public JavaFxCssReference(PsiElement element) {
|
||||
super(element, null, true, true);
|
||||
final XmlTag xmlTag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
|
||||
if (xmlTag != null) {
|
||||
XmlTag parentTag = xmlTag;
|
||||
while ((parentTag = parentTag.getParentTag()) != null) {
|
||||
XmlAttribute stylesheet = parentTag.getAttribute(FxmlConstants.STYLESHEETS);
|
||||
if (stylesheet != null) {
|
||||
collectStyleSheets(stylesheet);
|
||||
}
|
||||
else {
|
||||
final XmlTag[] tags = parentTag.findSubTags(FxmlConstants.STYLESHEETS);
|
||||
for (XmlTag tag : tags) {
|
||||
final XmlTag[] urlTags = tag.findSubTags("URL");
|
||||
for (XmlTag urlTag : urlTags) {
|
||||
stylesheet = urlTag.getAttribute(FxmlConstants.VALUE);
|
||||
if (stylesheet != null) {
|
||||
collectStyleSheets(stylesheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void collectStyleSheets(XmlAttribute stylesheet) {
|
||||
final XmlAttributeValue valueElement = stylesheet.getValueElement();
|
||||
if (valueElement != null) {
|
||||
final PsiReference[] references = valueElement.getReferences();
|
||||
for (PsiReference reference : references) {
|
||||
final PsiElement stylesheetFile = reference.resolve();
|
||||
if (stylesheetFile != null) {
|
||||
myCssFiles.add(PsiUtilCore.getVirtualFile(stylesheetFile.getContainingFile()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasExplicitIdMark() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isId() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoft() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReferenceTo(PsiElement element) {
|
||||
if (!myCssFiles.contains(PsiUtilCore.getVirtualFile(element.getContainingFile()))) return false;
|
||||
final String canonicalText = getCanonicalText();
|
||||
final String name = ((PsiNamedElement)element).getName();
|
||||
return Comparing.strEqual(canonicalText, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GlobalSearchScope getSearchScope() {
|
||||
return GlobalSearchScope.filesScope(getElement().getProject(), myCssFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user