From 393824df911ad6832010c5613c62fa1711761712 Mon Sep 17 00:00:00 2001 From: "Vladislav.Soroka" Date: Wed, 5 Nov 2014 13:38:47 +0400 Subject: [PATCH 1/4] gradle: ide-gradle resource compiler should honor inheritOutputDirs setting IDEA-132188 Separation of IDE compilation output and output of build tool (Gradle) seems broken (cherry picked from commit 1ce9fd7) --- ...leResourceCompilerConfigurationGenerator.java | 16 +++++++++++++--- .../execution/GradleOrderEnumeratorHandler.java | 5 +++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleResourceCompilerConfigurationGenerator.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleResourceCompilerConfigurationGenerator.java index 52188f1fcb73..4d7daa373819 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleResourceCompilerConfigurationGenerator.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/config/GradleResourceCompilerConfigurationGenerator.java @@ -118,9 +118,6 @@ public class GradleResourceCompilerConfigurationGenerator { continue; } - final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module); - assert compilerModuleExtension != null; - GradleModuleResourceConfiguration resourceConfig = new GradleModuleResourceConfiguration(); resourceConfig.id = new ModuleVersion(externalProject.getGroup(), externalProject.getName(), externalProject.getVersion()); resourceConfig.directory = FileUtil.toSystemIndependentName(externalProject.getProjectDir().getPath()); @@ -131,6 +128,19 @@ public class GradleResourceCompilerConfigurationGenerator { final ExternalSourceSet testSourcesSet = externalProject.getSourceSets().get("test"); addResources(resourceConfig.testResources, testSourcesSet, ExternalSystemSourceType.TEST_RESOURCE); + final CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module); + if(compilerModuleExtension != null && compilerModuleExtension.isCompilerOutputPathInherited()) { + String outputPath = VfsUtilCore.urlToPath(compilerModuleExtension.getCompilerOutputUrl()); + for (ResourceRootConfiguration resource : resourceConfig.resources) { + resource.targetPath = outputPath; + } + + String testOutputPath = VfsUtilCore.urlToPath(compilerModuleExtension.getCompilerOutputUrlForTests()); + for (ResourceRootConfiguration resource : resourceConfig.testResources) { + resource.targetPath = testOutputPath; + } + } + projectConfig.moduleConfigurations.put(module.getName(), resourceConfig); } diff --git a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleOrderEnumeratorHandler.java b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleOrderEnumeratorHandler.java index ef4686409991..8e9e69eac1ff 100644 --- a/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleOrderEnumeratorHandler.java +++ b/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/GradleOrderEnumeratorHandler.java @@ -15,7 +15,6 @@ */ package org.jetbrains.plugins.gradle.execution; -import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ex.ApplicationEx; import com.intellij.openapi.components.ServiceManager; @@ -27,9 +26,9 @@ import com.intellij.openapi.externalSystem.model.project.ExternalSystemSourceTyp import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataManager; import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil; import com.intellij.openapi.externalSystem.util.ExternalSystemConstants; -import com.intellij.openapi.externalSystem.util.ExternalSystemUtil; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; +import com.intellij.openapi.roots.CompilerModuleExtension; import com.intellij.openapi.roots.ModuleRootModel; import com.intellij.openapi.roots.OrderEnumerationHandler; import com.intellij.openapi.roots.OrderRootType; @@ -54,6 +53,8 @@ public class GradleOrderEnumeratorHandler extends OrderEnumerationHandler { @Override public boolean isApplicable(@NotNull Module module) { + CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module); + if (compilerModuleExtension != null && compilerModuleExtension.isCompilerOutputPathInherited()) return false; return ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, module); } From 1232d9e230fcd164284612dce09391d9d1092868 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 6 Nov 2014 14:28:45 +0100 Subject: [PATCH 2/4] Cleanup (warnings; typos; formatting) --- .../jps/model/java/impl/JavaSdkUtil.java | 9 +-- .../openapi/projectRoots/JdkUtil.java | 63 ++++++++----------- .../projectRoot/ProjectSdksModel.java | 30 +++++---- .../intellij/ide/actions/OpenFileAction.java | 6 +- 4 files changed, 49 insertions(+), 59 deletions(-) diff --git a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java index 64ee02b8b9b3..07a344928368 100644 --- a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java +++ b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JavaSdkUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -18,6 +18,7 @@ package org.jetbrains.jps.model.java.impl; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; @@ -30,11 +31,11 @@ import java.util.Set; * @author nik */ public class JavaSdkUtil { - public static List getJdkClassesRoots(File home, boolean isJre) { + @NotNull + public static List getJdkClassesRoots(@NotNull File home, boolean isJre) { FileFilter jarFileFilter = new FileFilter() { @Override - @SuppressWarnings({"HardCodedStringLiteral"}) - public boolean accept(File f) { + public boolean accept(@NotNull File f) { return !f.isDirectory() && f.getName().endsWith(".jar"); } }; diff --git a/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java b/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java index 337909b318e5..5772c4c1e19c 100644 --- a/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java +++ b/platform/lang-api/src/com/intellij/openapi/projectRoots/JdkUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * 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. @@ -25,7 +25,6 @@ import com.intellij.execution.configurations.SimpleJavaParameters; import com.intellij.ide.util.PropertiesComponent; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtilRt; import com.intellij.openapi.vfs.CharsetToolkit; @@ -61,16 +60,10 @@ public class JdkUtil { VirtualFile homeDirectory = jdk.getHomeDirectory(); if (homeDirectory == null) return null; - VirtualFile rtJar = homeDirectory.findFileByRelativePath("jre/lib/rt.jar"); - if (rtJar == null) { - rtJar = homeDirectory.findFileByRelativePath("lib/rt.jar"); - } - if (rtJar == null) { - rtJar = homeDirectory.findFileByRelativePath("jre/lib/vm.jar"); // for IBM jdk - } - if (rtJar == null) { - rtJar = homeDirectory.findFileByRelativePath("../Classes/classes.jar"); // for mac - } + VirtualFile rtJar = homeDirectory.findFileByRelativePath("jre/lib/rt.jar"); // JDK + if (rtJar == null) rtJar = homeDirectory.findFileByRelativePath("lib/rt.jar"); // JRE + if (rtJar == null) rtJar = homeDirectory.findFileByRelativePath("jre/lib/vm.jar"); // IBM JDK + if (rtJar == null) rtJar = homeDirectory.findFileByRelativePath("../Classes/classes.jar"); // Apple JDK if (rtJar == null) { String versionString = jdk.getVersionString(); @@ -107,17 +100,16 @@ public class JdkUtil { return null; } - public static boolean checkForJdk(final File homePath) { + public static boolean checkForJdk(@NotNull File homePath) { File binPath = new File(homePath.getAbsolutePath() + File.separator + "bin"); if (!binPath.exists()) return false; FileFilter fileFilter = new FileFilter() { @Override - @SuppressWarnings({"HardCodedStringLiteral"}) - public boolean accept(File f) { + public boolean accept(@NotNull File f) { if (f.isDirectory()) return false; - return Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "javac") || - Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "javah"); + String name = FileUtil.getNameWithoutExtension(f); + return "javac".equals(name) || "javah".equals(name); } }; File[] children = binPath.listFiles(fileFilter); @@ -126,16 +118,15 @@ public class JdkUtil { checkForRuntime(homePath.getAbsolutePath()); } - public static boolean checkForJre(String homePath) { + public static boolean checkForJre(@NotNull String homePath) { homePath = new File(FileUtil.toSystemDependentName(homePath)).getAbsolutePath(); File binPath = new File(homePath + File.separator + "bin"); if (!binPath.exists()) return false; FileFilter fileFilter = new FileFilter() { @Override - @SuppressWarnings({"HardCodedStringLiteral"}) - public boolean accept(File f) { - return !f.isDirectory() && Comparing.strEqual(FileUtil.getNameWithoutExtension(f), "java"); + public boolean accept(@NotNull File f) { + return !f.isDirectory() && "java".equals(FileUtil.getNameWithoutExtension(f)); } }; File[] children = binPath.listFiles(fileFilter); @@ -144,12 +135,12 @@ public class JdkUtil { checkForRuntime(homePath); } - public static boolean checkForRuntime(final String homePath) { - return new File(new File(new File(homePath, "jre"), "lib"), "rt.jar").exists() || - new File(new File(homePath, "lib"), "rt.jar").exists() || - new File(new File(new File(homePath, ".."), "Classes"), "classes.jar").exists() || // Apple JDK - new File(new File(new File(homePath, "jre"), "lib"), "vm.jar").exists() || // IBM JDK - new File(homePath, "classes").isDirectory(); // custom build + public static boolean checkForRuntime(@NotNull String homePath) { + return new File(homePath, "jre/lib/rt.jar").exists() || // JDK + new File(homePath, "lib/rt.jar").exists() || // JRE + new File(homePath, "../Classes/classes.jar").exists() || // Apple JDK + new File(homePath, "jre/lib/vm.jar").exists() || // IBM JDK + new File(homePath, "classes").isDirectory(); // custom build } public static GeneralCommandLine setupJVMCommandLine(final String exePath, @@ -258,7 +249,7 @@ public class JdkUtil { commandLine.addParameters(javaParameters.getProgramParametersList().getList()); - commandLine.setWorkDirectory(javaParameters.getWorkingDirectory()); + commandLine.withWorkDirectory(javaParameters.getWorkingDirectory()); return commandLine; } @@ -275,24 +266,24 @@ public class JdkUtil { } private static void appendEncoding(SimpleJavaParameters javaParameters, GeneralCommandLine commandLine, ParametersList parametersList) { - // Value of -Dfile.encoding and charset of GeneralCommandLine should be in sync in order process's input and output be correctly handled. + // Value of file.encoding and charset of GeneralCommandLine should be in sync in order process's input and output be correctly handled. String encoding = parametersList.getPropertyValue("file.encoding"); if (encoding == null) { Charset charset = javaParameters.getCharset(); if (charset == null) charset = EncodingManager.getInstance().getDefaultCharset(); if (charset == null) charset = CharsetToolkit.getDefaultSystemCharset(); - commandLine.addParameter("-Dfile.encoding=" + charset.name()); - commandLine.setCharset(charset); + if (charset != null) { + commandLine.addParameter("-Dfile.encoding=" + charset.name()); + commandLine.withCharset(charset); + } } else { try { Charset charset = Charset.forName(encoding); - commandLine.setCharset(charset); - } - catch (UnsupportedCharsetException ignore) { - } - catch (IllegalCharsetNameException ignore) { + commandLine.withCharset(charset); } + catch (UnsupportedCharsetException ignore) { } + catch (IllegalCharsetNameException ignore) { } } } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java index 87df147a745f..1ccbeadddeb8 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ProjectSdksModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * 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. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.openapi.roots.ui.configuration.projectRoot; import com.intellij.openapi.actionSystem.AnAction; @@ -36,14 +35,15 @@ import com.intellij.openapi.util.Condition; import com.intellij.util.ArrayUtilRt; import com.intellij.util.Consumer; import com.intellij.util.EventDispatcher; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.*; /** - * User: anna - * Date: 05-Jun-2006 + * @author anna + * @since 05-Jun-2006 */ public class ProjectSdksModel implements SdkModel { private static final Logger LOG = Logger.getInstance("com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectSdksModel"); @@ -116,7 +116,7 @@ public class ProjectSdksModel implements SdkModel { return myProjectSdks; } - public boolean isModified(){ + public boolean isModified() { return myModified; } @@ -201,7 +201,7 @@ public class ProjectSdksModel implements SdkModel { final SdkAdditionalData sdkAdditionalData = currItem.getSdkAdditionalData(); if (sdkAdditionalData instanceof ValidatableSdkAdditionalData) { try { - ((ValidatableSdkAdditionalData) sdkAdditionalData).checkValid(this); + ((ValidatableSdkAdditionalData)sdkAdditionalData).checkValid(this); } catch (ConfigurationException e) { if (rootConfigurable != null) { @@ -249,14 +249,12 @@ public class ProjectSdksModel implements SdkModel { final SdkType[] types = SdkType.getAllTypes(); for (final SdkType type : types) { if (filter != null && !filter.value(type)) continue; - final AnAction addAction = new DumbAwareAction(type.getPresentableName(), - null, - type.getIconForAddAction()) { - @Override - public void actionPerformed(AnActionEvent e) { - doAdd(parent, type, updateTree); - } - }; + final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIconForAddAction()) { + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + doAdd(parent, type, updateTree); + } + }; group.add(addAction); } } @@ -290,8 +288,8 @@ public class ProjectSdksModel implements SdkModel { if (!sdkType.setupSdkPaths(newJdk, this)) return; if (newJdk.getVersionString() == null) { - Messages.showMessageDialog(ProjectBundle.message("sdk.java.corrupt.error", home), - ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon()); + String message = ProjectBundle.message("sdk.java.corrupt.error", home); + Messages.showMessageDialog(message, ProjectBundle.message("sdk.java.corrupt.title"), Messages.getErrorIcon()); } doAdd(newJdk, callback); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/OpenFileAction.java b/platform/platform-impl/src/com/intellij/ide/actions/OpenFileAction.java index 55d4474787a4..5dc35db167f2 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/OpenFileAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/OpenFileAction.java @@ -49,7 +49,7 @@ import java.util.List; public class OpenFileAction extends AnAction implements DumbAware { @Override - public void actionPerformed(AnActionEvent e) { + public void actionPerformed(@NotNull AnActionEvent e) { final Project project = e.getProject(); final boolean showFiles = project != null || PlatformProjectOpenProcessor.getInstanceIfItExists() != null; final FileChooserDescriptor descriptor = showFiles ? new ProjectOrFileChooserDescriptor() : new ProjectOnlyFileChooserDescriptor(); @@ -141,7 +141,7 @@ public class OpenFileAction extends AnAction implements DumbAware { } } - // vanilla OpenProjectFileChooserDescriptor only accepts project files; this on is overridden to accept any files + // vanilla OpenProjectFileChooserDescriptor only accepts project files; this one is overridden to accept any files private static class ProjectOrFileChooserDescriptor extends OpenProjectFileChooserDescriptor { private final FileChooserDescriptor myStandardDescriptor = FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(); @@ -157,7 +157,7 @@ public class OpenFileAction extends AnAction implements DumbAware { @Override public boolean isFileSelectable(VirtualFile file) { - return file.isDirectory() ? super.isFileSelectable(file) : myStandardDescriptor.isFileSelectable(file); + return file.isDirectory() ? super.isFileSelectable(file) : myStandardDescriptor.isFileSelectable(file); } @Override From c4a5dcfdfc4deecd05f5e4ecd31d810ce0fdc87b Mon Sep 17 00:00:00 2001 From: Dmitry Trofimov Date: Thu, 6 Nov 2014 14:46:41 +0100 Subject: [PATCH 3/4] Revert method rename for compatibility. --- .../com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java | 4 ++-- .../xdebugger/impl/ui/XDebuggerExpressionComboBox.java | 2 +- .../intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java | 2 +- .../jetbrains/python/debugger/array/ArrayTableCellEditor.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java index 05d56161bade..4d7d65fff3c5 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerEditorBase.java @@ -142,7 +142,7 @@ public abstract class XDebuggerEditorBase { public abstract JComponent getComponent(); - protected abstract void setEditorText(XExpression text); + protected abstract void doSetText(XExpression text); public void setExpression(@Nullable XExpression text) { if (text == null) { @@ -174,7 +174,7 @@ public abstract class XDebuggerEditorBase { myChooseFactory.setDisabledIcon(IconLoader.getDisabledIcon(icon)); } - setEditorText(text); + doSetText(text); } @Nullable diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java index eaff436919db..3039d2acda7f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerExpressionComboBox.java @@ -128,7 +128,7 @@ public class XDebuggerExpressionComboBox extends XDebuggerEditorBase { } @Override - protected void setEditorText(XExpression text) { + protected void doSetText(XExpression text) { if (myComboBox.getItemCount() > 0) { myComboBox.setSelectedIndex(0); } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java index 386bca17e856..b2222ce556c5 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebuggerMultilineEditor.java @@ -69,7 +69,7 @@ public class XDebuggerMultilineEditor extends XDebuggerEditorBase { } @Override - protected void setEditorText(XExpression text) { + protected void doSetText(XExpression text) { myExpression = text; Language language = text.getLanguage(); FileType fileType = language != null ? language.getAssociatedFileType() : getEditorsProvider().getFileType(); diff --git a/python/src/com/jetbrains/python/debugger/array/ArrayTableCellEditor.java b/python/src/com/jetbrains/python/debugger/array/ArrayTableCellEditor.java index 6095d1d0047d..05ba00ebd17a 100644 --- a/python/src/com/jetbrains/python/debugger/array/ArrayTableCellEditor.java +++ b/python/src/com/jetbrains/python/debugger/array/ArrayTableCellEditor.java @@ -143,7 +143,7 @@ public class ArrayTableCellEditor extends AbstractCellEditor implements TableCel } @Override - protected void setEditorText(XExpression text) { + protected void doSetText(XExpression text) { myEditorTextField.setText(text.getExpression()); } From 660d0e796bee12d2037d094683882fe63e1461b8 Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Thu, 6 Nov 2014 14:30:42 +0100 Subject: [PATCH 4/4] extra care for possible NPE during matching PsiClass implementations with null qname --- .../structuralsearch/impl/matcher/JavaMatchingVisitor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java index e963ec91c2fc..a540080d95d9 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/JavaMatchingVisitor.java @@ -420,7 +420,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor { (elements2 != null) ? elements2.getReferenceElements() : PsiElement.EMPTY_ARRAY ); } - + private boolean compareClasses(final PsiClass clazz, final PsiClass clazz2) { final PsiClass saveClazz = this.myClazz; final MatchContext.MatchedElementsListener oldListener = myMatchingVisitor.getMatchContext().getMatchedElementsListener(); @@ -838,6 +838,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor { String text2; if (el2 instanceof PsiClass) { text2 = ((PsiClass)el2).getQualifiedName(); + if (text2 == null) text2 = el2.getText(); } else { text2 = el2.getText(); }