mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
Generated
+3
-1
@@ -4,6 +4,8 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-lang-2.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-lang-2.4-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Generated
+11
@@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="commons-logging">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-logging-1.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-logging-1.1.1-src.zip!/commons-logging-1.1.1-src/src/java" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Generated
+7
-4
@@ -1,12 +1,15 @@
|
||||
<component name="libraryTable">
|
||||
<library name="http-client-3.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/plugins/tasks/tasks-core/lib/commons-httpclient-3.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/plugins/tasks/tasks-core/lib/commons-logging-1.1.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-logging-1.1.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-httpclient-3.1-patched.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$PROJECT_DIR$/plugins/tasks/tasks-core/lib/commons-httpclient-3.1-src.zip!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-httpclient-3.1-src-patched.zip!/commons-httpclient-3.1/docs" />
|
||||
</JAVADOC>
|
||||
<SOURCES />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-httpclient-3.1-src-patched.zip!/commons-httpclient-3.1/src/contrib" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-httpclient-3.1-src-patched.zip!/commons-httpclient-3.1/src/java" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
+2
-2
@@ -26,7 +26,7 @@ if [ -z "$IDEA_JDK" ]; then
|
||||
fi
|
||||
if [ -z "$IDEA_JDK" ]; then
|
||||
echo ERROR: cannot start IntelliJ IDEA.
|
||||
echo No JDK found to run IDEA. Please validate either IDEA_JDK, JDK_HOME or JAVA_HOME points to valid JDK installation.
|
||||
echo No JDK found to run IDEA. Please validate either IDEA_JDK, JDK_HOME or JAVA_HOME environment variable points to valid JDK installation.
|
||||
echo
|
||||
echo Press Enter to continue.
|
||||
read IGNORE
|
||||
@@ -47,7 +47,7 @@ if [ $OPEN_JDK -eq 0 ]; then
|
||||
echo THIS IS STRICTLY UNSUPPORTED DUE TO KNOWN PERFORMANCE AND GRAPHICS PROBLEMS
|
||||
echo
|
||||
echo NOTE: If you have both Sun JDK and OpenJDK installed
|
||||
echo please validate either IDEA_JDK or JDK_HOME points to valid Sun JDK installation
|
||||
echo please validate either IDEA_JDK or JDK_HOME environment variable points to valid Sun JDK installation
|
||||
echo
|
||||
echo Press Enter to continue.
|
||||
read IGNORE
|
||||
|
||||
@@ -88,6 +88,7 @@ binding.setVariable("loadProject", {
|
||||
requireProperty("home", guessHome())
|
||||
|
||||
project.builder.buildInfoPrinter = new org.jetbrains.jps.teamcity.TeamcityBuildInfoPrinter()
|
||||
project.builder.compressJars = false
|
||||
|
||||
binding.setVariable("notifyArtifactBuilt", { String artifactPath ->
|
||||
if (!artifactPath.startsWith(home)) {
|
||||
|
||||
@@ -2015,6 +2015,86 @@ http://blog.bitfluent.com/post/198076049/railscasts-theme-for-rubymine
|
||||
<option name="EFFECT_TYPE" value="2" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_COMMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="bc9458" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_KEYWORD">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="cc7833" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TAG">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="d0d0ff" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_PYSTRING">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="a5c261" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_HEADER_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="2" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="a5c261" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_OUTLINE_PARAMETER_SUBSTITUTION">
|
||||
<value>
|
||||
<option name="FOREGROUND" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="2" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_REGEXP_PARAMETER">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="a5c261" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="0" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
</scheme>
|
||||
|
||||
@@ -811,6 +811,46 @@
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_COMMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="ff" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_KEYWORD">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="ff9900" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TAG">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="bf70b5" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_PYSTRING">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="b200" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
</scheme>
|
||||
|
||||
|
||||
@@ -1049,5 +1049,45 @@
|
||||
<option name="BACKGROUND" value="F92672" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_COMMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="75715E" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_KEYWORD">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="75715E" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TAG">
|
||||
<value/>
|
||||
</option>
|
||||
<option name="GHERKIN_PYSTRING">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="E6DB74" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_HEADER_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FD971F" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="E6DB74" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_OUTLINE_PARAMETER_SUBSTITUTION">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="FD971F" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_REGEXP_PARAMETER">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="E6DB74" />
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
</scheme>
|
||||
|
||||
@@ -1071,6 +1071,47 @@
|
||||
<option name="FOREGROUND" value="D2A8A1" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_COMMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="5F5A60" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_KEYWORD">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="CDA869" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TAG">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="8A9A95" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_PYSTRING">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="8F9D6A" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_HEADER_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="8A9A95" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="494949" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_OUTLINE_PARAMETER_SUBSTITUTION">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="8A9A95" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_REGEXP_PARAMETER">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="494949" />
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
</scheme>
|
||||
|
||||
@@ -1820,5 +1820,85 @@
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_COMMENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="808080" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_KEYWORD">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="cc783c" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TAG">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="cc00ff" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_PYSTRING">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="629468" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_HEADER_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="f1a268" />
|
||||
<option name="BACKGROUND" value="333333" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="2" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_TABLE_CELL">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="297bde" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_OUTLINE_PARAMETER_SUBSTITUTION">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="f1a268" />
|
||||
<option name="BACKGROUND" value="333333" />
|
||||
<option name="FONT_TYPE" value="2" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="2" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="GHERKIN_REGEXP_PARAMETER">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="297bde" />
|
||||
<option name="BACKGROUND" />
|
||||
<option name="FONT_TYPE" value="1" />
|
||||
<option name="EFFECT_COLOR" />
|
||||
<option name="EFFECT_TYPE" value="0" />
|
||||
<option name="ERROR_STRIPE_COLOR" />
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
</scheme>
|
||||
@@ -84,6 +84,9 @@ public class HotSwapManager extends AbstractProjectComponent {
|
||||
CompilerPathsEx.visitFiles(allDirs, new CompilerPathsEx.FileVisitor() {
|
||||
|
||||
protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) {
|
||||
if (progress.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath));
|
||||
if(file.getFileSystem() instanceof JarFileSystem && FileTypes.ARCHIVE.equals(fileTypeManager.getFileTypeByFile(file))) {
|
||||
if(file.getTimeStamp() > timeStamp) {
|
||||
@@ -96,6 +99,9 @@ public class HotSwapManager extends AbstractProjectComponent {
|
||||
}
|
||||
|
||||
protected void acceptFile(VirtualFile file, String fileRoot, String filePath) {
|
||||
if (progress.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (file.getTimeStamp() > timeStamp && StdFileTypes.CLASS.equals(fileTypeManager.getFileTypeByFile(file))) {
|
||||
//noinspection HardCodedStringLiteral
|
||||
if (SystemInfo.isFileSystemCaseSensitive? filePath.endsWith(CLASS_EXTENSION) : StringUtil.endsWithIgnoreCase(filePath, CLASS_EXTENSION)) {
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.intellij.openapi.project.Project;
|
||||
public abstract class HotSwapProgress {
|
||||
private final Project myProject;
|
||||
private Runnable myCancelWorker;
|
||||
private boolean myIsCancelled;
|
||||
private volatile boolean myIsCancelled;
|
||||
|
||||
public HotSwapProgress(Project project) {
|
||||
myProject = project;
|
||||
|
||||
@@ -392,10 +392,11 @@ public abstract class DebuggerUtils {
|
||||
}
|
||||
}
|
||||
else if (psiElement instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)psiElement;
|
||||
if (!isSimpleGetter(method)) {
|
||||
rv.set(Boolean.TRUE);
|
||||
}
|
||||
rv.set(Boolean.TRUE);
|
||||
//final PsiMethod method = (PsiMethod)psiElement;
|
||||
//if (!isSimpleGetter(method)) {
|
||||
// rv.set(Boolean.TRUE);
|
||||
//}
|
||||
}
|
||||
if (!rv.get().booleanValue()) {
|
||||
super.visitReferenceExpression(expression);
|
||||
@@ -420,13 +421,14 @@ public abstract class DebuggerUtils {
|
||||
|
||||
@Override
|
||||
public void visitCallExpression(final PsiCallExpression callExpression) {
|
||||
final PsiMethod method = callExpression.resolveMethod();
|
||||
if (method == null || !isSimpleGetter(method)) {
|
||||
rv.set(Boolean.TRUE);
|
||||
}
|
||||
else {
|
||||
super.visitCallExpression(callExpression);
|
||||
}
|
||||
rv.set(Boolean.TRUE);
|
||||
//final PsiMethod method = callExpression.resolveMethod();
|
||||
//if (method == null || !isSimpleGetter(method)) {
|
||||
// rv.set(Boolean.TRUE);
|
||||
//}
|
||||
//else {
|
||||
// super.visitCallExpression(callExpression);
|
||||
//}
|
||||
}
|
||||
});
|
||||
return rv.get().booleanValue();
|
||||
|
||||
@@ -287,9 +287,26 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
|
||||
for (ModuleEditor moduleEditor : myModuleEditors) {
|
||||
moduleEditor.canApply();
|
||||
}
|
||||
|
||||
final Map<Sdk, Sdk> modifiedToOriginalMap = new HashMap<Sdk, Sdk>();
|
||||
final ProjectSdksModel projectJdksModel = ProjectStructureConfigurable.getInstance(myProject).getProjectJdksModel();
|
||||
for (Map.Entry<Sdk, Sdk> entry : projectJdksModel.getProjectSdks().entrySet()) {
|
||||
modifiedToOriginalMap.put(entry.getValue(), entry.getKey());
|
||||
}
|
||||
|
||||
for (final ModuleEditor moduleEditor : myModuleEditors) {
|
||||
final ModifiableRootModel model = moduleEditor.apply();
|
||||
if (model != null) {
|
||||
if (!model.isSdkInherited()) {
|
||||
// make sure the sdk is set to original SDK stored in the JDK Table
|
||||
final Sdk modelSdk = model.getSdk();
|
||||
if (modelSdk != null) {
|
||||
final Sdk original = modifiedToOriginalMap.get(modelSdk);
|
||||
if (original != null) {
|
||||
model.setSdk(original);
|
||||
}
|
||||
}
|
||||
}
|
||||
models.add(model);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
package com.intellij.openapi.roots.ui.configuration.classpath;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.LibraryOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
@@ -114,9 +114,9 @@ class AddNewLibraryItemAction extends ChooseAndAddAction<Library> {
|
||||
private static List<LibraryType> getSuitableTypes(ClasspathPanel classpathPanel) {
|
||||
List<LibraryType> suitableTypes = new ArrayList<LibraryType>();
|
||||
suitableTypes.add(null);
|
||||
final ModuleType moduleType = classpathPanel.getRootModel().getModule().getModuleType();
|
||||
final Module module = classpathPanel.getRootModel().getModule();
|
||||
for (LibraryType libraryType : LibraryType.EP_NAME.getExtensions()) {
|
||||
if (libraryType.isSuitableModuleType(moduleType)) {
|
||||
if (libraryType.isSuitableModule(module, classpathPanel.getModuleConfigurationState().getFacetsProvider())) {
|
||||
suitableTypes.add(libraryType);
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -17,6 +17,7 @@ package com.intellij.openapi.roots.ui.configuration.classpath;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.List;
|
||||
@@ -34,4 +35,6 @@ public interface ClasspathPanel {
|
||||
Project getProject();
|
||||
|
||||
JComponent getComponent();
|
||||
|
||||
ModuleConfigurationState getModuleConfigurationState();
|
||||
}
|
||||
|
||||
+5
@@ -457,6 +457,11 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
|
||||
return myState.getProject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModuleConfigurationState getModuleConfigurationState() {
|
||||
return myState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return this;
|
||||
|
||||
+28
-8
@@ -29,6 +29,7 @@ import com.intellij.openapi.roots.ui.configuration.libraries.LibraryEditingUtil;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.BaseLibrariesConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesModifiableModel;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.ModuleStructureConfigurable;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectLibrariesConfigurable;
|
||||
import com.intellij.openapi.ui.MasterDetailsComponent;
|
||||
import com.intellij.util.Icons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -38,6 +39,7 @@ import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -77,12 +79,7 @@ public class CreateNewLibraryAction extends AnAction {
|
||||
}
|
||||
|
||||
private void appendLibraryToModules(final ModuleStructureConfigurable rootConfigurable, final Library libraryToSelect) {
|
||||
final List<Module> modules = new ArrayList<Module>();
|
||||
for (Module module : rootConfigurable.getModules()) {
|
||||
if (myType == null || myType.isSuitableModuleType(module.getModuleType())) {
|
||||
modules.add(module);
|
||||
}
|
||||
}
|
||||
final List<Module> modules = getSuitableModules(rootConfigurable, myType);
|
||||
if (modules.isEmpty()) return;
|
||||
final ChooseModulesDialog dlg = new ChooseModulesDialog(myProject,
|
||||
modules, ProjectBundle.message("choose.modules.dialog.title"),
|
||||
@@ -97,14 +94,37 @@ public class CreateNewLibraryAction extends AnAction {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Module> getSuitableModules(@NotNull ModuleStructureConfigurable rootConfigurable, final @Nullable LibraryType type) {
|
||||
final List<Module> modules = new ArrayList<Module>();
|
||||
for (Module module : rootConfigurable.getModules()) {
|
||||
if (type == null || type.isSuitableModule(module, rootConfigurable.getFacetConfigurator())) {
|
||||
modules.add(module);
|
||||
}
|
||||
}
|
||||
return modules;
|
||||
}
|
||||
|
||||
public static AnAction[] createActionOrGroup(@NotNull String text, @NotNull BaseLibrariesConfigurable librariesConfigurable, final @Nullable Project project) {
|
||||
final LibraryType<?>[] extensions = LibraryType.EP_NAME.getExtensions();
|
||||
if (extensions.length == 0) {
|
||||
List<LibraryType<?>> suitableTypes = new ArrayList<LibraryType<?>>();
|
||||
if (project != null && librariesConfigurable instanceof ProjectLibrariesConfigurable) {
|
||||
final ModuleStructureConfigurable configurable = ModuleStructureConfigurable.getInstance(project);
|
||||
for (LibraryType<?> extension : extensions) {
|
||||
if (!getSuitableModules(configurable, extension).isEmpty()) {
|
||||
suitableTypes.add(extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Collections.addAll(suitableTypes, extensions);
|
||||
}
|
||||
|
||||
if (suitableTypes.isEmpty()) {
|
||||
return new AnAction[]{new CreateNewLibraryAction(text, Icons.LIBRARY_ICON, null, librariesConfigurable, project)};
|
||||
}
|
||||
List<AnAction> actions = new ArrayList<AnAction>();
|
||||
actions.add(new CreateNewLibraryAction(IdeBundle.message("create.default.library.type.action.name"), Icons.LIBRARY_ICON, null, librariesConfigurable, project));
|
||||
for (LibraryType<?> type : extensions) {
|
||||
for (LibraryType<?> type : suitableTypes) {
|
||||
actions.add(new CreateNewLibraryAction(type.getCreateActionName(), type.getIcon(), type, librariesConfigurable, project));
|
||||
}
|
||||
return actions.toArray(new AnAction[actions.size()]);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="module" module-name="boot" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.JavadocOptionsProvider">
|
||||
<grid id="27dc6" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="10ab5" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none" title="Javadoc"/>
|
||||
<children>
|
||||
<component id="3fb85" class="javax.swing.JCheckBox" binding="myAutoGenerateClosingTagCheckBox">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text resource-bundle="messages/JavadocBundle" key="javadoc.generate.closing.tag"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="805b1">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.application.options;
|
||||
|
||||
import com.intellij.application.options.editor.EditorOptionsProvider;
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.javadoc.JavadocBundle;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
* @since 2/2/11 12:32 PM
|
||||
*/
|
||||
public class JavadocOptionsProvider implements EditorOptionsProvider {
|
||||
|
||||
private JPanel myWholePanel;
|
||||
private JCheckBox myAutoGenerateClosingTagCheckBox;
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
return "editor.preferences.javadocOptions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Runnable enableSearch(String option) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return JavadocBundle.message("javadoc.generate.message.title");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHelpTopic() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
return myWholePanel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
CodeInsightSettings settings = getSettings();
|
||||
return myAutoGenerateClosingTagCheckBox.isSelected() ^ settings.JAVADOC_GENERATE_CLOSING_TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
getSettings().JAVADOC_GENERATE_CLOSING_TAG = myAutoGenerateClosingTagCheckBox.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
myAutoGenerateClosingTagCheckBox.setSelected(getSettings().JAVADOC_GENERATE_CLOSING_TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
}
|
||||
|
||||
private static CodeInsightSettings getSettings() {
|
||||
return CodeInsightSettings.getInstance();
|
||||
}
|
||||
}
|
||||
@@ -1023,7 +1023,7 @@ public class JavaCompletionUtil {
|
||||
}
|
||||
|
||||
public static boolean isSourceLevelAccessible(PsiElement context, PsiClass psiClass, final boolean pkgContext) {
|
||||
if (!JavaPsiFacade.getInstance(psiClass.getProject()).getResolveHelper().isAccessible(psiClass, context, psiClass)) {
|
||||
if (!JavaPsiFacade.getInstance(psiClass.getProject()).getResolveHelper().isAccessible(psiClass, context, null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -433,7 +433,7 @@ public class CreateFromUsageUtils {
|
||||
|
||||
@Override public void visitReferenceExpression(PsiReferenceExpression expr) {
|
||||
if (expression instanceof PsiReferenceExpression) {
|
||||
if (expr.textMatches(expression)) {
|
||||
if (expr.textMatches(expression) && expr.resolve() == null) {
|
||||
result.add(expr);
|
||||
}
|
||||
}
|
||||
|
||||
+21
-7
@@ -40,6 +40,7 @@ import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.compiler.ModuleCompilerUtil;
|
||||
@@ -95,7 +96,7 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix {
|
||||
final Module currentModule = fileIndex.getModuleForFile(classVFile);
|
||||
if (currentModule == null) return null;
|
||||
|
||||
if ("TestCase".equals(referenceName) || isAnnotation(psiElement) && isJunitAnnotationName(referenceName)) {
|
||||
if ("TestCase".equals(referenceName) || isAnnotation(psiElement) && isJunitAnnotationName(referenceName, psiElement)) {
|
||||
final boolean isJunit4 = !referenceName.equals("TestCase");
|
||||
@NonNls final String className = isJunit4 ? "org.junit." + referenceName : "junit.framework.TestCase";
|
||||
PsiClass found =
|
||||
@@ -259,14 +260,27 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix {
|
||||
}
|
||||
|
||||
private static boolean isAnnotation(final PsiElement psiElement) {
|
||||
return psiElement.getParent() instanceof PsiAnnotation && PsiUtil.isLanguageLevel5OrHigher(psiElement);
|
||||
return PsiTreeUtil.getParentOfType(psiElement, PsiAnnotation.class) != null && PsiUtil.isLanguageLevel5OrHigher(psiElement);
|
||||
}
|
||||
|
||||
private static boolean isJunitAnnotationName(@NonNls final String referenceName) {
|
||||
return "Test".equals(referenceName) || "Ignore".equals(referenceName) || "RunWith".equals(referenceName) ||
|
||||
"Before".equals(referenceName) || "BeforeClass".equals(referenceName) ||
|
||||
"After".equals(referenceName) || "AfterClass".equals(referenceName);
|
||||
|
||||
private static boolean isJunitAnnotationName(@NonNls final String referenceName, @NotNull final PsiElement psiElement) {
|
||||
if ("Test".equals(referenceName) || "Ignore".equals(referenceName) || "RunWith".equals(referenceName) ||
|
||||
"Before".equals(referenceName) || "BeforeClass".equals(referenceName) ||
|
||||
"After".equals(referenceName) || "AfterClass".equals(referenceName)) {
|
||||
return true;
|
||||
}
|
||||
final PsiElement parent = psiElement.getParent();
|
||||
if (parent != null && !(parent instanceof PsiAnnotation)) {
|
||||
final PsiReference reference = parent.getReference();
|
||||
if (reference != null) {
|
||||
final String referenceText = parent.getText();
|
||||
if (isJunitAnnotationName(reference.getRangeInElement().substring(referenceText), parent)) {
|
||||
final int lastDot = referenceText.lastIndexOf('.');
|
||||
return lastDot > -1 && referenceText.substring(0, lastDot).equals("org.junit");
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void addBundledJarToRoots(final Project project,
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.codeInsight.editorActions;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightSettings;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Advises typing in javadoc if necessary.
|
||||
*
|
||||
* @author Denis Zhdanov
|
||||
* @since 2/2/11 11:17 AM
|
||||
*/
|
||||
public class JavadocTypedHandler extends TypedHandlerDelegate {
|
||||
|
||||
private static final char START_TAG_SYMBOL = '<';
|
||||
private static final char CLOSE_TAG_SYMBOL = '>';
|
||||
private static final char SLASH = '/';
|
||||
|
||||
@Override
|
||||
public Result charTyped(char c, Project project, Editor editor, PsiFile file) {
|
||||
if (project == null || editor == null || file == null) {
|
||||
return Result.CONTINUE;
|
||||
}
|
||||
insertClosingTagIfNecessary(c, project, editor, file);
|
||||
return Result.CONTINUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if it's necessary to insert closing tag on typed character.
|
||||
*
|
||||
* @param c typed symbol
|
||||
* @param project current project
|
||||
* @param editor current editor
|
||||
* @param file current file
|
||||
* @return <code>true</code> if closing tag is inserted; <code>false</code> otherwise
|
||||
*/
|
||||
private static boolean insertClosingTagIfNecessary(char c, @NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
|
||||
if (c != CLOSE_TAG_SYMBOL || !CodeInsightSettings.getInstance().JAVADOC_GENERATE_CLOSING_TAG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
|
||||
if (!isTypingInsideJavadoc(editor, file)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Inspect symbols to the left of the current caret position, insert closing tag only if valid tag is just typed
|
||||
// (e.g. don't insert anything on single '>' symbol typing).
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
Document document = editor.getDocument();
|
||||
CharSequence tagName = getTagName(document.getText(), offset);
|
||||
if (tagName == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
document.insertString(offset, String.valueOf(START_TAG_SYMBOL) + SLASH + tagName + CLOSE_TAG_SYMBOL);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to derive start tag name assuming that given offset points to position just after <code>'>'</code> symbol.
|
||||
* <p/>
|
||||
* Is expected to return <code>null</code> when offset is not located just after start tag, e.g. the following situations:
|
||||
* <pre>
|
||||
* <ul>
|
||||
* <li>standalone {@code '>'} symbol (surrounded by white spaces);</li>
|
||||
* <li>after end tag {@code <mytag><mytag>[caret]};</li>
|
||||
* <li>after empty element tag {@code <p/>[caret]};</li>
|
||||
* </ul>
|
||||
* </pre>
|
||||
*
|
||||
* @param text target text
|
||||
* @param afterTagOffset offset that points after
|
||||
* @return tag name if the one is parsed; <code>null</code> otherwise
|
||||
*/
|
||||
@Nullable
|
||||
static CharSequence getTagName(@NotNull CharSequence text, int afterTagOffset) {
|
||||
if (afterTagOffset > text.length()) {
|
||||
return null;
|
||||
}
|
||||
int endOffset = afterTagOffset - 1;
|
||||
|
||||
// Check empty element like <p/>
|
||||
if (endOffset > 0 && text.charAt(endOffset - 1) == SLASH) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = endOffset - 1; i >= 0; i--) {
|
||||
char c = text.charAt(i);
|
||||
switch (c) {
|
||||
case '\n': return null;
|
||||
case CLOSE_TAG_SYMBOL: return null;
|
||||
case START_TAG_SYMBOL:
|
||||
if (text.charAt(i + 1) == SLASH) {
|
||||
// Handle situation like <tag></tag>[offset].
|
||||
return null;
|
||||
}
|
||||
return text.subSequence(i + 1, endOffset).toString();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean isTypingInsideJavadoc(Editor editor, PsiFile file) {
|
||||
FileViewProvider provider = file.getViewProvider();
|
||||
int offset = editor.getCaretModel().getOffset();
|
||||
|
||||
final PsiElement elementAtCaret;
|
||||
if (offset < editor.getDocument().getTextLength()) {
|
||||
elementAtCaret = provider.findElementAt(offset);
|
||||
}
|
||||
else {
|
||||
elementAtCaret = provider.findElementAt(editor.getDocument().getTextLength() - 1);
|
||||
}
|
||||
|
||||
PsiElement element = elementAtCaret;
|
||||
while(element instanceof PsiWhiteSpace) {
|
||||
element = element.getPrevSibling();
|
||||
}
|
||||
|
||||
if (element == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ASTNode node = element.getNode();
|
||||
return node != null && JavaDocTokenType.ALL_JAVADOC_TOKENS.contains(node.getElementType());
|
||||
}
|
||||
}
|
||||
@@ -49,9 +49,9 @@ public class SplitIfAction extends PsiElementBaseIntentionAction {
|
||||
if (!isAndExpression && !isOrExpression) return false;
|
||||
|
||||
while (expression.getParent() instanceof PsiBinaryExpression) {
|
||||
expression = (PsiBinaryExpression)expression.getParent();
|
||||
if (isAndExpression && expression.getOperationSign().getTokenType() != JavaTokenType.ANDAND) return false;
|
||||
if (isOrExpression && expression.getOperationSign().getTokenType() != JavaTokenType.OROR) return false;
|
||||
expression = (PsiBinaryExpression)expression.getParent();
|
||||
}
|
||||
|
||||
if (!(expression.getParent() instanceof PsiIfStatement)) return false;
|
||||
|
||||
@@ -1430,10 +1430,10 @@ public class JavaDocInfoGenerator {
|
||||
* @return Length of the generated label.
|
||||
*/
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
private int generateLink(StringBuilder buffer, String refText, String label, PsiElement context, boolean plainLink) {
|
||||
private static int generateLink(StringBuilder buffer, String refText, String label, @NotNull PsiElement context, boolean plainLink) {
|
||||
if (label == null) {
|
||||
PsiManager manager = PsiManager.getInstance(myProject);
|
||||
label = JavaDocUtil.getLabelText(myProject, manager, refText, context);
|
||||
final PsiManager manager = context.getManager();
|
||||
label = JavaDocUtil.getLabelText(manager.getProject(), manager, refText, context);
|
||||
}
|
||||
|
||||
LOG.assertTrue(refText != null, "refText appears to be null.");
|
||||
@@ -1448,7 +1448,7 @@ public class JavaDocInfoGenerator {
|
||||
}
|
||||
|
||||
|
||||
DocumentationManager.createHyperlink(buffer, JavaDocUtil.getReferenceText(myProject, target), label, plainLink);
|
||||
DocumentationManager.createHyperlink(buffer, JavaDocUtil.getReferenceText(context.getProject(), target), label, plainLink);
|
||||
return label.length();
|
||||
}
|
||||
|
||||
@@ -1456,7 +1456,7 @@ public class JavaDocInfoGenerator {
|
||||
* @return Length of the generated label.
|
||||
*/
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
private int generateType(StringBuilder buffer, PsiType type, PsiElement context) {
|
||||
public static int generateType(StringBuilder buffer, PsiType type, PsiElement context) {
|
||||
if (type instanceof PsiPrimitiveType) {
|
||||
String text = type.getCanonicalText();
|
||||
buffer.append(text);
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class ExplicitTypeCanBeDiamondInspection extends BaseJavaLocalInspectionT
|
||||
final PsiTypeElement[] typeElements = parameterList.getTypeParameterElements();
|
||||
if (typeElements.length > 0) {
|
||||
if (typeElements.length == 1 && typeElements[0].getType() instanceof PsiDiamondType) return;
|
||||
holder.registerProblem(parameterList, "Can be replaced",
|
||||
holder.registerProblem(parameterList, "Redundant type argument #ref #loc",
|
||||
new LocalQuickFix() {
|
||||
@NotNull
|
||||
@Override
|
||||
|
||||
@@ -184,6 +184,7 @@ public class JavaLanguageCodeStyleSettingsProvider extends LanguageCodeStyleSett
|
||||
" int\n" +
|
||||
"i = 0;\n" +
|
||||
" int[] a = new int[] {1, 2, 0x0052, 0x0053, 0x0054};\n" +
|
||||
" int var1 = 1; int var2 = 2;\n" +
|
||||
" foo1(0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057);\n" +
|
||||
" int x = (3 + 4 + 5 + 6) * (7 + 8 + 9 + 10) * (11 + 12 + 13 + 14 + 0xFFFFFFFF);\n" +
|
||||
" String s1, s2, s3;\n" +
|
||||
|
||||
@@ -164,11 +164,11 @@ public class PackageUtil {
|
||||
if (isFQNameShown) {
|
||||
name = settings.isAbbreviatePackageNames() ? TreeViewUtil.calcAbbreviatedPackageFQName(aPackage) : aPackage.getQualifiedName();
|
||||
}
|
||||
else if (parentPackageInTree != null) {
|
||||
else if (parentPackageInTree != null || (aPackage != null && aPackage.getParentPackage() != null)) {
|
||||
PsiPackage parentPackage = aPackage.getParentPackage();
|
||||
final StringBuilder buf = new StringBuilder();
|
||||
buf.append(aPackage.getName());
|
||||
while (parentPackage != null && !parentPackage.equals(parentPackageInTree)) {
|
||||
while (parentPackage != null && (parentPackageInTree == null || !parentPackage.equals(parentPackageInTree))) {
|
||||
final String parentPackageName = parentPackage.getName();
|
||||
if (parentPackageName == null || "".equals(parentPackageName)) {
|
||||
break; // reached default package
|
||||
|
||||
@@ -95,87 +95,12 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
return getExternalJavaDocUrl(element);
|
||||
}
|
||||
|
||||
private static void newLine(StringBuffer buffer) {
|
||||
private static void newLine(StringBuilder buffer) {
|
||||
// Don't know why space has to be added after newline for good text alignment...
|
||||
buffer.append("\n ");
|
||||
}
|
||||
|
||||
private static void generateType(@NonNls StringBuffer buffer, PsiType type, PsiElement context) {
|
||||
if (type instanceof PsiPrimitiveType) {
|
||||
buffer.append(type.getCanonicalText());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (type instanceof PsiWildcardType) {
|
||||
PsiWildcardType wc = ((PsiWildcardType)type);
|
||||
PsiType bound = wc.getBound();
|
||||
|
||||
buffer.append("?");
|
||||
|
||||
if (bound != null) {
|
||||
buffer.append(wc.isExtends() ? " extends " : " super ");
|
||||
generateType(buffer, bound, context);
|
||||
}
|
||||
}
|
||||
|
||||
if (type instanceof PsiArrayType) {
|
||||
generateType(buffer, ((PsiArrayType)type).getComponentType(), context);
|
||||
if (type instanceof PsiEllipsisType) {
|
||||
buffer.append("...");
|
||||
}
|
||||
else {
|
||||
buffer.append("[]");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (type instanceof PsiClassType) {
|
||||
PsiClassType.ClassResolveResult result = ((PsiClassType)type).resolveGenerics();
|
||||
PsiClass psiClass = result.getElement();
|
||||
PsiSubstitutor psiSubst = result.getSubstitutor();
|
||||
|
||||
if (psiClass == null || psiClass instanceof PsiTypeParameter) {
|
||||
buffer.append(type.getPresentableText());
|
||||
return;
|
||||
}
|
||||
|
||||
buffer.append(JavaDocUtil.getShortestClassName(psiClass, context));
|
||||
|
||||
if (psiClass.hasTypeParameters()) {
|
||||
StringBuffer subst = new StringBuffer();
|
||||
boolean goodSubst = true;
|
||||
|
||||
PsiTypeParameter[] params = psiClass.getTypeParameters();
|
||||
|
||||
subst.append("<");
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
PsiType t = psiSubst.substitute(params[i]);
|
||||
|
||||
if (t == null) {
|
||||
goodSubst = false;
|
||||
break;
|
||||
}
|
||||
|
||||
generateType(subst, t, context);
|
||||
|
||||
if (i < params.length - 1) {
|
||||
subst.append(", ");
|
||||
}
|
||||
}
|
||||
|
||||
if (goodSubst) {
|
||||
subst.append(">");
|
||||
String text = subst.toString();
|
||||
|
||||
buffer.append(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateInitializer(StringBuffer buffer, PsiVariable variable) {
|
||||
private static void generateInitializer(StringBuilder buffer, PsiVariable variable) {
|
||||
PsiExpression initializer = variable.getInitializer();
|
||||
if (initializer != null) {
|
||||
String text = initializer.getText().trim();
|
||||
@@ -194,7 +119,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateModifiers(StringBuffer buffer, PsiElement element) {
|
||||
private static void generateModifiers(StringBuilder buffer, PsiElement element) {
|
||||
String modifiers = PsiFormatUtil.formatModifiers(element, PsiFormatUtil.JAVADOC_MODIFIERS_ONLY);
|
||||
|
||||
if (modifiers.length() > 0) {
|
||||
@@ -209,7 +134,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
private static String generateClassInfo(PsiClass aClass) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
if (aClass instanceof PsiAnonymousClass) return LangBundle.message("java.terms.anonymous.class");
|
||||
|
||||
@@ -266,7 +191,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
buffer.append(" extends ");
|
||||
|
||||
for (int j = 0; j < refs.length; j++) {
|
||||
generateType(buffer, refs[j], aClass);
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[j], aClass);
|
||||
|
||||
if (j < refs.length - 1) {
|
||||
buffer.append(" & ");
|
||||
@@ -293,7 +218,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
}
|
||||
else {
|
||||
for (int i = 0; i < refs.length; i++) {
|
||||
generateType(buffer, refs[i], aClass);
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[i], aClass);
|
||||
|
||||
if (i < refs.length - 1) {
|
||||
buffer.append(", ");
|
||||
@@ -308,7 +233,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
newLine(buffer);
|
||||
buffer.append("implements ");
|
||||
for (int i = 0; i < refs.length; i++) {
|
||||
generateType(buffer, refs[i], aClass);
|
||||
JavaDocInfoGenerator.generateType(buffer, refs[i], aClass);
|
||||
|
||||
if (i < refs.length - 1) {
|
||||
buffer.append(", ");
|
||||
@@ -321,7 +246,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public static String generateMethodInfo(PsiMethod method) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
PsiClass parentClass = method.getContainingClass();
|
||||
|
||||
@@ -335,7 +260,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
PsiTypeParameter[] params = method.getTypeParameters();
|
||||
|
||||
if (params.length > 0) {
|
||||
buffer.append("<");
|
||||
buffer.append("<");
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
PsiTypeParameter param = params[i];
|
||||
|
||||
@@ -347,7 +272,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
buffer.append(" extends ");
|
||||
|
||||
for (int j = 0; j < extendees.length; j++) {
|
||||
generateType(buffer, extendees[j], method);
|
||||
JavaDocInfoGenerator.generateType(buffer, extendees[j], method);
|
||||
|
||||
if (j < extendees.length - 1) {
|
||||
buffer.append(" & ");
|
||||
@@ -359,11 +284,11 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
buffer.append(", ");
|
||||
}
|
||||
}
|
||||
buffer.append("> ");
|
||||
buffer.append("< ");
|
||||
}
|
||||
|
||||
if (method.getReturnType() != null) {
|
||||
generateType(buffer, method.getReturnType(), method);
|
||||
JavaDocInfoGenerator.generateType(buffer, method.getReturnType(), method);
|
||||
buffer.append(" ");
|
||||
}
|
||||
|
||||
@@ -373,7 +298,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
PsiParameter[] parms = method.getParameterList().getParameters();
|
||||
for (int i = 0; i < parms.length; i++) {
|
||||
PsiParameter parm = parms[i];
|
||||
generateType(buffer, parm.getType(), method);
|
||||
JavaDocInfoGenerator.generateType(buffer, parm.getType(), method);
|
||||
buffer.append(" ");
|
||||
if (parm.getName() != null) {
|
||||
buffer.append(parm.getName());
|
||||
@@ -409,7 +334,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
}
|
||||
|
||||
private static String generateFieldInfo(PsiField field) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
PsiClass parentClass = field.getContainingClass();
|
||||
|
||||
if (parentClass != null && !(parentClass instanceof PsiAnonymousClass)) {
|
||||
@@ -419,7 +344,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
|
||||
generateModifiers(buffer, field);
|
||||
|
||||
generateType(buffer, field.getType(), field);
|
||||
JavaDocInfoGenerator.generateType(buffer, field.getType(), field);
|
||||
buffer.append(" ");
|
||||
buffer.append(field.getName());
|
||||
|
||||
@@ -429,11 +354,11 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
}
|
||||
|
||||
private static String generateVariableInfo(PsiVariable variable) {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
|
||||
generateModifiers(buffer, variable);
|
||||
|
||||
generateType(buffer, variable.getType(), variable);
|
||||
JavaDocInfoGenerator.generateType(buffer, variable.getType(), variable);
|
||||
|
||||
buffer.append(" ");
|
||||
|
||||
@@ -582,7 +507,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
final CandidateInfo[] candidates = rh.getReferencedMethodCandidates(expr, true);
|
||||
final String text = expr.getText();
|
||||
if (candidates.length > 0) {
|
||||
@NonNls final StringBuffer sb = new StringBuffer();
|
||||
@NonNls final StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (final CandidateInfo candidate : candidates) {
|
||||
final PsiElement element = candidate.getElement();
|
||||
@@ -603,7 +528,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider, Ext
|
||||
return CodeInsightBundle.message("javadoc.candidates.not.found", text);
|
||||
}
|
||||
|
||||
private static void createElementLink(@NonNls final StringBuffer sb, final PsiElement element, final String str) {
|
||||
private static void createElementLink(@NonNls final StringBuilder sb, final PsiElement element, final String str) {
|
||||
sb.append(" <a href=\"psi_element://");
|
||||
sb.append(JavaDocUtil.getReferenceText(element.getProject(), element));
|
||||
sb.append("\">");
|
||||
|
||||
@@ -723,14 +723,20 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
.createDependentLFSpacing(0, 1, textRange, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_BEFORE_RBRACE);
|
||||
}
|
||||
}
|
||||
else if (myChild1.getElementType() == JavaElementType.SWITCH_LABEL_STATEMENT && myChild2.getElementType() ==
|
||||
JavaElementType
|
||||
.BLOCK_STATEMENT) {
|
||||
else if (myChild1.getElementType() == JavaElementType.SWITCH_LABEL_STATEMENT
|
||||
&& myChild2.getElementType() == JavaElementType.BLOCK_STATEMENT)
|
||||
{
|
||||
myResult = getSpaceBeforeLBrace(mySettings.SPACE_BEFORE_SWITCH_LBRACE, mySettings.BRACE_STYLE, null, false, true);
|
||||
|
||||
}
|
||||
else if (myRole1 == ChildRole.STATEMENT_IN_BLOCK && myRole2 == ChildRole.STATEMENT_IN_BLOCK) {
|
||||
myResult = Spacing.createSpacing(0, 0, 1, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
int minSpaces = 0;
|
||||
int minLineFeeds = 1;
|
||||
if (mySettings.KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE) {
|
||||
minSpaces = 1;
|
||||
minLineFeeds = 0;
|
||||
}
|
||||
myResult = Spacing.createSpacing(minSpaces, 0, minLineFeeds, mySettings.KEEP_LINE_BREAKS, mySettings.KEEP_BLANK_LINES_IN_CODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,15 @@ import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.formatter.FormatterUtil;
|
||||
import com.intellij.psi.impl.source.tree.ElementType;
|
||||
import com.intellij.psi.impl.source.tree.JavaDocElementType;
|
||||
import com.intellij.psi.impl.source.tree.JavaElementType;
|
||||
import com.intellij.psi.impl.source.tree.StdTokenSets;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SimpleJavaBlock extends AbstractJavaBlock {
|
||||
|
||||
@@ -102,7 +106,11 @@ public class SimpleJavaBlock extends AbstractJavaBlock {
|
||||
} else {
|
||||
return super.getChildAttributes(newChildIndex);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else if (myNode.getElementType() == JavaElementType.SWITCH_LABEL_STATEMENT) {
|
||||
return new ChildAttributes(Indent.getNormalIndent(), null);
|
||||
}
|
||||
else {
|
||||
return super.getChildAttributes(newChildIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,8 @@ import com.intellij.formatting.*;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.formatter.common.AbstractBlock;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -84,13 +86,36 @@ public class SyntheticCodeBlock implements Block, JavaBlock{
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
final ASTNode treeNode = ((AbstractBlock)mySubBlocks.get(0)).getNode();
|
||||
ASTNode treeNode = null;
|
||||
Block child = mySubBlocks.get(0);
|
||||
while (treeNode == null) {
|
||||
if (child instanceof AbstractBlock) {
|
||||
treeNode = ((AbstractBlock)child).getNode();
|
||||
}
|
||||
else if (child instanceof SyntheticCodeBlock) {
|
||||
child = ((SyntheticCodeBlock)child).mySubBlocks.get(0);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
final TextRange textRange = getTextRange();
|
||||
return treeNode.getPsi().getContainingFile().getText().subSequence(textRange.getStartOffset(), textRange.getEndOffset()).toString();
|
||||
if (treeNode != null) {
|
||||
PsiElement psi = treeNode.getPsi();
|
||||
if (psi != null) {
|
||||
PsiFile file = psi.getContainingFile();
|
||||
if (file != null) {
|
||||
return file.getText().subSequence(textRange.getStartOffset(), textRange.getEndOffset()) + " " + textRange;
|
||||
}
|
||||
}
|
||||
}
|
||||
return getClass().getName() + ": " + textRange;
|
||||
}
|
||||
|
||||
public ASTNode getFirstTreeNode() {
|
||||
return AbstractJavaBlock.getTreeNode(mySubBlocks.get(0));
|
||||
ASTNode result = AbstractJavaBlock.getTreeNode(mySubBlocks.get(0));
|
||||
assert result != null;
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setChildAttributes(final ChildAttributes childAttributes) {
|
||||
|
||||
@@ -241,21 +241,26 @@ public class JavaPsiFacadeImpl extends JavaPsiFacadeEx implements Disposable {
|
||||
|
||||
public PsiPackage findPackage(@NotNull String qualifiedName) {
|
||||
PsiPackage aPackage = myPackageCache.get(qualifiedName);
|
||||
if (aPackage == null) {
|
||||
if (DumbService.getInstance(getProject()).isDumb()) {
|
||||
return findPackageDefault(qualifiedName);
|
||||
}
|
||||
if (aPackage != null) {
|
||||
return aPackage;
|
||||
}
|
||||
|
||||
for (PsiElementFinder finder : myElementFinders) {
|
||||
aPackage = finder.findPackage(qualifiedName);
|
||||
if (aPackage != null) {
|
||||
aPackage = ConcurrencyUtil.cacheOrGet(myPackageCache, qualifiedName, aPackage);
|
||||
break;
|
||||
}
|
||||
if (DumbService.getInstance(getProject()).isDumb()) {
|
||||
aPackage = findPackageDefault(qualifiedName);
|
||||
if (aPackage != null) {
|
||||
return ConcurrencyUtil.cacheOrGet(myPackageCache, qualifiedName, aPackage);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
for (PsiElementFinder finder : myElementFinders) {
|
||||
aPackage = finder.findPackage(qualifiedName);
|
||||
if (aPackage != null) {
|
||||
return ConcurrencyUtil.cacheOrGet(myPackageCache, qualifiedName, aPackage);
|
||||
}
|
||||
}
|
||||
|
||||
return aPackage;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+6
-1
@@ -53,6 +53,11 @@ public abstract class JavaExtractSuperBaseDialog extends ExtractSuperBaseDialog<
|
||||
RefactoringBundle.message("choose.destination.package"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTargetPackageName() {
|
||||
return ((PackageNameReferenceEditorCombo)myPackageNameField).getText().trim();
|
||||
}
|
||||
|
||||
protected JTextField createSourceClassField() {
|
||||
JTextField result = new JTextField();
|
||||
result.setEditable(false);
|
||||
@@ -109,4 +114,4 @@ public abstract class JavaExtractSuperBaseDialog extends ExtractSuperBaseDialog<
|
||||
? null
|
||||
: RefactoringMessageUtil.getIncorrectIdentifierMessage(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-1
@@ -31,7 +31,13 @@ import java.util.Collection;
|
||||
*/
|
||||
public class AutomaticTestRenamerFactory implements AutomaticRenamerFactory {
|
||||
public boolean isApplicable(final PsiElement element) {
|
||||
return element instanceof PsiClass;
|
||||
if (element instanceof PsiClass) {
|
||||
final String qualifiedName = ((PsiClass)element).getQualifiedName();
|
||||
if (qualifiedName != null) {
|
||||
return !qualifiedName.endsWith("Test") && !qualifiedName.endsWith("TestCase");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getOptionName() {
|
||||
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.intellij.codeInsight.editorActions;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
* @since 02/02/2011
|
||||
*/
|
||||
public class JavadocTypedHandlerTest {
|
||||
|
||||
private static final String CARET_MARKER = "<caret>";
|
||||
|
||||
@Test
|
||||
public void correctEmptyTagStart() {
|
||||
doTest("<first></first><second><caret>", "second");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void standaloneBracket() {
|
||||
doTest("asdf ><caret>", null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyElement() {
|
||||
doTest("<tag/><caret>", null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void closingTag() {
|
||||
doTest("<tag></tag><caret>", null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startTagOnNewLine() {
|
||||
doTest("<t\nag><caret>", null);
|
||||
}
|
||||
|
||||
private static void doTest(String text, String expected) {
|
||||
StringBuilder normalized = new StringBuilder();
|
||||
int offset = text.indexOf(CARET_MARKER);
|
||||
normalized.append(text.substring(0, offset));
|
||||
normalized.append(text.substring(offset + CARET_MARKER.length()));
|
||||
CharSequence actual = JavadocTypedHandler.getTagName(normalized.toString(), offset);
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Bar {
|
||||
private static class Zooooooo extends Bar {
|
||||
{
|
||||
Zoooo<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class Bar {
|
||||
private static class Zooooooo extends Bar {
|
||||
{
|
||||
Zooooooo<caret>
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
-1
@@ -3,4 +3,43 @@ import java.util.List;
|
||||
|
||||
class Test {
|
||||
List<String> queue = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
class DD {
|
||||
P1<P<String>> l = new L<String>() {
|
||||
@Override
|
||||
void f() {
|
||||
}
|
||||
};
|
||||
|
||||
P1<P<String>> l1 = new L<>();
|
||||
|
||||
P1<P<String>> foo() {
|
||||
return new L<>();
|
||||
}
|
||||
|
||||
String s = "";
|
||||
}
|
||||
|
||||
class L<K> extends P1<P<K>> {
|
||||
void f() {
|
||||
}
|
||||
}
|
||||
|
||||
class P1<P1T> extends P<P1T> {
|
||||
}
|
||||
|
||||
class P<PT> {
|
||||
}
|
||||
|
||||
|
||||
class Test1 {
|
||||
void bar() {
|
||||
foo(new FF<>());
|
||||
}
|
||||
|
||||
void foo(F<F<String>> p) {}
|
||||
}
|
||||
|
||||
class FF<X> extends F<X>{}
|
||||
class F<T> {}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Add 'junit.jar' to classpath" "true"
|
||||
package x;
|
||||
|
||||
public class DoTest4junit {
|
||||
@org.ju<caret>nit.Test
|
||||
void f() {
|
||||
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Rename Reference" "true"
|
||||
class c {
|
||||
void foo(boolean b) {
|
||||
if (b) {
|
||||
int i = 0;
|
||||
i++;
|
||||
} else {
|
||||
i<caret>++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class C {
|
||||
void foo() {
|
||||
if (a || b &<caret>& c) {
|
||||
call();
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
@@ -888,6 +888,8 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
|
||||
public void testNoDotOverwrite() throws Exception { doTest('.') }
|
||||
|
||||
public void testStaticInnerExtendingOuter() throws Exception { doTest() }
|
||||
|
||||
public void testNoMethodsInParameterType() {
|
||||
configure()
|
||||
assertOrderedEquals myFixture.lookupElementStrings, "final", "float"
|
||||
|
||||
@@ -133,6 +133,10 @@ public class OrderEntryTest extends DaemonAnalyzerTestCase {
|
||||
doTest("A/src/x/DoTest4.java");
|
||||
}
|
||||
|
||||
public void testAddJunit4inJunit() throws Exception {
|
||||
doTest("A/src/x/DoTest4junit.java");
|
||||
}
|
||||
|
||||
public void testExistingJunit() throws Exception {
|
||||
doTest("B/src/y/AddExistingJunit.java");
|
||||
}
|
||||
|
||||
@@ -51,6 +51,12 @@ public class SplitIfActionTest extends LightCodeInsightTestCase {
|
||||
checkResultByFile("/codeInsight/splitIfAction/afterOrParenthesis.java");
|
||||
}
|
||||
|
||||
public void test8() throws Exception {
|
||||
configureByFile("/codeInsight/splitIfAction/beforeOrAndMixed.java");
|
||||
SplitIfAction action = new SplitIfAction();
|
||||
assertFalse(action.isAvailable(getProject(), getEditor(), getFile()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void perform() throws Exception {
|
||||
|
||||
@@ -239,4 +239,21 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
|
||||
"\n}"
|
||||
);
|
||||
}
|
||||
|
||||
public void testMultipleExpressionInSameLine() throws Exception {
|
||||
// Inspired by IDEA-64975.
|
||||
|
||||
getSettings().KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = true;
|
||||
doMethodTest(
|
||||
"int i = 1; int j = 2;",
|
||||
"int i = 1; int j = 2;"
|
||||
);
|
||||
|
||||
getSettings().KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = false;
|
||||
doMethodTest(
|
||||
"int i = 1; int j = 2;",
|
||||
"int i = 1;\n" +
|
||||
"int j = 2;"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,14 +130,30 @@ public class PsiDiamondType extends PsiType {
|
||||
}
|
||||
} else if (parent instanceof PsiVariable) {
|
||||
return getComponentTypes((PsiVariable)parent);
|
||||
} else if (parent instanceof PsiReturnStatement) {
|
||||
final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(parent, PsiMethod.class);
|
||||
if (containingMethod != null) {
|
||||
final PsiType returnType = containingMethod.getReturnType();
|
||||
if (returnType != null) {
|
||||
final PsiExpression returnValue = ((PsiReturnStatement)parent).getReturnValue();
|
||||
if (returnValue instanceof PsiNewExpression) {
|
||||
return getComponentTypes(returnType, returnValue);
|
||||
}
|
||||
return getComponentTypes(returnType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL_TYPES;
|
||||
}
|
||||
|
||||
private static PsiType[] getComponentTypes(PsiVariable declaredElement) {
|
||||
PsiType lType = declaredElement.getType();
|
||||
final PsiType lType = declaredElement.getType();
|
||||
final PsiExpression initializer = declaredElement.getInitializer();
|
||||
return getComponentTypes(lType, initializer);
|
||||
}
|
||||
|
||||
private static PsiType[] getComponentTypes(PsiType lType, PsiExpression initializer) {
|
||||
if (initializer instanceof PsiNewExpression) {
|
||||
final PsiNewExpression newExpression = (PsiNewExpression)initializer;
|
||||
final PsiJavaCodeReferenceElement classReference = newExpression.getClassOrAnonymousClassReference();
|
||||
@@ -145,7 +161,7 @@ public class PsiDiamondType extends PsiType {
|
||||
final String text = classReference.getReferenceName();
|
||||
if (text != null) {
|
||||
final PsiClass psiClass =
|
||||
JavaPsiFacade.getInstance(declaredElement.getProject()).getResolveHelper().resolveReferencedClass(text, initializer);
|
||||
JavaPsiFacade.getInstance(initializer.getProject()).getResolveHelper().resolveReferencedClass(text, initializer);
|
||||
final PsiType substitute = substitute(psiClass, lType);
|
||||
if (substitute != null) {
|
||||
lType = substitute;
|
||||
|
||||
BIN
Binary file not shown.
@@ -10,7 +10,9 @@ coverage-report.jar
|
||||
coverage-report-idea.jar
|
||||
commons-codec-1.3.jar
|
||||
commons-collections.jar
|
||||
commons-httpclient-3.1-patched.jar
|
||||
commons-lang-2.4.jar
|
||||
commons-logging-1.1.1.jar
|
||||
emma.jar
|
||||
freemarker.jar
|
||||
jdom.jar
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 338 B |
Binary file not shown.
|
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 348 B |
@@ -654,6 +654,7 @@ public class CommonCodeStyleSettings {
|
||||
|
||||
public boolean KEEP_SIMPLE_BLOCKS_IN_ONE_LINE = false;
|
||||
public boolean KEEP_SIMPLE_METHODS_IN_ONE_LINE = false;
|
||||
public boolean KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE = false;
|
||||
|
||||
public int FOR_STATEMENT_WRAP = DO_NOT_WRAP;
|
||||
public boolean FOR_STATEMENT_LPAREN_ON_NEXT_LINE = false;
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.psi.filters.ElementFilter;
|
||||
|
||||
/**
|
||||
* Provides association for elements matching given filter with metadata class.
|
||||
* @see MetaDataContributor
|
||||
*/
|
||||
public abstract class MetaDataRegistrar {
|
||||
/**
|
||||
|
||||
@@ -13,14 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.psi.stubs;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.LogUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -40,6 +37,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
public class SerializationManagerImpl extends SerializationManager implements ApplicationComponent {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.SerializationManagerImpl");
|
||||
|
||||
@@ -213,7 +213,7 @@ public class SerializationManagerImpl extends SerializationManager implements Ap
|
||||
|
||||
private int getClassId(final StubSerializer serializer) {
|
||||
final Integer idValue = mySerializerToId.get(serializer);
|
||||
assert idValue != null: "No ID found for serializer " + serializer;
|
||||
assert idValue != null: "No ID found for serializer " + LogUtil.objectAndClass(serializer);
|
||||
return idValue.intValue();
|
||||
}
|
||||
|
||||
@@ -238,4 +238,3 @@ public class SerializationManagerImpl extends SerializationManager implements Ap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,16 +13,15 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
package com.intellij.psi.stubs;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/*
|
||||
* @author max
|
||||
*/
|
||||
public interface StubSerializer<T extends StubElement> {
|
||||
@NonNls
|
||||
String getExternalId();
|
||||
|
||||
@@ -28,6 +28,6 @@ public interface RenameHandler extends RefactoringActionHandler {
|
||||
|
||||
// called during rename action update. should not perform any user interactions
|
||||
boolean isAvailableOnDataContext(DataContext dataContext);
|
||||
// called on rename actionPeformed. Can obtain additional info from user
|
||||
// called on rename actionPerformed. Can obtain additional info from user
|
||||
boolean isRenaming(DataContext dataContext);
|
||||
}
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class WrappingAndBracesPanel extends OptionTableWithPreviewPanel {
|
||||
addOption("KEEP_CONTROL_STATEMENT_IN_ONE_LINE", ApplicationBundle.message("checkbox.keep.when.reformatting.control.statement.in.one.line"),
|
||||
WRAPPING_KEEP);
|
||||
addOption("KEEP_SIMPLE_BLOCKS_IN_ONE_LINE", ApplicationBundle.message("wrapping.keep.simple.blocks.in.one.line"), WRAPPING_KEEP);
|
||||
addOption("KEEP_SIMPLE_METHODS_IN_ONE_LINE", ApplicationBundle.message("wrapping.keep.simple.methods.in.one.line"), WRAPPING_KEEP);
|
||||
addOption("KEEP_MULTIPLE_EXPRESSIONS_IN_ONE_LINE", ApplicationBundle.message("wrapping.keep.multiple.expressions.in.one.line"), WRAPPING_KEEP);
|
||||
|
||||
addOption("CLASS_BRACE_STYLE", ApplicationBundle.message("wrapping.brace.placement.class.declaration"), WRAPPING_BRACES, BRACE_PLACEMENT_OPTIONS, BRACE_PLACEMENT_VALUES);
|
||||
addOption("METHOD_BRACE_STYLE", ApplicationBundle.message("wrapping.brace.placement.method.declaration"), WRAPPING_BRACES, BRACE_PLACEMENT_OPTIONS, BRACE_PLACEMENT_VALUES);
|
||||
|
||||
@@ -103,6 +103,7 @@ public class CodeInsightSettings implements PersistentStateComponent<Element>, C
|
||||
public boolean INSERT_SCRIPTLET_END_ON_ENTER = true;
|
||||
public boolean JAVADOC_STUB_ON_ENTER = true;
|
||||
public boolean SMART_END_ACTION = true;
|
||||
public boolean JAVADOC_GENERATE_CLOSING_TAG = true;
|
||||
|
||||
public boolean SURROUND_SELECTION_ON_QUOTE_TYPED = false;
|
||||
|
||||
|
||||
+17
-8
@@ -55,6 +55,7 @@ import com.intellij.profile.codeInspection.SeverityProvider;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
|
||||
import com.intellij.util.ConcurrencyUtil;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ConcurrentHashMap;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
@@ -75,6 +76,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
*/
|
||||
public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass implements DumbAware {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.LocalInspectionsPass");
|
||||
private static final int NUM_ELEMENTS_PER_CHECK_CANCELLED = 5;
|
||||
private final int myStartOffset;
|
||||
private final int myEndOffset;
|
||||
private final TextRange myPriorityRange;
|
||||
@@ -104,8 +106,15 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
else {
|
||||
myShortcutText = "";
|
||||
}
|
||||
InspectionProfileWrapper customProfile = file.getUserData(InspectionProfileWrapper.KEY);
|
||||
myProfileWrapper = customProfile == null ? InspectionProjectProfileManager.getInstance(myProject).getProfileWrapper() : customProfile;
|
||||
InspectionProfileWrapper profileToUse = InspectionProjectProfileManager.getInstance(myProject).getProfileWrapper();
|
||||
|
||||
Function<InspectionProfileWrapper,InspectionProfileWrapper> customizationStrategy
|
||||
= file.getUserData(InspectionProfileWrapper.CUSTOMIZATION_KEY);
|
||||
if (customizationStrategy != null) {
|
||||
profileToUse = customizationStrategy.fun(profileToUse);
|
||||
}
|
||||
|
||||
myProfileWrapper = profileToUse;
|
||||
mySeverityRegistrar = ((SeverityProvider)myProfileWrapper.getInspectionProfile().getProfileManager()).getSeverityRegistrar();
|
||||
LOG.assertTrue(mySeverityRegistrar != null);
|
||||
|
||||
@@ -304,9 +313,10 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
: "The visitor returned from LocalInspectionTool.buildVisitor() must not be recursive. "+tool;
|
||||
|
||||
tool.inspectionStarted(session);
|
||||
for (PsiElement element : elements) {
|
||||
indicator.checkCanceled();
|
||||
element.accept(visitor);
|
||||
int size = elements.size();
|
||||
for (int i = 0; i < size; ++i) {
|
||||
elements.get(i).accept(visitor);
|
||||
if (i % NUM_ELEMENTS_PER_CHECK_CANCELLED == 0) indicator.checkCanceled();
|
||||
}
|
||||
return visitor;
|
||||
}
|
||||
@@ -331,9 +341,8 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
ProblemsHolder holder = trinity.second;
|
||||
PsiElementVisitor elementVisitor = trinity.third;
|
||||
for (int i = 0, elementsSize = elements.size(); i < elementsSize; i++) {
|
||||
PsiElement element = elements.get(i);
|
||||
indicator.checkCanceled();
|
||||
element.accept(elementVisitor);
|
||||
elements.get(i).accept(elementVisitor);
|
||||
if (i % NUM_ELEMENTS_PER_CHECK_CANCELLED == 0) indicator.checkCanceled();
|
||||
}
|
||||
|
||||
advanceProgress(1);
|
||||
|
||||
@@ -339,7 +339,7 @@ public class EnterHandler extends BaseEnterHandler {
|
||||
myOffset = codeStyleManager.adjustLineIndent(myFile, myOffset);
|
||||
PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
|
||||
|
||||
if (!StringUtil.isEmpty(indentInsideJavadoc)) {
|
||||
if (!StringUtil.isEmpty(indentInsideJavadoc) && myOffset < myDocument.getTextLength()) {
|
||||
myDocument.insertString(myOffset + 1, indentInsideJavadoc);
|
||||
myOffset += indentInsideJavadoc.length();
|
||||
docIndentApplied = true;
|
||||
@@ -347,7 +347,6 @@ public class EnterHandler extends BaseEnterHandler {
|
||||
|
||||
if (myForceIndent && indentInsideJavadoc != null) {
|
||||
int indentSize = CodeStyleSettingsManager.getSettings(myProject).getIndentSize(myFile.getFileType());
|
||||
//TODO den check tabs
|
||||
myDocument.insertString(myOffset + 1, StringUtil.repeatSymbol(' ', indentSize));
|
||||
myCaretAdvance += indentSize;
|
||||
}
|
||||
|
||||
+67
-19
@@ -33,6 +33,7 @@ import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -52,7 +53,8 @@ public class EnterAfterUnmatchedBraceHandler implements EnterHandlerDelegate {
|
||||
CharSequence text = document.getCharsSequence();
|
||||
Project project = file.getProject();
|
||||
int caretOffset = caretOffsetRef.get().intValue();
|
||||
if (!CodeInsightSettings.getInstance().INSERT_BRACE_ON_ENTER || !isAfterUnmatchedLBrace(editor, caretOffset, file.getFileType())) {
|
||||
int unmatchedLBracesNumber = getUnmatchedLBracesNumberBefore(editor, caretOffset, file.getFileType());
|
||||
if (!CodeInsightSettings.getInstance().INSERT_BRACE_ON_ENTER || unmatchedLBracesNumber <= 0) {
|
||||
return Result.Continue;
|
||||
}
|
||||
|
||||
@@ -81,7 +83,21 @@ public class EnterAfterUnmatchedBraceHandler implements EnterHandlerDelegate {
|
||||
// That is formatted incorrectly because line feed between 'else' and 'if' is not inserted yet (whole 'if' block is indent anchor
|
||||
// to 'if' code block('{}')). So, we insert temporary line feed between 'if' and 'else', correct indent and remove that temporary
|
||||
// line feed.
|
||||
document.insertString(offset, "\n}");
|
||||
int bracesToInsert = 0;
|
||||
outer:
|
||||
for (int i = caretOffset - 1; unmatchedLBracesNumber > 0 && i >= 0 && bracesToInsert < unmatchedLBracesNumber; i--) {
|
||||
char c = text.charAt(i);
|
||||
switch (c) {
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\t':
|
||||
continue;
|
||||
case '{': bracesToInsert++; break;
|
||||
default: break outer;
|
||||
}
|
||||
}
|
||||
bracesToInsert = Math.max(bracesToInsert, 1);
|
||||
document.insertString(offset, "\n" + StringUtil.repeatSymbol('}', bracesToInsert));
|
||||
document.insertString(caretOffset, "\n");
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document);
|
||||
long stamp = document.getModificationStamp();
|
||||
@@ -175,37 +191,69 @@ public class EnterAfterUnmatchedBraceHandler implements EnterHandlerDelegate {
|
||||
}
|
||||
|
||||
public static boolean isAfterUnmatchedLBrace(Editor editor, int offset, FileType fileType) {
|
||||
if (offset == 0) return false;
|
||||
return getUnmatchedLBracesNumberBefore(editor, offset, fileType) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates number of unmatched left braces before the given offset.
|
||||
*
|
||||
* @param editor target editor
|
||||
* @param offset target offset
|
||||
* @param fileType target file type
|
||||
* @return number of unmatched braces before the given offset;
|
||||
* negative value if it's not possible to perform the calculation or if there are no unmatched left braces before
|
||||
* the given offset
|
||||
*/
|
||||
private static int getUnmatchedLBracesNumberBefore(Editor editor, int offset, FileType fileType) {
|
||||
if (offset == 0) {
|
||||
return -1;
|
||||
}
|
||||
CharSequence chars = editor.getDocument().getCharsSequence();
|
||||
if (chars.charAt(offset - 1) != '{') return false;
|
||||
if (chars.charAt(offset - 1) != '{') {
|
||||
return -1;
|
||||
}
|
||||
|
||||
EditorHighlighter highlighter = ((EditorEx)editor).getHighlighter();
|
||||
HighlighterIterator iterator = highlighter.createIterator(offset - 1);
|
||||
BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator);
|
||||
|
||||
if (!braceMatcher.isLBraceToken(iterator, chars, fileType) ||
|
||||
!braceMatcher.isStructuralBrace(iterator, chars, fileType)
|
||||
) {
|
||||
return false;
|
||||
if (!braceMatcher.isLBraceToken(iterator, chars, fileType) || !braceMatcher.isStructuralBrace(iterator, chars, fileType)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Language language = iterator.getTokenType().getLanguage();
|
||||
|
||||
iterator = highlighter.createIterator(0);
|
||||
int balance = 0;
|
||||
while (!iterator.atEnd()) {
|
||||
int lBracesBeforeOffset = 0;
|
||||
int lBracesAfterOffset = 0;
|
||||
int rBracesBeforeOffset = 0;
|
||||
int rBracesAfterOffset = 0;
|
||||
for (; !iterator.atEnd(); iterator.advance()) {
|
||||
IElementType tokenType = iterator.getTokenType();
|
||||
if (tokenType.getLanguage().equals(language)) {
|
||||
if (braceMatcher.isStructuralBrace(iterator, chars, fileType)) {
|
||||
if (braceMatcher.isLBraceToken(iterator, chars, fileType)) {
|
||||
balance++;
|
||||
} else if (braceMatcher.isRBraceToken(iterator, chars, fileType)) {
|
||||
balance--;
|
||||
}
|
||||
if (!tokenType.getLanguage().equals(language) || !braceMatcher.isStructuralBrace(iterator, chars, fileType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
boolean beforeOffset = iterator.getStart() < offset;
|
||||
|
||||
if (braceMatcher.isLBraceToken(iterator, chars, fileType)) {
|
||||
if (beforeOffset) {
|
||||
lBracesBeforeOffset++;
|
||||
}
|
||||
else {
|
||||
lBracesAfterOffset++;
|
||||
}
|
||||
}
|
||||
else if (braceMatcher.isRBraceToken(iterator, chars, fileType)) {
|
||||
if (beforeOffset) {
|
||||
rBracesBeforeOffset++;
|
||||
}
|
||||
else {
|
||||
rBracesAfterOffset++;
|
||||
}
|
||||
}
|
||||
iterator.advance();
|
||||
}
|
||||
return balance > 0;
|
||||
|
||||
return lBracesBeforeOffset - rBracesBeforeOffset - (rBracesAfterOffset - lBracesAfterOffset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
|
||||
getComponent().add(myScrollPane, BorderLayout.NORTH);
|
||||
myScrollPane.setBorder(null);
|
||||
|
||||
myAdComponent = HintUtil.createAdComponent(null);
|
||||
myAdComponent = HintUtil.createAdComponent(null, new EmptyBorder(1, 2, 1, 2 + relevanceSortIcon.getIconWidth()));
|
||||
getComponent().add(myAdComponent, BorderLayout.SOUTH);
|
||||
getComponent().setBorder(new BegPopupMenuBorder());
|
||||
|
||||
@@ -162,7 +162,7 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
|
||||
addListeners();
|
||||
|
||||
mySortingLabel = new JLabel();
|
||||
mySortingLabel.setBorder(new LineBorder(Color.DARK_GRAY));
|
||||
mySortingLabel.setBorder(new LineBorder(Color.LIGHT_GRAY));
|
||||
mySortingLabel.setOpaque(true);
|
||||
mySortingLabel.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
@@ -1112,14 +1112,15 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
|
||||
|
||||
private void layoutStatusIcons() {
|
||||
final JLayeredPane layeredPane = getComponent().getRootPane().getLayeredPane();
|
||||
final int width = layeredPane.getWidth();
|
||||
final int height = layeredPane.getHeight();
|
||||
|
||||
final Dimension iconSize = myProcessIcon.getPreferredSize();
|
||||
myIconPanel.setBounds(width - iconSize.width, 0, iconSize.width, iconSize.height);
|
||||
myIconPanel.setBounds(layeredPane.getWidth() - iconSize.width, 0, iconSize.width, iconSize.height);
|
||||
|
||||
final Dimension sortSize = mySortingLabel.getPreferredSize();
|
||||
mySortingLabel.setBounds(width - sortSize.width, height - sortSize.height, sortSize.width, sortSize.height);
|
||||
final Point sbLocation = SwingUtilities.convertPoint(myScrollPane.getVerticalScrollBar(), 0, 0, layeredPane);
|
||||
|
||||
final int sortHeight = (StringUtil.isNotEmpty(myAdText) ? myAdComponent : mySortingLabel).getPreferredSize().height;
|
||||
mySortingLabel.setBounds(sbLocation.x, layeredPane.getHeight() - sortHeight, sortSize.width, sortHeight);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.Function;
|
||||
import gnu.trove.THashSet;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -37,10 +38,13 @@ public class InspectionProfileWrapper {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.ex.InspectionProfileWrapper");
|
||||
|
||||
/**
|
||||
* Generic-purpose key object that is intended to be used for customizing inspection profile wrapper retrieval
|
||||
* via {@link com.intellij.openapi.util.UserDataHolder} API.
|
||||
* Key that is assumed to hold strategy that customizes {@link InspectionProfileWrapper} object to use.
|
||||
* <p/>
|
||||
* I.e. given strategy (if any) receives {@link InspectionProfileWrapper} object that is going to be used so far and returns
|
||||
* {@link InspectionProfileWrapper} object that should be used later.
|
||||
*/
|
||||
public static final Key<InspectionProfileWrapper> KEY = Key.create("Inspection Profile Wrapper");
|
||||
public static final Key<Function<InspectionProfileWrapper, InspectionProfileWrapper>> CUSTOMIZATION_KEY
|
||||
= Key.create("Inspection Profile Wrapper Customization");
|
||||
private final InspectionProfileImpl myProfile;
|
||||
|
||||
public InspectionProfileWrapper(final InspectionProfile profile) {
|
||||
|
||||
@@ -570,7 +570,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
flushDeferredUserInput();
|
||||
}
|
||||
}
|
||||
if (myFlushAlarm.getActiveRequestCount() == 0 && myEditor != null) {
|
||||
if (myFlushAlarm.getActiveRequestCount() == 0 && myEditor != null && !myFlushAlarm.isDisposed()) {
|
||||
final boolean shouldFlushNow = USE_CYCLIC_BUFFER && myDeferredOutputLength > CYCLIC_BUFFER_SIZE;
|
||||
myFlushAlarm.addRequest(myFlushDeferredRunnable, shouldFlushNow ? 0 : FLUSH_DELAY, getStateForUpdate());
|
||||
}
|
||||
|
||||
@@ -118,6 +118,10 @@ public class FindUsagesManager implements JDOMExternalizable {
|
||||
myAnotherManager = anotherManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see FindUsagesHandlerFactory#EP_NAME
|
||||
*/
|
||||
public void registerFindUsagesHandler(FindUsagesHandlerFactory handler) {
|
||||
myHandlers.add(0, handler);
|
||||
}
|
||||
|
||||
@@ -1128,8 +1128,9 @@ class FormatProcessor {
|
||||
}
|
||||
|
||||
private static int getNewChildPosition(final AbstractBlockWrapper parent, final int offset) {
|
||||
if (!(parent instanceof CompositeBlockWrapper)) return 0;
|
||||
final List<AbstractBlockWrapper> subBlocks = ((CompositeBlockWrapper)parent).getChildren();
|
||||
AbstractBlockWrapper parentBlockToUse = getLastNestedCompositeBlockForSameRange(parent);
|
||||
if (!(parentBlockToUse instanceof CompositeBlockWrapper)) return 0;
|
||||
final List<AbstractBlockWrapper> subBlocks = ((CompositeBlockWrapper)parentBlockToUse).getChildren();
|
||||
//noinspection ConstantConditions
|
||||
if (subBlocks != null) {
|
||||
for (int i = 0; i < subBlocks.size(); i++) {
|
||||
@@ -1159,7 +1160,7 @@ class FormatProcessor {
|
||||
private AbstractBlockWrapper getParentFor(final int offset, LeafBlockWrapper block) {
|
||||
AbstractBlockWrapper previous = getPreviousIncompleteBlock(block, offset);
|
||||
if (previous != null) {
|
||||
return previous;
|
||||
return getLastNestedCompositeBlockForSameRange(previous);
|
||||
}
|
||||
else {
|
||||
return getParentFor(offset, (AbstractBlockWrapper)block);
|
||||
@@ -1215,12 +1216,47 @@ class FormatProcessor {
|
||||
|
||||
@Nullable
|
||||
private static AbstractBlockWrapper getLastChildOf(final AbstractBlockWrapper currentResult) {
|
||||
if (!(currentResult instanceof CompositeBlockWrapper)) return null;
|
||||
final List<AbstractBlockWrapper> subBlocks = ((CompositeBlockWrapper)currentResult).getChildren();
|
||||
AbstractBlockWrapper parentBlockToUse = getLastNestedCompositeBlockForSameRange(currentResult);
|
||||
if (!(parentBlockToUse instanceof CompositeBlockWrapper)) return null;
|
||||
final List<AbstractBlockWrapper> subBlocks = ((CompositeBlockWrapper)parentBlockToUse).getChildren();
|
||||
if (subBlocks.isEmpty()) return null;
|
||||
return subBlocks.get(subBlocks.size() - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* There is a possible case that particular block is a composite block that contains number of nested composite blocks
|
||||
* that all target the same text range. This method allows to derive the most nested block that shares the same range (if any).
|
||||
*
|
||||
* @param block block to check
|
||||
* @return the most nested block of the given one that shares the same text range if any; given block otherwise
|
||||
*/
|
||||
@NotNull
|
||||
private static AbstractBlockWrapper getLastNestedCompositeBlockForSameRange(@NotNull final AbstractBlockWrapper block) {
|
||||
if (!(block instanceof CompositeBlockWrapper)) {
|
||||
return block;
|
||||
}
|
||||
|
||||
AbstractBlockWrapper result = block;
|
||||
AbstractBlockWrapper candidate = block;
|
||||
while (true) {
|
||||
List<AbstractBlockWrapper> subBlocks = ((CompositeBlockWrapper)candidate).getChildren();
|
||||
if (subBlocks == null || subBlocks.size() != 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
candidate = subBlocks.get(0);
|
||||
if (candidate.getStartOffset() == block.getStartOffset() && candidate.getEndOffset() == block.getEndOffset()
|
||||
&& candidate instanceof CompositeBlockWrapper)
|
||||
{
|
||||
result = candidate;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void processBlocksBefore(final int offset) {
|
||||
while (true) {
|
||||
myAlignAgain.clear();
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.impl.source.codeStyle.PreFormatProcessor;
|
||||
import com.intellij.util.Function;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -93,7 +92,7 @@ public class FormatTextRanges {
|
||||
* <code>false</code> otherwise
|
||||
*/
|
||||
public boolean isReadOnly(TextRange range, boolean rootIsRightBlock) {
|
||||
if (myRange.getStartOffset() >= range.getEndOffset() && rootIsRightBlock) {
|
||||
if (myRange == null || myRange.getStartOffset() >= range.getEndOffset() && rootIsRightBlock) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -314,6 +314,15 @@ public class ScopeTreeViewPanel extends JPanel implements JDOMExternalizable, Di
|
||||
}
|
||||
return myDeletePSIElementProvider;
|
||||
}
|
||||
if (LangDataKeys.PASTE_TARGET_PSI_ELEMENT.is(dataId)) {
|
||||
final TreePath selectionPath = myTree.getSelectionPath();
|
||||
if (selectionPath != null) {
|
||||
final Object pathComponent = selectionPath.getLastPathComponent();
|
||||
if (pathComponent instanceof DirectoryNode) {
|
||||
return ((DirectoryNode)pathComponent).getTargetDirectory();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.intellij.openapi.roots.libraries.scripting.ScriptingLibraryTable;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.TableSpeedSearch;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -86,6 +87,7 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
myFileTableModel = new FileTableModel();
|
||||
myFileTable.setRowHeight(myFileTable.getRowHeight() + 5);
|
||||
myFileTable.setModel(myFileTableModel);
|
||||
new TableSpeedSearch(myFileTable);
|
||||
|
||||
myRemoveFileButton.setEnabled(false);
|
||||
myRemoveFileButton.addActionListener(new ActionListener() {
|
||||
@@ -168,7 +170,7 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
if (renderer instanceof JLabel) {
|
||||
VirtualFile file = myFileTableModel.getFileAt(row);
|
||||
if (file != null) {
|
||||
((JLabel)renderer).setToolTipText(file.getPath());
|
||||
((JLabel)renderer).setToolTipText(file.getPresentableUrl());
|
||||
}
|
||||
}
|
||||
return renderer;
|
||||
@@ -221,7 +223,7 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
addRecursively(selectedFile);
|
||||
}
|
||||
else {
|
||||
myFileTableModel.addFile(selectedFile);
|
||||
addSingleFile(selectedFile, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,13 +237,35 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
}
|
||||
else {
|
||||
if (myProvider.acceptsExtension(file.getExtension())) {
|
||||
myFileTableModel.addFile(file);
|
||||
addSingleFile(file, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addSingleFile(VirtualFile file, boolean scrollToAdded) {
|
||||
int index = myFileTableModel.addFile(file);
|
||||
myFileTable.setRowSelectionInterval(index, index);
|
||||
if (scrollToAdded) {
|
||||
Component parent = myFileTable;
|
||||
JScrollPane scrollPane = null;
|
||||
while ((parent = parent.getParent()) != null) {
|
||||
if (parent instanceof JScrollPane) {
|
||||
scrollPane = (JScrollPane)parent;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (scrollPane != null) {
|
||||
JViewport viewPort = scrollPane.getViewport();
|
||||
Point p = viewPort.getViewPosition();
|
||||
Rectangle r = myFileTable.getCellRect(index, 0, true);
|
||||
r.setLocation(r.x - p.x, r.y - p.y + myFileTable.getRowHeight());
|
||||
viewPort.scrollRectToVisible(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class LibFileChooserDescriptor extends FileChooserDescriptor {
|
||||
public LibFileChooserDescriptor() {
|
||||
super (true, true, false, true, false, false);
|
||||
@@ -290,12 +314,13 @@ public class EditLibraryDialog extends DialogWrapper {
|
||||
});
|
||||
private HashSet<VirtualFile> myCompactFiles = new HashSet<VirtualFile>();
|
||||
|
||||
public void addFile(VirtualFile file) {
|
||||
public int addFile(VirtualFile file) {
|
||||
myFiles.add(file);
|
||||
if (myProvider.isCompact(file)) {
|
||||
myCompactFiles.add(file);
|
||||
}
|
||||
fireTableDataChanged();
|
||||
return myFiles.indexOf(file);
|
||||
}
|
||||
|
||||
public void setFiles(Set<VirtualFile> sourceFiles, Set<VirtualFile> compactFiles) {
|
||||
|
||||
+13
-4
@@ -38,6 +38,7 @@ import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.pom.Navigatable;
|
||||
import com.intellij.pom.NavigatableWithText;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
@@ -374,9 +375,12 @@ public class ModulesDependenciesPanel extends JPanel implements ModuleRootListen
|
||||
group.add(actionManager.createExpandAllAction(treeExpander, tree));
|
||||
}
|
||||
group.add(actionManager.createCollapseAllAction(treeExpander, tree));
|
||||
group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE));
|
||||
group.add(ActionManager.getInstance().getAction(IdeActions.MODULE_SETTINGS));
|
||||
appendDependenciesAction(group);
|
||||
final ActionManager globalActionManager = ActionManager.getInstance();
|
||||
group.add(globalActionManager.getAction(IdeActions.ACTION_EDIT_SOURCE));
|
||||
group.add(Separator.getInstance());
|
||||
group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_DEPENDENCIES));
|
||||
group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_BACK_DEPENDENCIES));
|
||||
group.add(globalActionManager.getAction(IdeActions.ACTION_ANALYZE_CYCLIC_DEPENDENCIES));
|
||||
return group;
|
||||
}
|
||||
|
||||
@@ -432,7 +436,7 @@ public class ModulesDependenciesPanel extends JPanel implements ModuleRootListen
|
||||
TreeUtil.selectFirstNode(myLeftTree);
|
||||
}
|
||||
|
||||
private static class MyUserObject implements Navigatable{
|
||||
private static class MyUserObject implements NavigatableWithText{
|
||||
private boolean myInCycle;
|
||||
private final Module myModule;
|
||||
|
||||
@@ -476,6 +480,11 @@ public class ModulesDependenciesPanel extends JPanel implements ModuleRootListen
|
||||
public boolean canNavigateToSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNavigateActionText(boolean focusEditor) {
|
||||
return "Open Module Settings";
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyTreePanel extends JPanel implements DataProvider{
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
package com.intellij.openapi.roots.libraries;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.ui.LibraryEditorComponent;
|
||||
import com.intellij.openapi.roots.libraries.ui.LibraryPropertiesEditor;
|
||||
import com.intellij.openapi.roots.libraries.ui.LibraryRootsComponentDescriptor;
|
||||
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -55,9 +56,9 @@ public abstract class LibraryType<P extends LibraryProperties> extends LibraryPr
|
||||
public abstract P createDefaultProperties();
|
||||
|
||||
/**
|
||||
* @return {@code true} if library of this type can be added as a dependency to a module of type {@code moduleType}
|
||||
* @return {@code true} if library of this type can be added as a dependency to {@code module}
|
||||
*/
|
||||
public boolean isSuitableModuleType(@NotNull ModuleType moduleType) {
|
||||
public boolean isSuitableModule(@NotNull Module module, @NotNull FacetsProvider facetsProvider) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,16 @@ public class DirectoryNode extends PackageDependenciesNode {
|
||||
return myDirectory;
|
||||
}
|
||||
|
||||
public PsiDirectory getTargetDirectory() {
|
||||
DirectoryNode dirNode = this;
|
||||
while (dirNode.getCompactedDirNode() != null) {
|
||||
dirNode = dirNode.getCompactedDirNode();
|
||||
assert dirNode != null;
|
||||
}
|
||||
|
||||
return dirNode.myDirectory;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
+18
-3
@@ -24,6 +24,7 @@ import com.intellij.lang.LanguageFormatting;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
import com.intellij.openapi.editor.actionSystem.EditorActionManager;
|
||||
@@ -52,6 +53,8 @@ import java.util.List;
|
||||
public class CodeFormatterFacade {
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.codeStyle.CodeFormatterFacade");
|
||||
|
||||
private static final String WRAP_LINE_COMMAND_NAME = "AutoWrapLongLine";
|
||||
|
||||
/**
|
||||
* This key is used as a flag that indicates if <code>'wrap long line during formatting'</code> activity is performed now.
|
||||
@@ -262,7 +265,7 @@ public class CodeFormatterFacade {
|
||||
}
|
||||
}
|
||||
|
||||
private void doWrapLongLinesIfNecessary(@NotNull Editor editor, @NotNull Document document, int startOffset, int endOffset) {
|
||||
private void doWrapLongLinesIfNecessary(@NotNull final Editor editor, @NotNull Document document, int startOffset, int endOffset) {
|
||||
// Normalization.
|
||||
int startOffsetToUse = Math.min(document.getTextLength(), Math.max(0, startOffset));
|
||||
int endOffsetToUse = Math.min(document.getTextLength(), Math.max(0, endOffset));
|
||||
@@ -365,7 +368,7 @@ public class CodeFormatterFacade {
|
||||
text, Math.max(startLineOffset, startOffsetToUse), Math.min(endLineOffset, endOffsetToUse), preferredWrapPosition, false
|
||||
);
|
||||
editor.getCaretModel().moveToOffset(wrapOffset);
|
||||
DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
|
||||
final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
|
||||
|
||||
SelectionModel selectionModel = editor.getSelectionModel();
|
||||
int startSelectionOffset = 0;
|
||||
@@ -379,8 +382,20 @@ public class CodeFormatterFacade {
|
||||
int textLengthBeforeWrap = document.getTextLength();
|
||||
|
||||
DataManager.getInstance().saveInDataContext(dataContext, WRAP_LONG_LINE_DURING_FORMATTING_IN_PROGRESS_KEY, true);
|
||||
CommandProcessor commandProcessor = CommandProcessor.getInstance();
|
||||
try {
|
||||
EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ENTER).execute(editor, dataContext);
|
||||
Runnable command = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EditorActionManager.getInstance().getActionHandler(IdeActions.ACTION_EDITOR_ENTER).execute(editor, dataContext);
|
||||
}
|
||||
};
|
||||
if (commandProcessor.getCurrentCommand() == null) {
|
||||
commandProcessor.executeCommand(editor.getProject(), command, WRAP_LINE_COMMAND_NAME, null);
|
||||
}
|
||||
else {
|
||||
command.run();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
DataManager.getInstance().saveInDataContext(dataContext, WRAP_LONG_LINE_DURING_FORMATTING_IN_PROGRESS_KEY, null);
|
||||
|
||||
+1
-1
@@ -147,7 +147,7 @@ public class PsiMultiReference implements PsiPolyVariantReference {
|
||||
@NotNull
|
||||
public ResolveResult[] multiResolve(final boolean incompleteCode) {
|
||||
final PsiReference[] refs = getReferences();
|
||||
List<ResolveResult> result = new ArrayList<ResolveResult>(refs.length);
|
||||
Collection<ResolveResult> result = new LinkedHashSet<ResolveResult>(refs.length);
|
||||
PsiElementResolveResult selfReference = null;
|
||||
for (PsiReference reference : refs) {
|
||||
if (reference instanceof PsiPolyVariantReference) {
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.intellij.psi.impl.source.tree;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.diagnostic.LogUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.ILazyParseableElementType;
|
||||
@@ -164,7 +165,7 @@ public class LazyParseableElement extends CompositeElement {
|
||||
}
|
||||
|
||||
if (TreeUtil.getFileElement(this) == null) {
|
||||
LOG.error("Chameleons must not be parsed till they're in file tree");
|
||||
LOG.error("Chameleons must not be parsed till they're in file tree: " + this);
|
||||
}
|
||||
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
@@ -174,9 +175,9 @@ public class LazyParseableElement extends CompositeElement {
|
||||
|
||||
if (parsedNode == null && myText.length() > 0) {
|
||||
if (ApplicationManagerEx.getApplicationEx().isInternal() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
LOG.error("No parse for a non-empty string: " + myText + "; type=" + getElementType());
|
||||
LOG.error("No parse for a non-empty string: " + myText + "; type=" + LogUtil.objectAndClass(type));
|
||||
} else {
|
||||
LOG.error("No parse for a non-empty string: type=" + getElementType());
|
||||
LOG.error("No parse for a non-empty string: type=" + LogUtil.objectAndClass(type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-5
@@ -57,10 +57,10 @@ public abstract class ExtractSuperBaseDialog<ClassType extends PsiElement, Membe
|
||||
private JLabel myClassNameLabel;
|
||||
private JTextField myExtractedSuperNameField;
|
||||
protected JLabel myPackageNameLabel;
|
||||
protected ComponentWithBrowseButton<EditorComboBox> myPackageNameField;
|
||||
protected ComponentWithBrowseButton myPackageNameField;
|
||||
protected DocCommentPanel myDocCommentPanel;
|
||||
|
||||
protected abstract ComponentWithBrowseButton<EditorComboBox> createPackageNameField();
|
||||
protected abstract ComponentWithBrowseButton createPackageNameField();
|
||||
|
||||
protected abstract JTextField createSourceClassField();
|
||||
|
||||
@@ -194,9 +194,7 @@ public abstract class ExtractSuperBaseDialog<ClassType extends PsiElement, Membe
|
||||
return myExtractedSuperNameField.getText().trim();
|
||||
}
|
||||
|
||||
protected String getTargetPackageName() {
|
||||
return myPackageNameField.getChildComponent().getText().trim();
|
||||
}
|
||||
protected abstract String getTargetPackageName();
|
||||
|
||||
public PsiDirectory getTargetDirectory() {
|
||||
return myTargetDirectory;
|
||||
|
||||
@@ -97,6 +97,10 @@ public class RenameHandlerRegistry {
|
||||
return renameHandler instanceof TitledHandler ? StringUtil.capitalize(((TitledHandler)renameHandler).getActionTitle().toLowerCase()) : renameHandler.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see RenameHandler#EP_NAME
|
||||
*/
|
||||
public void registerHandler(RenameHandler handler) {
|
||||
myHandlers.add(handler);
|
||||
}
|
||||
|
||||
@@ -71,27 +71,6 @@ public class EditorTextFieldProviderImpl implements EditorTextFieldProvider {
|
||||
}
|
||||
};
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorTextField getEditorField(@NotNull Language language,
|
||||
@NotNull final Project project,
|
||||
@NotNull final EditorCustomization.Feature... features)
|
||||
{
|
||||
return new MyEditorTextField(language, project) {
|
||||
@Override
|
||||
protected void applyFeatures(@NotNull EditorCustomization[] customizations, @NotNull EditorEx editor) {
|
||||
for (EditorCustomization.Feature feature : features) {
|
||||
for (EditorCustomization customization : customizations) {
|
||||
if (customization.getSupportedFeatures().contains(feature)) {
|
||||
customization.addCustomization(editor, feature);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorTextField getEditorField(@NotNull Language language,
|
||||
|
||||
@@ -247,7 +247,7 @@ public class OSProcessHandler extends ProcessHandler {
|
||||
while (true) {
|
||||
final int rc = readAvailable();
|
||||
if (rc == DONE) break;
|
||||
Thread.sleep(rc == READ_SOME ? 1L : 50L);
|
||||
Thread.sleep(rc == READ_SOME ? 1 : 5); // give other threads a chance
|
||||
}
|
||||
}
|
||||
catch (InterruptedException ignore) {
|
||||
|
||||
@@ -228,6 +228,8 @@ public interface IdeActions {
|
||||
@NonNls String ACTION_RENAME = "RenameElement";
|
||||
|
||||
@NonNls String ACTION_ANALYZE_DEPENDENCIES = "ShowPackageDeps";
|
||||
@NonNls String ACTION_ANALYZE_BACK_DEPENDENCIES = "ShowBackwardPackageDeps";
|
||||
@NonNls String ACTION_ANALYZE_CYCLIC_DEPENDENCIES = "ShowPackageCycles";
|
||||
@NonNls String GROUP_MOVE_MODULE_TO_GROUP = "MoveModuleToGroup";
|
||||
@NonNls String ACTION_CLEAR_TEXT = "TextComponent.ClearAction";
|
||||
@NonNls String ACTION_HIGHLIGHT_USAGES_IN_FILE = "HighlightUsagesInFile";
|
||||
|
||||
@@ -45,6 +45,9 @@ public abstract class FileTypeManager{
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link com.intellij.openapi.fileTypes.FileTypeFactory} instead
|
||||
*/
|
||||
public abstract void registerFileType(@NotNull FileType type, @NotNull List<FileNameMatcher> defaultAssociations);
|
||||
|
||||
/**
|
||||
@@ -53,6 +56,7 @@ public abstract class FileTypeManager{
|
||||
* @param type The file type to register.
|
||||
* @param defaultAssociatedExtensions The list of extensions which cause the file to be
|
||||
* treated as the specified file type. The extensions should not start with '.'.
|
||||
* @deprecated use {@link com.intellij.openapi.fileTypes.FileTypeFactory} instead
|
||||
*/
|
||||
public final void registerFileType(@NotNull FileType type, @NonNls @Nullable String... defaultAssociatedExtensions) {
|
||||
List<FileNameMatcher> matchers = new ArrayList<FileNameMatcher>();
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -149,7 +150,7 @@ public class ComponentWithBrowseButton<Comp extends JComponent> extends JPanel i
|
||||
/**
|
||||
* Do not use this class directly it is public just to hack other implementation of controls similar to TextFieldWithBrowseButton.
|
||||
*/
|
||||
public static final class MyDoClickAction extends AnAction{
|
||||
public static final class MyDoClickAction extends DumbAwareAction {
|
||||
private final FixedSizeButton myBrowseButton;
|
||||
public MyDoClickAction(FixedSizeButton browseButton) {
|
||||
myBrowseButton = browseButton;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @see ToolWindowEP
|
||||
*/
|
||||
public interface ToolWindowFactory {
|
||||
void createToolWindowContent(Project project, ToolWindow toolWindow);
|
||||
|
||||
@@ -1105,7 +1105,14 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
|
||||
return result;
|
||||
}
|
||||
int line = calcLogicalLineNumber(offset);
|
||||
int lineStartOffset = myDocument.getLineStartOffset(line);
|
||||
int lineStartOffset;
|
||||
if (line >= myDocument.getLineCount()) {
|
||||
lineStartOffset = myDocument.getTextLength();
|
||||
}
|
||||
else {
|
||||
lineStartOffset = myDocument.getLineStartOffset(line);
|
||||
}
|
||||
|
||||
int result = logicalToVisualLine(line);
|
||||
|
||||
// There is a possible case that logical line that contains target offset is soft-wrapped (represented in more than one visual
|
||||
|
||||
@@ -245,6 +245,11 @@ public class TempFileSystem extends NewVirtualFileSystem {
|
||||
public String[] list() {
|
||||
return ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + ": " + myName;
|
||||
}
|
||||
}
|
||||
|
||||
private static class FSDir extends FSItem {
|
||||
|
||||
@@ -28,15 +28,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
public interface EditorTextFieldProvider {
|
||||
|
||||
/**
|
||||
* @param language target language used by document that will be displayed by returned editor
|
||||
* @param project target project
|
||||
* @param features features to use within the returned editor text field
|
||||
* @return Multiline {@link EditorTextField} with spell checking support.
|
||||
*/
|
||||
@NotNull
|
||||
EditorTextField getEditorField(@NotNull Language language, @NotNull Project project, @NotNull EditorCustomization.Feature ... features);
|
||||
|
||||
/**
|
||||
* It's possible either {@link EditorCustomization#addCustomization(EditorEx, EditorCustomization.Feature) apply} or
|
||||
* {@link EditorCustomization#removeCustomization(EditorEx, EditorCustomization.Feature) remove} customizations from
|
||||
|
||||
@@ -132,6 +132,7 @@ wrapping.keep.when.reformatting=Keep when reformatting
|
||||
wrapping.keep.line.breaks=Line breaks
|
||||
wrapping.keep.comment.at.first.column=Comment at first column
|
||||
wrapping.keep.simple.methods.in.one.line=Simple methods in one line
|
||||
wrapping.keep.multiple.expressions.in.one.line=Multiple expressions in one line
|
||||
wrapping.keep.simple.blocks.in.one.line=Simple blocks in one line
|
||||
|
||||
wrapping.do.not.wrap=Do not wrap
|
||||
|
||||
@@ -786,6 +786,11 @@
|
||||
<reference ref="CompareClipboardWithSelection"/>
|
||||
</group>
|
||||
|
||||
<group>
|
||||
<action class="com.intellij.execution.testframework.actions.ViewAssertEqualsDiffAction" text="View assertEquals Difference" id="openAssertEqualsDiff"/>
|
||||
<separator/>
|
||||
<add-to-group anchor="first" group-id="TestTreePopupMenu"/>
|
||||
</group>
|
||||
<!-- SM Test Runner Actions -->
|
||||
<group id="SMTestRunnerTestsTree">
|
||||
<separator/>
|
||||
|
||||
+4
-2
@@ -37,10 +37,12 @@ public interface GeneralTestEventsProcessor extends Disposable {
|
||||
void onTestFinished(@NotNull final String testName,
|
||||
final int duration);
|
||||
|
||||
void onTestFailure(@NotNull final String testName,
|
||||
void onTestFailure(@NotNull final String testName,
|
||||
@NotNull final String localizedMessage,
|
||||
@Nullable final String stackTrace,
|
||||
final boolean testError);
|
||||
final boolean testError,
|
||||
@Nullable final String comparisionFailureActualText,
|
||||
@Nullable final String comparisionFailureExpectedText);
|
||||
|
||||
void onTestIgnored(@NotNull final String testName,
|
||||
@NotNull final String ignoreComment,
|
||||
|
||||
+16
-2
@@ -240,7 +240,9 @@ public class GeneralToSMTRunnerEventsConvertor implements GeneralTestEventsProce
|
||||
public void onTestFailure(@NotNull final String testName,
|
||||
@NotNull final String localizedMessage,
|
||||
@Nullable final String stackTrace,
|
||||
final boolean isTestError) {
|
||||
final boolean isTestError,
|
||||
@Nullable final String comparisionFailureActualText,
|
||||
@Nullable final String comparisionFailureExpectedText) {
|
||||
SMRunnerUtil.addToInvokeLater(new Runnable() {
|
||||
public void run() {
|
||||
final boolean inDebugMode = SMTestRunnerConnectionUtil.isInDebugMode();
|
||||
@@ -281,8 +283,20 @@ public class GeneralToSMTRunnerEventsConvertor implements GeneralTestEventsProce
|
||||
if (testProxy == null) {
|
||||
return;
|
||||
}
|
||||
testProxy.setTestFailed(localizedMessage, stackTrace, isTestError);
|
||||
|
||||
if (comparisionFailureActualText != null && comparisionFailureExpectedText != null) {
|
||||
testProxy.setTestComparisonFailed(localizedMessage, stackTrace,
|
||||
comparisionFailureActualText, comparisionFailureExpectedText);
|
||||
} else if (comparisionFailureActualText == null && comparisionFailureExpectedText == null) {
|
||||
testProxy.setTestFailed(localizedMessage, stackTrace, isTestError);
|
||||
} else {
|
||||
logProblem("Comparison failure actual and expected texts should be both null or not null.\n"
|
||||
+ "Expected:\n"
|
||||
+ comparisionFailureExpectedText + "\n"
|
||||
+ "Actual:\n"
|
||||
+ comparisionFailureActualText,
|
||||
inDebugMode);
|
||||
}
|
||||
|
||||
myFailedTestsSet.add(testProxy);
|
||||
|
||||
|
||||
+14
-4
@@ -184,15 +184,20 @@ public class OutputToGeneralTestEventsConverter implements ProcessOutputConsumer
|
||||
}
|
||||
}
|
||||
|
||||
private void fireOnTestFailure(final String testName, final String localizedMessage, final String stackTrace,
|
||||
final boolean isTestError) {
|
||||
private void fireOnTestFailure(final String testName,
|
||||
final String localizedMessage, final String stackTrace,
|
||||
final boolean isTestError,
|
||||
@Nullable final String comparisionFailureActualText,
|
||||
@Nullable final String comparisionFailureExpectedText) {
|
||||
assertNotNull(testName);
|
||||
assertNotNull(localizedMessage);
|
||||
|
||||
// local variable is used to prevent concurrent modification
|
||||
final GeneralTestEventsProcessor processor = myProcessor;
|
||||
if (processor != null) {
|
||||
processor.onTestFailure(testName, localizedMessage, stackTrace, isTestError);
|
||||
processor.onTestFailure(testName, localizedMessage, stackTrace, isTestError,
|
||||
comparisionFailureActualText,
|
||||
comparisionFailureExpectedText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +401,12 @@ public class OutputToGeneralTestEventsConverter implements ProcessOutputConsumer
|
||||
public void visitTestFailed(@NotNull final TestFailed testFailed) {
|
||||
final boolean isTestError = testFailed.getAttributes().get(ATTR_KEY_TEST_ERROR) != null;
|
||||
|
||||
fireOnTestFailure(testFailed.getTestName(), testFailed.getFailureMessage(), testFailed.getStacktrace(), isTestError);
|
||||
fireOnTestFailure(testFailed.getTestName(),
|
||||
testFailed.getFailureMessage(),
|
||||
testFailed.getStacktrace(),
|
||||
isTestError,
|
||||
testFailed.getActual(),
|
||||
testFailed.getExpected());
|
||||
}
|
||||
|
||||
public void visitPublishArtifacts(@NotNull final PublishArtifacts publishArtifacts) {
|
||||
|
||||
@@ -298,6 +298,15 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
fireOnNewPrintable(myState);
|
||||
}
|
||||
|
||||
public void setTestComparisonFailed(@NotNull final String localizedMessage,
|
||||
@Nullable final String stackTrace,
|
||||
@NotNull final String actualText,
|
||||
@NotNull final String expectedText) {
|
||||
myState = new TestComparisionFailedState(localizedMessage, stackTrace,
|
||||
actualText, expectedText);
|
||||
fireOnNewPrintable(myState);
|
||||
}
|
||||
|
||||
public void setTestIgnored(@NotNull final String ignoreComment,
|
||||
@Nullable final String stackTrace) {
|
||||
myState = new TestIgnoredState(ignoreComment, stackTrace);
|
||||
@@ -391,6 +400,15 @@ public class SMTestProxy extends AbstractTestProxy {
|
||||
return TestsPresentationUtil.getPresentableName(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AssertEqualsDiffViewerProvider getDiffViewerProvider() {
|
||||
if (myState instanceof AssertEqualsDiffViewerProvider) {
|
||||
return (AssertEqualsDiffViewerProvider)myState;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getPresentableName();
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2000-2011 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.execution.testframework.sm.runner.states;
|
||||
|
||||
import com.intellij.execution.testframework.AbstractTestProxy;
|
||||
import com.intellij.execution.testframework.CompositePrintable;
|
||||
import com.intellij.execution.testframework.Printer;
|
||||
import com.intellij.execution.testframework.stacktrace.DiffHyperlink;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Roman.Chernyatchik
|
||||
*/
|
||||
public class TestComparisionFailedState extends TestFailedState implements AbstractTestProxy.AssertEqualsDiffViewerProvider {
|
||||
private final String myErrorMsgPresentation;
|
||||
private final String myStacktracePresentation;
|
||||
private DiffHyperlink myHyperlink;
|
||||
|
||||
|
||||
public TestComparisionFailedState(@Nullable final String localizedMessage,
|
||||
@Nullable final String stackTrace,
|
||||
@NotNull final String actualText,
|
||||
@NotNull final String expectedText) {
|
||||
super(localizedMessage, stackTrace);
|
||||
myHyperlink = new DiffHyperlink(actualText, expectedText, null);
|
||||
|
||||
myErrorMsgPresentation = StringUtil.isEmptyOrSpaces(localizedMessage) ? ""
|
||||
: localizedMessage;
|
||||
myStacktracePresentation = StringUtil.isEmptyOrSpaces(stackTrace) ? ""
|
||||
: stackTrace;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printOn(Printer printer) {
|
||||
printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
|
||||
printer.mark();
|
||||
|
||||
// Error msg
|
||||
if (myErrorMsgPresentation != null) {
|
||||
printer.print(myErrorMsgPresentation, ConsoleViewContentType.ERROR_OUTPUT);
|
||||
}
|
||||
|
||||
// Diff link
|
||||
myHyperlink.printOn(printer);
|
||||
|
||||
// Stacktrace
|
||||
if (myStacktracePresentation != null) {
|
||||
printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
|
||||
|
||||
printer.print(myStacktracePresentation, ConsoleViewContentType.ERROR_OUTPUT);
|
||||
printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
|
||||
}
|
||||
}
|
||||
|
||||
public void openDiff(final Project project) {
|
||||
myHyperlink.openDiff(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getExpecteed() {
|
||||
return myHyperlink.getLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getActual() {
|
||||
return myHyperlink.getRight();
|
||||
}
|
||||
}
|
||||
-1
@@ -17,7 +17,6 @@ package com.intellij.execution.testframework.sm.runner.states;
|
||||
|
||||
import com.intellij.execution.testframework.CompositePrintable;
|
||||
import com.intellij.execution.testframework.Printer;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user