mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -71,6 +71,8 @@ target('default': 'The default target') {
|
||||
// load ApplicationInfo.xml properties
|
||||
ant.xmlproperty(file: appInfoFile(), collapseAttributes: "true")
|
||||
|
||||
zipSources(home, paths.artifacts)
|
||||
|
||||
layoutAll([buildNumber: "IC-$snapshot",
|
||||
system_selector: "IdeaIC${p("component.version.major")}",
|
||||
tools_jar: true],
|
||||
|
||||
@@ -397,7 +397,7 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
// commandLine.add((launcherUsed? "-J" : "") + "-D" + CharsetToolkit.FILE_ENCODING_PROPERTY + "=" + CharsetToolkit.getDefaultSystemCharset().name());
|
||||
//}
|
||||
|
||||
private Process launchServer(int port) throws ExecutionException {
|
||||
private Process launchServer(final int port) throws ExecutionException {
|
||||
// validate tools.jar presence
|
||||
final JavaCompiler systemCompiler = ToolProvider.getSystemJavaCompiler();
|
||||
if (systemCompiler == null) {
|
||||
@@ -406,7 +406,8 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
|
||||
final Sdk projectJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
|
||||
final GeneralCommandLine cmdLine = new GeneralCommandLine();
|
||||
cmdLine.setExePath(((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk));
|
||||
final String vmExecutablePath = ((JavaSdkType)projectJdk.getSdkType()).getVMExecutablePath(projectJdk);
|
||||
cmdLine.setExePath(vmExecutablePath);
|
||||
cmdLine.addParameter("-server");
|
||||
cmdLine.addParameter("-ea");
|
||||
cmdLine.addParameter("-XX:MaxPermSize=150m");
|
||||
@@ -416,12 +417,21 @@ public class CompileServerManager implements ApplicationComponent{
|
||||
cmdLine.addParameter("-Xmx" + Registry.intValue("compiler.server.heap.size") + "m");
|
||||
|
||||
// debugging
|
||||
cmdLine.addParameter("-XX:+HeapDumpOnOutOfMemoryError");
|
||||
//cmdLine.addParameter("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5008");
|
||||
|
||||
if (Registry.is("compiler.server.use.memory.temp.cache")) {
|
||||
cmdLine.addParameter("-D"+Server.USE_MEMORY_TEMP_CACHE_OPTION + "=true");
|
||||
final int debugPort = Registry.intValue("compiler.server.debug.port");
|
||||
if (debugPort > 0) {
|
||||
cmdLine.addParameter("-XX:+HeapDumpOnOutOfMemoryError");
|
||||
cmdLine.addParameter("-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + debugPort);
|
||||
}
|
||||
|
||||
if (Registry.is("compiler.server.use.memory.temp.cache")) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.USE_MEMORY_TEMP_CACHE_OPTION + "=true");
|
||||
}
|
||||
if (Registry.is("compiler.server.use.external.javac.process")) {
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.USE_EXTERNAL_JAVAC_OPTION + "=true");
|
||||
}
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.HOSTNAME_OPTION + "=" + NetUtils.getLocalHostString());
|
||||
cmdLine.addParameter("-D"+ GlobalOptions.VM_EXE_PATH_OPTION + "=" + FileUtil.toSystemIndependentName(vmExecutablePath));
|
||||
|
||||
// javac's VM should use the same default locale that IDEA uses in order for javac to print messages in 'correct' language
|
||||
final String lang = System.getProperty("user.language");
|
||||
if (lang != null) {
|
||||
|
||||
@@ -23,8 +23,10 @@ import com.intellij.codeInspection.reference.RefClass;
|
||||
import com.intellij.codeInspection.reference.RefElement;
|
||||
import com.intellij.codeInspection.reference.RefJavaVisitor;
|
||||
import com.intellij.codeInspection.reference.RefManagerImpl;
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.*;
|
||||
@@ -32,10 +34,12 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.containers.BidirectionalMap;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -47,6 +51,8 @@ import java.util.Map;
|
||||
public class RedundantSuppressInspection extends GlobalInspectionTool{
|
||||
private BidirectionalMap<String, QuickFix> myQuickFixes = null;
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.RedundantSuppressInspection");
|
||||
|
||||
public boolean IGNORE_ALL = false;
|
||||
|
||||
@NotNull
|
||||
public String getGroupDisplayName() {
|
||||
@@ -64,6 +70,17 @@ public class RedundantSuppressInspection extends GlobalInspectionTool{
|
||||
return "RedundantSuppression";
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent createOptionsPanel() {
|
||||
return new SingleCheckboxOptionsPanel("Ignore @SuppressWarning(\"ALL\")", this, "IGNORE_ALL");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeSettings(Element node) throws WriteExternalException {
|
||||
if (IGNORE_ALL) {
|
||||
super.writeSettings(node);
|
||||
}
|
||||
}
|
||||
|
||||
public void runInspection(final AnalysisScope scope,
|
||||
final InspectionManager manager,
|
||||
@@ -123,6 +140,7 @@ public class RedundantSuppressInspection extends GlobalInspectionTool{
|
||||
String idsString = SuppressManager.getInstance().getSuppressedInspectionIdsIn(owner);
|
||||
if (idsString != null && idsString.length() != 0) {
|
||||
List<String> ids = StringUtil.split(idsString, ",");
|
||||
if (IGNORE_ALL && ids.contains(SuppressionUtil.ALL)) return;
|
||||
Collection<String> suppressed = suppressedScopes.get(owner);
|
||||
if (suppressed == null) {
|
||||
suppressed = ids;
|
||||
|
||||
@@ -221,7 +221,13 @@ public class ReferenceAdjuster {
|
||||
private static boolean isSafeToShortenReference(final String referenceText, final PsiElement psiReference, final PsiClass refClass) {
|
||||
final PsiManager manager = refClass.getManager();
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(manager.getProject());
|
||||
return manager.areElementsEquivalent(refClass, facade.getResolveHelper().resolveReferencedClass(referenceText, psiReference));
|
||||
final PsiResolveHelper helper = facade.getResolveHelper();
|
||||
if (manager.areElementsEquivalent(refClass, helper.resolveReferencedClass(referenceText, psiReference))) {
|
||||
PsiElement parent = psiReference.getParent();
|
||||
if (parent instanceof PsiJavaCodeReferenceElement && parent.getParent() instanceof PsiNewExpression) return true;
|
||||
return helper.resolveReferencedVariable(referenceText, psiReference) == null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -116,13 +116,18 @@ public class CoreJavaFileManager extends PackageIndex implements JavaFileManager
|
||||
|
||||
@Nullable
|
||||
private PsiClass findClassInClasspathEntry(String qName, File file) {
|
||||
String fileName = qName.replace(".", "/") + ".class";
|
||||
// TODO handle inner classes correctly
|
||||
String fileName = qName.replace(".", "/") + ".java";
|
||||
VirtualFile classFile = findUnderClasspathEntry(file, fileName);
|
||||
|
||||
if (classFile == null) {
|
||||
fileName = qName.replace(".", "/") + ".class";
|
||||
classFile = findUnderClasspathEntry(file, fileName);
|
||||
}
|
||||
|
||||
if (classFile != null) {
|
||||
PsiFile psiFile = myPsiManager.findFile(classFile);
|
||||
if (!(psiFile instanceof PsiJavaFile)) {
|
||||
throw new UnsupportedOperationException("no java file for .class");
|
||||
throw new UnsupportedOperationException("no java file for " + fileName);
|
||||
}
|
||||
final PsiClass[] classes = ((PsiJavaFile)psiFile).getClasses();
|
||||
if (classes.length == 1) {
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>4</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void f()" />
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>42</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void j()" />
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>53</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="field" FQNAME="x.S$3ss s" />
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>19</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void h()" />
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>30</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="class" FQNAME="x.S$1ss" />
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>11</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void g()" />
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>67</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void foo1()" />
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
@@ -0,0 +1,69 @@
|
||||
package x;
|
||||
|
||||
class S {
|
||||
public void f() {
|
||||
//noinspection HardCodedStringLiteral
|
||||
String s=null;
|
||||
//noinspection HardCodedStringLiteral
|
||||
String s2="sssssss";
|
||||
}
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
void g() {
|
||||
String s = null;
|
||||
}
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
void g2() {
|
||||
String s = "sssssss";
|
||||
}
|
||||
|
||||
void h() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
String s = null;
|
||||
}
|
||||
void h2() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
String s = "sssssss";
|
||||
}
|
||||
|
||||
void i() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
class ss {
|
||||
String s = null;
|
||||
}
|
||||
}
|
||||
void i2() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
class ss {
|
||||
String s = "sssssss";
|
||||
}
|
||||
}
|
||||
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
void j() {
|
||||
String s = null;
|
||||
}
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
void j2() {
|
||||
String s = "sssssss";
|
||||
}
|
||||
|
||||
void k() {
|
||||
class ss {
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
String s = null;
|
||||
}
|
||||
}
|
||||
void k2() {
|
||||
class ss {
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
String s = "sssssss";
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"EmptyMethod"})
|
||||
void foo() {}
|
||||
|
||||
@SuppressWarnings({"EmptyMethod"})
|
||||
void foo1() {String f;}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
@@ -0,0 +1,8 @@
|
||||
package x;
|
||||
|
||||
public class S {
|
||||
@SuppressWarnings("ALL")
|
||||
public static void main(String[] args) {
|
||||
System.out.println(args[0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
public class A {
|
||||
int f = 23;
|
||||
|
||||
static class B {
|
||||
static int f = 42;
|
||||
}
|
||||
|
||||
int foo() {
|
||||
int r = B.f;
|
||||
A B = this;
|
||||
return r<caret>;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new A().foo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
public class A {
|
||||
int f = 23;
|
||||
|
||||
static class B {
|
||||
static int f = 42;
|
||||
}
|
||||
|
||||
int foo() {
|
||||
A B = this;
|
||||
return A.B.f;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new A().foo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.codeInspection.ex.InspectionToolRegistrar;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class RedundantSuppressTest extends InspectionTestCase {
|
||||
private GlobalInspectionToolWrapper myWrapper;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
InspectionToolRegistrar.getInstance().ensureInitialized();
|
||||
myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection());
|
||||
}
|
||||
|
||||
public void testDefaultFile() throws Exception {
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = true;
|
||||
doTest();
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = false;
|
||||
}
|
||||
|
||||
public void testSuppressAll() throws Exception {
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = true;
|
||||
try {
|
||||
((RedundantSuppressInspection)myWrapper.getTool()).IGNORE_ALL = true;
|
||||
doTest();
|
||||
}
|
||||
finally {
|
||||
((RedundantSuppressInspection)myWrapper.getTool()).IGNORE_ALL = false;
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest("redundantSuppress/" + getTestName(true), myWrapper,"java 1.5",true);
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,6 @@ import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInsight.TargetElementUtilBase;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiLocalVariable;
|
||||
import com.intellij.psi.PsiReference;
|
||||
@@ -130,6 +128,11 @@ public class InlineLocalTest extends LightCodeInsightTestCase {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
public void testQualified() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
|
||||
private void doTest(final boolean inlineDef, String conflictMessage) throws Exception {
|
||||
try {
|
||||
doTest(inlineDef);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.jetbrains.jps.api;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 1/24/12
|
||||
*/
|
||||
public interface GlobalOptions {
|
||||
|
||||
String USE_MEMORY_TEMP_CACHE_OPTION = "use.memory.temp.cache";
|
||||
String USE_EXTERNAL_JAVAC_OPTION = "use.external.javac.process";
|
||||
String HOSTNAME_OPTION = "localhost.name";
|
||||
String VM_EXE_PATH_OPTION = "vm.executable.path";
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import org.jetbrains.jps.Module;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.Project;
|
||||
import org.jetbrains.jps.ProjectPaths;
|
||||
import org.jetbrains.jps.api.GlobalOptions;
|
||||
import org.jetbrains.jps.api.RequestFuture;
|
||||
import org.jetbrains.jps.incremental.*;
|
||||
import org.jetbrains.jps.incremental.messages.BuildMessage;
|
||||
@@ -36,6 +37,7 @@ import javax.tools.Diagnostic;
|
||||
import javax.tools.JavaFileObject;
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
@@ -48,9 +50,9 @@ import java.util.concurrent.ExecutorService;
|
||||
*/
|
||||
public class JavaBuilder extends Builder{
|
||||
public static final String BUILDER_NAME = "java";
|
||||
|
||||
private static final String JAVA_EXTENSION = ".java";
|
||||
private static final String FORM_EXTENSION = ".form";
|
||||
private static final boolean USE_EMBEDDED_JAVAC = System.getProperty(GlobalOptions.USE_EXTERNAL_JAVAC_OPTION) == null;
|
||||
|
||||
private static final FileFilter JAVA_SOURCES_FILTER = new FileFilter() {
|
||||
public boolean accept(File file) {
|
||||
@@ -222,7 +224,6 @@ public class JavaBuilder extends Builder{
|
||||
final Collection<File> classpath = paths.getCompilationClasspath(chunk, context.isCompilingTests(), false/*context.isProjectRebuild()*/);
|
||||
final Collection<File> platformCp = paths.getPlatformCompilationClasspath(chunk, context.isCompilingTests(), false/*context.isProjectRebuild()*/);
|
||||
final Map<File, Set<File>> outs = buildOutputDirectoriesMap(context, chunk);
|
||||
final List<String> options = getCompilationOptions(context, chunk);
|
||||
|
||||
// begin compilation round
|
||||
final DiagnosticSink diagnosticSink = new DiagnosticSink(context);
|
||||
@@ -234,7 +235,7 @@ public class JavaBuilder extends Builder{
|
||||
final Set<File> sourcePath = TEMPORARY_SOURCE_ROOTS_KEY.get(context,Collections.<File>emptySet());
|
||||
|
||||
final boolean compiledOk = compileJava(
|
||||
options, files, classpath, platformCp, sourcePath, outs, context, diagnosticSink, outputSink
|
||||
files, classpath, platformCp, sourcePath, outs, context, diagnosticSink, outputSink
|
||||
);
|
||||
|
||||
final Map<File, String> chunkSourcePath = ProjectPaths.getSourceRootsWithDependents(chunk, context.isCompilingTests());
|
||||
@@ -291,12 +292,12 @@ public class JavaBuilder extends Builder{
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
private boolean compileJava(List<String> options, Collection<File> files, Collection<File> classpath, Collection<File> platformCp, Collection<File> sourcePath, Map<File, Set<File>> outs, CompileContext context, DiagnosticOutputConsumer diagnosticSink, final OutputFileConsumer outputSink) throws Exception {
|
||||
final boolean useEmbeddedJavac = true; // todo: make configurable
|
||||
private boolean compileJava(Collection<File> files, Collection<File> classpath, Collection<File> platformCp, Collection<File> sourcePath, Map<File, Set<File>> outs, CompileContext context, DiagnosticOutputConsumer diagnosticSink, final OutputFileConsumer outputSink) throws Exception {
|
||||
final List<String> options = getCompilationOptions(context);
|
||||
final ClassProcessingConsumer classesConsumer = new ClassProcessingConsumer(context, outputSink);
|
||||
try {
|
||||
final boolean rc;
|
||||
if (useEmbeddedJavac) {
|
||||
if (USE_EMBEDDED_JAVAC) {
|
||||
rc = JavacMain.compile(options, files, classpath, platformCp, sourcePath, outs, diagnosticSink, classesConsumer, context.getCancelStatus());
|
||||
}
|
||||
else {
|
||||
@@ -326,13 +327,12 @@ public class JavaBuilder extends Builder{
|
||||
return descriptor.client;
|
||||
}
|
||||
// start server here
|
||||
final String javaHome = System.getProperty("java.home");
|
||||
final String vmExecPath = System.getProperty(GlobalOptions.VM_EXE_PATH_OPTION, System.getProperty("java.home") + "/bin/java");
|
||||
final String hostString = System.getProperty(GlobalOptions.HOSTNAME_OPTION, "localhost");
|
||||
final int port = findFreePort();
|
||||
final int heapSize = getJavacServerHeapSize(context);
|
||||
|
||||
final String hostString = "localhost"; // todo: obtain from IDEA
|
||||
final int port = 9999; // todo: obtain from IDEA
|
||||
final int heapSize = 512; // todo: make configurable; either obtain from IDEA or calculate
|
||||
|
||||
final BaseOSProcessHandler processHandler = JavacServerBootstrap.launchJavacServer(javaHome + "/bin/java", heapSize, port, Paths.getSystemRoot());
|
||||
final BaseOSProcessHandler processHandler = JavacServerBootstrap.launchJavacServer(vmExecPath, heapSize, port, Paths.getSystemRoot());
|
||||
final JavacServerClient client = new JavacServerClient();
|
||||
try {
|
||||
client.connect(hostString, port);
|
||||
@@ -345,6 +345,46 @@ public class JavaBuilder extends Builder{
|
||||
return client;
|
||||
}
|
||||
|
||||
private static int findFreePort() {
|
||||
try {
|
||||
final ServerSocket serverSocket = new ServerSocket(0);
|
||||
try {
|
||||
return serverSocket.getLocalPort();
|
||||
}
|
||||
finally {
|
||||
//workaround for linux : calling close() immediately after opening socket
|
||||
//may result that socket is not closed
|
||||
synchronized(serverSocket) {
|
||||
try {
|
||||
serverSocket.wait(1);
|
||||
}
|
||||
catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
serverSocket.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace(System.err);
|
||||
return JavacServer.DEFAULT_SERVER_PORT;
|
||||
}
|
||||
}
|
||||
|
||||
private static int getJavacServerHeapSize(CompileContext context) {
|
||||
int heapSize = 512;
|
||||
final Project project = context.getProject();
|
||||
final Map<String, String> javacOpts = project.getCompilerConfiguration().getJavacOptions();
|
||||
final String hSize = javacOpts.get("MAXIMUM_HEAP_SIZE");
|
||||
if (hSize != null) {
|
||||
try {
|
||||
heapSize = Integer.parseInt(hSize);
|
||||
}
|
||||
catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
return heapSize;
|
||||
}
|
||||
|
||||
private static ClassLoader createInstrumentationClassLoader(Collection<File> classpath, Collection<File> platformCp, Map<File, String> chunkSourcePath, OutputFilesSink outputSink)
|
||||
throws MalformedURLException {
|
||||
final List<URL> urls = new ArrayList<URL>();
|
||||
@@ -361,7 +401,7 @@ public class JavaBuilder extends Builder{
|
||||
return new CompiledClassesLoader(outputSink, urls.toArray(new URL[urls.size()]));
|
||||
}
|
||||
|
||||
private static List<String> getCompilationOptions(CompileContext context, ModuleChunk chunk) {
|
||||
private static List<String> getCompilationOptions(CompileContext context) {
|
||||
final List<String> options = new ArrayList<String>();
|
||||
options.add("-verbose");
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import org.jboss.netty.handler.codec.protobuf.ProtobufDecoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufEncoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import org.jboss.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import org.jetbrains.jps.api.GlobalOptions;
|
||||
import org.jetbrains.jps.api.JpsRemoteProto;
|
||||
import org.jetbrains.jps.incremental.Paths;
|
||||
|
||||
@@ -27,7 +28,6 @@ public class Server {
|
||||
private static final int MAX_SIMULTANEOUS_BUILD_SESSIONS = Math.max(2, Runtime.getRuntime().availableProcessors());
|
||||
public static final String SERVER_SUCCESS_START_MESSAGE = "Compile Server started successfully. Listening on port: ";
|
||||
public static final String SERVER_ERROR_START_MESSAGE = "Error starting Compile Server: ";
|
||||
public static final String USE_MEMORY_TEMP_CACHE_OPTION = "use.memory.temp.cache";
|
||||
|
||||
private final ChannelGroup myAllOpenChannels = new DefaultChannelGroup("compile-server");
|
||||
private final ChannelFactory myChannelFactory;
|
||||
@@ -99,7 +99,7 @@ public class Server {
|
||||
}
|
||||
});
|
||||
|
||||
ServerState.getInstance().setKeepTempCachesInMemory(System.getProperty(USE_MEMORY_TEMP_CACHE_OPTION) != null);
|
||||
ServerState.getInstance().setKeepTempCachesInMemory(System.getProperty(GlobalOptions.USE_MEMORY_TEMP_CACHE_OPTION) != null);
|
||||
|
||||
System.out.println("Server classpath: " + System.getProperty("java.class.path"));
|
||||
System.err.println(SERVER_SUCCESS_START_MESSAGE + port);
|
||||
|
||||
@@ -27,8 +27,7 @@ public class SourceTreeToPsiMap {
|
||||
|
||||
@Nullable
|
||||
public static PsiElement treeElementToPsi(@Nullable final ASTNode element) {
|
||||
if (element == null) return null;
|
||||
return element.getPsi();
|
||||
return element == null ? null : element.getPsi();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+21
-18
@@ -233,27 +233,31 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
private static MultiMap<LocalInspectionTool, String> getToolsForElements(List<LocalInspectionToolWrapper> toolWrappers,
|
||||
boolean checkDumbAwareness,
|
||||
List<PsiElement> inside, List<PsiElement> outside) {
|
||||
Set<Language> languages = new HashSet<Language>();
|
||||
Set<Language> languages = new THashSet<Language>();
|
||||
Map<String, Language> langIds = new THashMap<String, Language>();
|
||||
Set<String> dialects = new THashSet<String>();
|
||||
for (PsiElement element : inside) {
|
||||
languages.add(element.getLanguage());
|
||||
Language language = element.getLanguage();
|
||||
if (languages.add(language)) {
|
||||
langIds.put(language.getID(), language);
|
||||
for (Language dialect : language.getDialects()) {
|
||||
dialects.add(dialect.getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (PsiElement element : outside) {
|
||||
languages.add(element.getLanguage());
|
||||
}
|
||||
Map<String, Language> langIds = new HashMap<String, Language>();
|
||||
for (Language language : languages) {
|
||||
langIds.put(language.getID(), language);
|
||||
}
|
||||
Set<String> dialects = new HashSet<String>();
|
||||
for (Language language : languages) {
|
||||
for (Language dialect : language.getDialects()) {
|
||||
dialects.add(dialect.getID());
|
||||
Language language = element.getLanguage();
|
||||
if (languages.add(language)) {
|
||||
langIds.put(language.getID(), language);
|
||||
for (Language dialect : language.getDialects()) {
|
||||
dialects.add(dialect.getID());
|
||||
}
|
||||
}
|
||||
}
|
||||
MultiMap<LocalInspectionTool, String> map = new MultiMap<LocalInspectionTool, String>() {
|
||||
@Override
|
||||
protected Collection<String> createCollection() {
|
||||
return new HashSet<String>();
|
||||
return new THashSet<String>();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -319,11 +323,11 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
}
|
||||
}
|
||||
};
|
||||
PsiElementVisitor visitor = createVisitorAndAcceptElements(tool, holder, isOnTheFly, session, elements,
|
||||
(Set<String>)pair.getValue());
|
||||
Set<String> languages = (Set<String>)pair.getValue();
|
||||
PsiElementVisitor visitor = createVisitorAndAcceptElements(tool, holder, isOnTheFly, session, elements, languages);
|
||||
|
||||
synchronized (init) {
|
||||
init.add(new InspectionContext(tool, holder, visitor, (Set<String>)pair.getValue()));
|
||||
init.add(new InspectionContext(tool, holder, visitor, languages));
|
||||
}
|
||||
advanceProgress(1);
|
||||
|
||||
@@ -477,7 +481,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
}
|
||||
}, myProject.getDisposed(), 200);
|
||||
|
||||
private final Set<TextRange> emptyActionRegistered = Collections.synchronizedSet(new HashSet<TextRange>());
|
||||
private final Set<TextRange> emptyActionRegistered = Collections.synchronizedSet(new THashSet<TextRange>());
|
||||
|
||||
private void addDescriptorIncrementally(@NotNull final ProblemDescriptor descriptor,
|
||||
@NotNull final LocalInspectionTool tool,
|
||||
@@ -777,7 +781,6 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
|
||||
}
|
||||
|
||||
private static class InspectionContext {
|
||||
|
||||
private InspectionContext(LocalInspectionTool tool, ProblemsHolder holder, PsiElementVisitor visitor, Set<String> languageIds) {
|
||||
this.tool = tool;
|
||||
this.holder = holder;
|
||||
|
||||
+4
-2
@@ -130,6 +130,8 @@ public class IncrementalSearchHandler {
|
||||
|
||||
final DocumentListener[] documentListener = new DocumentListener[1];
|
||||
final CaretListener[] caretListener = new CaretListener[1];
|
||||
final Document document = editor.getDocument();
|
||||
|
||||
final LightweightHint hint = new LightweightHint(panel) {
|
||||
public void hide() {
|
||||
PerHintSearchData data = getUserData(SEARCH_DATA_IN_HINT_KEY);
|
||||
@@ -146,7 +148,7 @@ public class IncrementalSearchHandler {
|
||||
editorData.lastSearch = prefix;
|
||||
|
||||
if (documentListener[0] != null){
|
||||
editor.getDocument().removeDocumentListener(documentListener[0]);
|
||||
document.removeDocumentListener(documentListener[0]);
|
||||
}
|
||||
|
||||
if (caretListener[0] != null){
|
||||
@@ -162,7 +164,7 @@ public class IncrementalSearchHandler {
|
||||
hint.hide();
|
||||
}
|
||||
};
|
||||
editor.getDocument().addDocumentListener(documentListener[0]);
|
||||
document.addDocumentListener(documentListener[0]);
|
||||
|
||||
caretListener[0] = new CaretListener() {
|
||||
public void caretPositionChanged(CaretEvent e) {
|
||||
|
||||
@@ -77,7 +77,7 @@ public abstract class RunManagerEx extends RunManager {
|
||||
|
||||
public abstract Collection<RunnerAndConfigurationSettings> getSortedConfigurations();
|
||||
|
||||
public abstract void removeConfiguration(RunnerAndConfigurationSettings settings);
|
||||
public abstract void removeConfiguration(@Nullable RunnerAndConfigurationSettings settings);
|
||||
|
||||
public abstract void addRunManagerListener(RunManagerListener listener);
|
||||
public abstract void removeRunManagerListener(RunManagerListener listener);
|
||||
|
||||
@@ -311,7 +311,9 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConfiguration(RunnerAndConfigurationSettings settings) {
|
||||
public void removeConfiguration(@Nullable RunnerAndConfigurationSettings settings) {
|
||||
if (settings == null) return;
|
||||
|
||||
for (Iterator<RunnerAndConfigurationSettings> it = getSortedConfigurations().iterator(); it.hasNext(); ) {
|
||||
final RunnerAndConfigurationSettings configuration = it.next();
|
||||
if (configuration.equals(settings)) {
|
||||
@@ -728,6 +730,7 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
|
||||
if (settings != null) {
|
||||
invalidateConfigurationIcon(settings);
|
||||
settings.setTemporary(false);
|
||||
fireRunConfigurationChanged(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -870,11 +873,13 @@ public class RunManagerImpl extends RunManagerEx implements JDOMExternalizable,
|
||||
}
|
||||
|
||||
public void shareConfiguration(final RunConfiguration runConfiguration, final boolean shareConfiguration) {
|
||||
RunnerAndConfigurationSettings settings = getSettings(runConfiguration);
|
||||
boolean shouldFire = settings != null && isConfigurationShared(settings) != shareConfiguration;
|
||||
|
||||
if (shareConfiguration && isTemporary(runConfiguration)) makeStable(runConfiguration);
|
||||
mySharedConfigurations.put(runConfiguration.getUniqueID(), shareConfiguration);
|
||||
|
||||
RunnerAndConfigurationSettings settings = getSettings(runConfiguration);
|
||||
if (settings != null) fireRunConfigurationChanged(settings);
|
||||
if (shouldFire) fireRunConfigurationChanged(settings);
|
||||
}
|
||||
|
||||
public final void setBeforeRunTasks(final RunConfiguration runConfiguration, Map<Key<? extends BeforeRunTask>, BeforeRunTask> tasks) {
|
||||
|
||||
@@ -69,6 +69,7 @@ public class EditorSearchComponent extends JPanel implements DataProvider, Selec
|
||||
private final Project myProject;
|
||||
private ActionToolbar myActionsToolbar;
|
||||
|
||||
|
||||
public Editor getEditor() {
|
||||
return myEditor;
|
||||
}
|
||||
|
||||
+1
-1
@@ -671,7 +671,7 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl
|
||||
|
||||
@Override
|
||||
public ActionCallback getReady(@NotNull Object requestor) {
|
||||
if (myTreeBuilder.isDisposed()) return new ActionCallback.Rejected();
|
||||
if (myTreeBuilder == null || myTreeBuilder.isDisposed()) return new ActionCallback.Rejected();
|
||||
return myTreeBuilder.getUi().getReady(requestor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
@@ -40,6 +41,12 @@ public abstract class ShowModulesAction extends ToggleAction {
|
||||
super.update(e);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
final ProjectViewImpl projectView = (ProjectViewImpl)ProjectView.getInstance(myProject);
|
||||
presentation.setVisible(Comparing.strEqual(projectView.getCurrentViewId(), getId()));
|
||||
presentation.setVisible(hasModules() && Comparing.strEqual(projectView.getCurrentViewId(), getId()));
|
||||
}
|
||||
|
||||
private static boolean hasModules() {
|
||||
return PlatformUtils.isIdea() ||
|
||||
PlatformUtils.isCommunity() ||
|
||||
PlatformUtils.isFlexIde();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +227,8 @@ public class FileStructurePopup implements Disposable {
|
||||
if (size > max) {
|
||||
max = size;
|
||||
cur = p.node;
|
||||
} else if (size == max && size == parents.size()) {
|
||||
cur = p.node;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-1
@@ -58,7 +58,9 @@ public abstract class ContributorsBasedGotoByModel implements ChooseByNameModel
|
||||
@Override
|
||||
public boolean process(ChooseByNameContributor contributor) {
|
||||
try {
|
||||
ContainerUtil.addAll(names, contributor.getNames(myProject, checkBoxState));
|
||||
if (!myProject.isDisposed()) {
|
||||
ContainerUtil.addAll(names, contributor.getNames(myProject, checkBoxState));
|
||||
}
|
||||
}
|
||||
catch (ProcessCanceledException ex) {
|
||||
// index corruption detected, ignore
|
||||
|
||||
@@ -182,7 +182,7 @@ public abstract class PsiAnchor {
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiFile getFile() {
|
||||
return SelfElementInfo.restoreFileFromVirtual(myVirtualFile, myProject, myLanguage);
|
||||
return SelfElementInfo.restoreFileFromVirtual(myVirtualFile, myProject, myFileLanguage);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -274,6 +274,7 @@ public abstract class PsiAnchor {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiFile getFile() {
|
||||
return SelfElementInfo.restoreFileFromVirtual(myFile, myProject);
|
||||
}
|
||||
@@ -323,6 +324,7 @@ public abstract class PsiAnchor {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiElement restoreFromStubIndex(PsiFileWithStubSupport fileImpl,
|
||||
int index,
|
||||
IStubElementType elementType) {
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ public class ConfigurableExtensionPointUtil {
|
||||
@NotNull
|
||||
private static <T extends Configurable> T findConfigurable(ConfigurableEP[] extensions, Class<T> configurableClass) {
|
||||
for (ConfigurableEP extension : extensions) {
|
||||
if (extension.implementationClass != null) {
|
||||
if (extension.providerClass != null || extension.instanceClass != null || extension.implementationClass != null) {
|
||||
final Configurable configurable = extension.createConfigurable();
|
||||
if (configurableClass.isInstance(configurable)) {
|
||||
return configurableClass.cast(configurable);
|
||||
|
||||
@@ -43,11 +43,11 @@ public class ProgressWrapper extends ProgressIndicatorBase {
|
||||
|
||||
@Nullable
|
||||
public static ProgressWrapper wrap(@Nullable ProgressIndicator indicator) {
|
||||
return indicator == null ? null : new ProgressWrapper(indicator);
|
||||
return indicator == null || indicator instanceof ProgressWrapper ? (ProgressWrapper)indicator : new ProgressWrapper(indicator);
|
||||
}
|
||||
|
||||
public static ProgressIndicator unwrap(ProgressIndicator indicator) {
|
||||
return indicator instanceof ProgressWrapper ?
|
||||
((ProgressWrapper)indicator).getOriginalProgressIndicator():indicator;
|
||||
((ProgressWrapper)indicator).getOriginalProgressIndicator() : indicator;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,9 +508,10 @@ public final class ToolWindowManagerImpl extends ToolWindowManagerEx implements
|
||||
final String[] ids = getToolWindowIds();
|
||||
|
||||
// Remove ToolWindowsPane
|
||||
|
||||
((IdeRootPane)myFrame.getRootPane()).setToolWindowsPane(null);
|
||||
myWindowManager.releaseFrame(myFrame);
|
||||
if (myFrame != null) {
|
||||
((IdeRootPane)myFrame.getRootPane()).setToolWindowsPane(null);
|
||||
myWindowManager.releaseFrame(myFrame);
|
||||
}
|
||||
appendUpdateToolWindowsPaneCmd(commandsList);
|
||||
|
||||
// Hide all tool windows
|
||||
|
||||
-6
@@ -25,7 +25,6 @@ import java.awt.image.BufferedImage;
|
||||
|
||||
class ComboContentLayout extends ContentLayout {
|
||||
|
||||
BaseLabel myIdLabel;
|
||||
ContentComboLabel myComboLabel;
|
||||
private BufferedImage myImage;
|
||||
|
||||
@@ -112,7 +111,6 @@ class ComboContentLayout extends ContentLayout {
|
||||
@Override
|
||||
public void update() {
|
||||
updateIdLabel(myIdLabel);
|
||||
myIdLabel.setVisible(!"true".equals(myUi.myWindow.getComponent().getClientProperty(ToolWindowContentUi.HIDE_ID_LABEL)));
|
||||
myComboLabel.update();
|
||||
}
|
||||
|
||||
@@ -131,10 +129,6 @@ class ComboContentLayout extends ContentLayout {
|
||||
return myUi.myManager.getContentCount() > 1;
|
||||
}
|
||||
|
||||
boolean isIdVisible() {
|
||||
return myIdLabel.isVisible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contentAdded(ContentManagerEvent event) {
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.ui.awt.RelativeRectangle;
|
||||
import com.intellij.ui.content.Content;
|
||||
import com.intellij.ui.content.ContentManagerEvent;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
|
||||
@@ -40,6 +41,7 @@ abstract class ContentLayout {
|
||||
static final int TAB_SHIFT = 2;
|
||||
|
||||
ToolWindowContentUi myUi;
|
||||
BaseLabel myIdLabel;
|
||||
|
||||
ContentLayout(ToolWindowContentUi ui) {
|
||||
myUi = ui;
|
||||
@@ -76,6 +78,8 @@ abstract class ContentLayout {
|
||||
label.setBorder(new EmptyBorder(0, 2, 0, 0));
|
||||
}
|
||||
}
|
||||
|
||||
label.setVisible(shouldShowId());
|
||||
}
|
||||
|
||||
protected void fillTabShape(Graphics2D g2d, Shape shape, boolean isSelected, Rectangle bounds) {
|
||||
@@ -106,4 +110,12 @@ abstract class ContentLayout {
|
||||
public abstract String getPreviousContentActionName();
|
||||
public abstract String getNextContentActionName();
|
||||
|
||||
protected boolean shouldShowId() {
|
||||
final JComponent component = myUi.myWindow.getComponent();
|
||||
return component != null && !"true".equals(component.getClientProperty(ToolWindowContentUi.HIDE_ID_LABEL));
|
||||
}
|
||||
|
||||
boolean isIdVisible() {
|
||||
return myIdLabel.isVisible();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -50,8 +50,6 @@ class TabContentLayout extends ContentLayout {
|
||||
|
||||
private Map<String, BufferedImage> myCached = new com.intellij.util.containers.HashMap<String, BufferedImage>();
|
||||
|
||||
BaseLabel myIdLabel;
|
||||
|
||||
private final MoreIcon myMoreIcon = new MoreIcon() {
|
||||
protected Rectangle getIconRec() {
|
||||
return myLastLayout.moreRect;
|
||||
@@ -153,8 +151,10 @@ class TabContentLayout extends ContentLayout {
|
||||
data.eachX = 2;
|
||||
data.eachY = 0;
|
||||
|
||||
myIdLabel.setBounds(data.eachX, data.eachY, myIdLabel.getPreferredSize().width, bounds.height);
|
||||
data.eachX += myIdLabel.getPreferredSize().width;
|
||||
if (isIdVisible()) {
|
||||
myIdLabel.setBounds(data.eachX, data.eachY, myIdLabel.getPreferredSize().width, bounds.height);
|
||||
data.eachX += myIdLabel.getPreferredSize().width;
|
||||
}
|
||||
int tabsStart = data.eachX;
|
||||
|
||||
if (manager.getContentCount() == 0) return;
|
||||
@@ -310,7 +310,7 @@ class TabContentLayout extends ContentLayout {
|
||||
}
|
||||
|
||||
if (image != null) {
|
||||
g.drawImage(image, r.x, r.y, null);
|
||||
g.drawImage(image, isIdVisible() ? r.x : r.x - 2, r.y, null);
|
||||
}
|
||||
|
||||
prevSelected = each.isSelected();
|
||||
|
||||
@@ -176,7 +176,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
|
||||
final Object element = it.next();
|
||||
if (isMatchingElement(element, _s)) return element;
|
||||
}
|
||||
return isMatchingElement(current, _s) ? current : null;
|
||||
return ( current != null && isMatchingElement(current, _s) ) ? current : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -125,12 +125,18 @@ compiler.perform.outputs.refresh.on.start.description=Whether to perform initial
|
||||
compiler.max.static.constants.searches=10000
|
||||
compiler.max.static.constants.searches.description=If the number of changed compile time constants exceeds this value, make will start full-project rebuild
|
||||
|
||||
compiler.server.heap.size=600
|
||||
compiler.server.heap.size=300
|
||||
compiler.server.heap.size.description=Heap size value in MB for the compile server process
|
||||
|
||||
compiler.server.use.memory.temp.cache=false
|
||||
compiler.server.use.memory.temp.cache=true
|
||||
compiler.server.use.memory.temp.cache.description=Store temporary data in memory for faster compilation; requires larger server heap size
|
||||
|
||||
compiler.server.use.external.javac.process=true
|
||||
compiler.server.use.external.javac.process.description=Run javac compiler in external process (allows to run compile server with smaller heap size)
|
||||
|
||||
compiler.server.debug.port=-1
|
||||
#compiler.server.javac.debug.port=-1
|
||||
|
||||
vcs.show.colored.annotations=true
|
||||
vcs.showConsole=true
|
||||
|
||||
|
||||
@@ -282,6 +282,11 @@ public class NameUtilTest extends UsefulTestCase {
|
||||
assertOrderedEquals(new NameUtil.MinusculeMatcher("doge*st", NameUtil.MatchingCaseSensitivity.NONE).matchingFragments(sample),
|
||||
TextRange.from(0, 4), TextRange.from(22, 2));
|
||||
|
||||
sample = "_test";
|
||||
assertOrderedEquals(new NameUtil.MinusculeMatcher("_", NameUtil.MatchingCaseSensitivity.NONE).matchingFragments(sample),
|
||||
TextRange.from(0, 1));
|
||||
assertOrderedEquals(new NameUtil.MinusculeMatcher("_t", NameUtil.MatchingCaseSensitivity.NONE).matchingFragments(sample),
|
||||
TextRange.from(0, 2));
|
||||
}
|
||||
|
||||
public void testMatchingDegree() {
|
||||
|
||||
+14
-1
@@ -11,6 +11,7 @@ import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.impl.PsiAwareFileEditorManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.content.Content;
|
||||
@@ -24,6 +25,7 @@ import java.util.Collection;
|
||||
*/
|
||||
public class AutoTestManager {
|
||||
private final Project myProject;
|
||||
private final PsiAwareFileEditorManagerImpl myManager;
|
||||
private final Alarm myAutoTestAlarm;
|
||||
|
||||
private static final int AUTOTEST_DELAY = 2000;
|
||||
@@ -37,8 +39,11 @@ public class AutoTestManager {
|
||||
|
||||
private final Collection<Content> myEnabledDescriptors = new WeakList<Content>();
|
||||
|
||||
public AutoTestManager(Project project) {
|
||||
public AutoTestManager(Project project, FileEditorManager manager) {
|
||||
myProject = project;
|
||||
myManager = manager instanceof PsiAwareFileEditorManagerImpl ?
|
||||
(PsiAwareFileEditorManagerImpl)manager :
|
||||
null;
|
||||
myAutoTestAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, project);
|
||||
myRunTestsRunnable = new Runnable() {
|
||||
public void run() {
|
||||
@@ -73,6 +78,14 @@ public class AutoTestManager {
|
||||
}
|
||||
|
||||
public void runAutoTests() {
|
||||
if (myManager != null) {
|
||||
for (FileEditor editor : myManager.getAllEditors()) {
|
||||
final VirtualFile file = myManager.getFile(editor);
|
||||
if (file != null && myManager.isProblem(file)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Content content : myEnabledDescriptors) {
|
||||
runAutoTest(content);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,8 @@ public class FileUtil {
|
||||
if (parent == null) {
|
||||
return false;
|
||||
}
|
||||
if (parent.equals(ancestor)) {
|
||||
// Do not user file.equals as it incorrectly works on MacOS
|
||||
if (pathsEqual(parent.getPath(), ancestor.getPath())) {
|
||||
return true;
|
||||
}
|
||||
parent = getParentFile(parent);
|
||||
|
||||
@@ -570,6 +570,7 @@ public class StringUtil {
|
||||
@Nullable String additionalChars,
|
||||
boolean escapeSlash,
|
||||
@NotNull @NonNls StringBuilder buffer) {
|
||||
char prev = 0;
|
||||
for (int idx = 0; idx < length; idx++) {
|
||||
char ch = str.charAt(idx);
|
||||
switch (ch) {
|
||||
@@ -597,7 +598,7 @@ public class StringUtil {
|
||||
if (escapeSlash && ch == '\\') {
|
||||
buffer.append("\\\\");
|
||||
}
|
||||
else if (additionalChars != null && additionalChars.indexOf(ch) > -1) {
|
||||
else if (additionalChars != null && additionalChars.indexOf(ch) > -1 && (escapeSlash || prev != '\\')) {
|
||||
buffer.append("\\").append(ch);
|
||||
}
|
||||
else if (Character.isISOControl(ch)) {
|
||||
@@ -613,6 +614,7 @@ public class StringUtil {
|
||||
buffer.append(ch);
|
||||
}
|
||||
}
|
||||
prev = ch;
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
|
||||
@@ -486,17 +486,21 @@ public class NameUtil {
|
||||
while (i > 0) {
|
||||
FList<TextRange> ranges = matchName(name, patternIndex + i, nextStart);
|
||||
if (ranges != null) {
|
||||
TextRange head = ranges.getHead();
|
||||
if (head != null && head.getStartOffset() == nameIndex + i) {
|
||||
return ranges.getTail().prepend(new TextRange(nameIndex, head.getEndOffset()));
|
||||
}
|
||||
return ranges.prepend(TextRange.from(nameIndex, i));
|
||||
return prependRange(ranges, nameIndex, i);
|
||||
}
|
||||
i--;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static FList<TextRange> prependRange(FList<TextRange> ranges, int from, int length) {
|
||||
TextRange head = ranges.getHead();
|
||||
if (head != null && head.getStartOffset() == from + length) {
|
||||
return ranges.getTail().prepend(new TextRange(from, head.getEndOffset()));
|
||||
}
|
||||
return ranges.prepend(TextRange.from(from, length));
|
||||
}
|
||||
|
||||
private boolean isWordSeparator(char c) {
|
||||
return mySeparatorFunction.fun(c);
|
||||
}
|
||||
@@ -513,7 +517,12 @@ public class NameUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchName(name, patternIndex + 1, nextStart);
|
||||
final FList<TextRange> ranges = matchName(name, patternIndex + 1, nextStart);
|
||||
if (ranges != null) {
|
||||
return prependRange(ranges, nameIndex, 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return matchName(name, patternIndex, nextStart);
|
||||
|
||||
@@ -217,6 +217,17 @@ public class ContainerUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static <T> boolean process(@NotNull List<? extends T> list, @NotNull Processor<T> processor) {
|
||||
//noinspection ForLoopReplaceableByForEach
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
T t = list.get(i);
|
||||
if (!processor.process(t)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static <T> boolean process(@NotNull T[] iterable, @NotNull Processor<? super T> processor) {
|
||||
for (final T t : iterable) {
|
||||
if (!processor.process(t)) {
|
||||
|
||||
@@ -111,4 +111,10 @@ public class StringUtilTest extends TestCase {
|
||||
public void testTitleCase() {
|
||||
assertEquals("Couldn't Connect to Debugger", StringUtil.wordsToBeginFromUpperCase("Couldn't connect to debugger"));
|
||||
}
|
||||
|
||||
public void testEscapeStringCharacters() {
|
||||
assertEquals("\\\"\\n", StringUtil.escapeStringCharacters(3, "\\\"\n", "\"", false, new StringBuilder()).toString());
|
||||
assertEquals("\\\"\\n", StringUtil.escapeStringCharacters(2, "\"\n", "\"", false, new StringBuilder()).toString());
|
||||
assertEquals("\\\\\\\"\\n", StringUtil.escapeStringCharacters(3, "\\\"\n", "\"", true, new StringBuilder()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,6 +223,9 @@ public abstract class VcsVFSListener implements Disposable {
|
||||
getSingleFileDeletePromptTemplate(), myRemoveOption);
|
||||
}
|
||||
|
||||
protected void beforeContentsChange(VirtualFile file) {
|
||||
}
|
||||
|
||||
private void addFileToMove(final VirtualFile file, final String newParentPath, final String newName) {
|
||||
if (file.isDirectory() && !isDirectoryVersioningSupported()) {
|
||||
VirtualFile[] children = file.getChildren();
|
||||
@@ -372,6 +375,14 @@ public abstract class VcsVFSListener implements Disposable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeContentsChange(VirtualFileEvent event) {
|
||||
if (!isEventIgnored(event, false)) {
|
||||
assert !event.getFile().isDirectory();
|
||||
VcsVFSListener.this.beforeContentsChange(event.getFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class MyCommandAdapter extends CommandAdapter {
|
||||
|
||||
@@ -449,12 +449,6 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
}
|
||||
});
|
||||
|
||||
for (VcsDirtyScope scope : scopes) {
|
||||
if (scope.getVcs().needsLastUnchangedContent()) {
|
||||
updateLastUnchangedContents(scope);
|
||||
}
|
||||
}
|
||||
|
||||
myChangesViewManager.scheduleRefresh();
|
||||
}
|
||||
catch (DisposedException e) {
|
||||
@@ -628,55 +622,6 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLastUnchangedContents(VcsDirtyScope scope) {
|
||||
scope.iterateExistingInsideScope(new Processor<VirtualFile>() {
|
||||
@Override
|
||||
public boolean process(VirtualFile file) {
|
||||
if (!file.isDirectory() && getStatus(file) == FileStatus.NOT_CHANGED) {
|
||||
LastUnchangedContentTracker.updateLastUnchangedContent(file);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void collectUnchangedFileContents(@Nullable ProgressIndicator indicator) {
|
||||
final ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
|
||||
for (VcsDirectoryMapping mapping : vcsManager.getDirectoryMappings()) {
|
||||
final AbstractVcs vcs = vcsManager.findVcsByName(mapping.getVcs());
|
||||
final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(mapping.getDirectory());
|
||||
if (vcs != null && file != null && vcs.needsLastUnchangedContent()) {
|
||||
if (indicator != null) {
|
||||
indicator.setText(mapping.getDirectory());
|
||||
}
|
||||
|
||||
final VcsDirtyScopeImpl scope = new VcsDirtyScopeImpl(vcs, myProject);
|
||||
scope.addDirtyDirRecursively(new FilePathImpl(file));
|
||||
updateLastUnchangedContents(scope);
|
||||
}
|
||||
}
|
||||
|
||||
for (LocalChangeList list : getChangeListsCopy()) {
|
||||
for (Change change : list.getChanges()) {
|
||||
final VirtualFile file = change.getVirtualFile();
|
||||
final ContentRevision before = change.getBeforeRevision();
|
||||
if (file != null && before != null && !LastUnchangedContentTracker.hasSavedContent(file)) {
|
||||
try {
|
||||
final String content = before.getContent();
|
||||
if (content != null) {
|
||||
LastUnchangedContentTracker.forceSavedContent(file, content);
|
||||
}
|
||||
}
|
||||
catch (VcsException e) {
|
||||
LOG.info(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkIfDisposed() {
|
||||
if (myUpdater.isStopped()) throw new DisposedException();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.intellij.junit4;
|
||||
|
||||
import com.intellij.rt.execution.junit.*;
|
||||
import com.intellij.rt.execution.junit.IDEAJUnitListener;
|
||||
import com.intellij.rt.execution.junit.IdeaTestRunner;
|
||||
import com.intellij.rt.execution.junit.TimeSender;
|
||||
import com.intellij.rt.execution.junit.TreeSender;
|
||||
import com.intellij.rt.execution.junit.segments.OutputObjectRegistry;
|
||||
import com.intellij.rt.execution.junit.segments.SegmentedOutputStream;
|
||||
import org.junit.internal.requests.ClassRequest;
|
||||
@@ -25,7 +28,9 @@ import org.junit.runner.manipulation.Filter;
|
||||
import org.junit.runner.notification.RunListener;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/** @noinspection UnusedDeclaration*/
|
||||
public class JUnit4IdeaTestRunner implements IdeaTestRunner {
|
||||
@@ -93,17 +98,20 @@ public class JUnit4IdeaTestRunner implements IdeaTestRunner {
|
||||
field.setAccessible(true);
|
||||
final Filter filter = (Filter)field.get(request);
|
||||
final String filterDescription = filter.describe();
|
||||
if (filterDescription != null && (filterDescription.startsWith("Failed tests") || filterDescription.startsWith("Ignored"))) {
|
||||
if (filterDescription != null) {
|
||||
boolean isMethodFilter = filterDescription.startsWith("Method");
|
||||
if (isMethodFilter && canCompress(description)) return (Description)description.getChildren().get(0);
|
||||
try {
|
||||
final Description failedTestsDescription = Description.createSuiteDescription(filterDescription, null);
|
||||
for (Iterator iterator = description.getChildren().iterator(); iterator.hasNext();) {
|
||||
final Description childDescription = (Description)iterator.next();
|
||||
if (filter.shouldRun(childDescription)) {
|
||||
failedTestsDescription.addChild(childDescription);
|
||||
if (filterDescription.startsWith("Tests") || filterDescription.startsWith("Ignored")) {
|
||||
for (Iterator iterator = description.getChildren().iterator(); iterator.hasNext(); ) {
|
||||
final Description childDescription = (Description)iterator.next();
|
||||
if (filter.shouldRun(childDescription)) {
|
||||
failedTestsDescription.addChild(childDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
description = failedTestsDescription;
|
||||
if (!failedTestsDescription.isTest() && failedTestsDescription.testCount() == 1 && filterDescription.startsWith("Method")) {
|
||||
description = failedTestsDescription;
|
||||
} else if (isMethodFilter && canCompress(failedTestsDescription)) {
|
||||
description = (Description)failedTestsDescription.getChildren().get(0);
|
||||
}
|
||||
}
|
||||
@@ -114,6 +122,10 @@ public class JUnit4IdeaTestRunner implements IdeaTestRunner {
|
||||
return description;
|
||||
}
|
||||
|
||||
private static boolean canCompress(Description description) {
|
||||
return !description.isTest() && description.testCount() == 1;
|
||||
}
|
||||
|
||||
private static Description getSuiteMethodDescription(Request request, Description description) throws NoSuchFieldException, IllegalAccessException {
|
||||
final Field field = ClassRequest.class.getDeclaredField("fTestClass");
|
||||
field.setAccessible(true);
|
||||
|
||||
+75
-67
@@ -6,13 +6,13 @@ import com.intellij.find.impl.FindInProjectUtil;
|
||||
import com.intellij.find.replaceInProject.ReplaceInProjectManager;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Factory;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -40,7 +40,7 @@ import org.jetbrains.idea.maven.dom.MavenDomUtil;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProperties;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class IntroducePropertyAction extends BaseRefactoringAction {
|
||||
private static String PREFIX = "${";
|
||||
@@ -126,7 +126,7 @@ public class IntroducePropertyAction extends BaseRefactoringAction {
|
||||
final MavenDomProjectModel model = MavenDomUtil.getMavenDomModel(file, MavenDomProjectModel.class);
|
||||
final String selectedString = editor.getDocument().getText(range);
|
||||
|
||||
Set<TextRange> ranges = getPropertiesTextRanges(stringValue);
|
||||
List<TextRange> ranges = getPropertiesTextRanges(stringValue);
|
||||
int offsetInElement = range.getStartOffset() - selectedElement.getTextOffset();
|
||||
|
||||
if (model == null ||
|
||||
@@ -251,78 +251,88 @@ public class IntroducePropertyAction extends BaseRefactoringAction {
|
||||
Set<UsageInfo> usages = new HashSet<UsageInfo>();
|
||||
|
||||
public void generate(final Processor<Usage> processor) {
|
||||
AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
|
||||
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
collectUsages(myModel);
|
||||
for (MavenDomProjectModel model : MavenDomProjectProcessorUtils.getChildrenProjects(myModel)) {
|
||||
collectUsages(model);
|
||||
}
|
||||
|
||||
for (UsageInfo2UsageAdapter adapter : UsageInfo2UsageAdapter.convert(usages.toArray(new UsageInfo[usages.size()]))) {
|
||||
processor.process(adapter);
|
||||
}
|
||||
try {
|
||||
collectUsages(myModel);
|
||||
for (MavenDomProjectModel model : MavenDomProjectProcessorUtils.getChildrenProjects(myModel)) {
|
||||
collectUsages(model);
|
||||
}
|
||||
|
||||
private void collectUsages(@NotNull MavenDomProjectModel model) {
|
||||
if (model.isValid()) {
|
||||
final XmlElement root = model.getXmlElement();
|
||||
if (root != null) {
|
||||
root.acceptChildren(new XmlElementVisitor() {
|
||||
for (UsageInfo usage : usages) {
|
||||
processor.process(UsageInfo2UsageAdapter.CONVERTER.fun(usage));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
accessToken.finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitXmlText(XmlText text) {
|
||||
XmlTag xmlTag = PsiTreeUtil.getParentOfType(text, XmlTag.class);
|
||||
if (xmlTag != null && !xmlTag.getName().equals(myPropertyName)) {
|
||||
usages.addAll(getUsages(text));
|
||||
}
|
||||
}
|
||||
private void collectUsages(@NotNull MavenDomProjectModel model) {
|
||||
if (model.isValid()) {
|
||||
final XmlElement root = model.getXmlElement();
|
||||
if (root != null) {
|
||||
root.acceptChildren(new XmlElementVisitor() {
|
||||
|
||||
@Override
|
||||
public void visitXmlAttributeValue(XmlAttributeValue value) {
|
||||
XmlTag xmlTag = PsiTreeUtil.getParentOfType(value, XmlTag.class);
|
||||
if (xmlTag != null && !xmlTag.equals(root)) {
|
||||
usages.addAll(getUsages(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitXmlElement(XmlElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void visitXmlText(XmlText text) {
|
||||
XmlTag xmlTag = PsiTreeUtil.getParentOfType(text, XmlTag.class);
|
||||
if (xmlTag != null && !xmlTag.getName().equals(myPropertyName)) {
|
||||
usages.addAll(getUsages(text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitXmlAttributeValue(XmlAttributeValue value) {
|
||||
XmlTag xmlTag = PsiTreeUtil.getParentOfType(value, XmlTag.class);
|
||||
if (xmlTag != null && !xmlTag.equals(root)) {
|
||||
usages.addAll(getUsages(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitXmlElement(XmlElement element) {
|
||||
element.acceptChildren(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Set<UsageInfo> getUsages(@NotNull XmlElement xmlElement) {
|
||||
String s = xmlElement.getText();
|
||||
if (StringUtil.isEmptyOrSpaces(s)) return Collections.emptySet();
|
||||
|
||||
int start = s.indexOf(mySelectedString);
|
||||
if (start == -1) return Collections.emptySet();
|
||||
|
||||
Set<UsageInfo> usages = new HashSet<UsageInfo>();
|
||||
|
||||
List<TextRange> ranges = getPropertiesTextRanges(s);
|
||||
TextRange elementTextRange = xmlElement.getTextRange();
|
||||
PsiFile containingFile = xmlElement.getContainingFile();
|
||||
|
||||
do {
|
||||
int end = start + mySelectedString.length();
|
||||
boolean isInsideProperty = isInsideTextRanges(ranges, start, end);
|
||||
if (!isInsideProperty) {
|
||||
usages
|
||||
.add(new UsageInfo(containingFile, elementTextRange.getStartOffset() + start, elementTextRange.getStartOffset() + end));
|
||||
}
|
||||
start = s.indexOf(mySelectedString, end);
|
||||
}
|
||||
while (start != -1);
|
||||
|
||||
return usages;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Set<UsageInfo> getUsages(@NotNull XmlElement xmlElement) {
|
||||
String s = xmlElement.getText();
|
||||
Set<UsageInfo> usages = new HashSet<UsageInfo>();
|
||||
if (!StringUtil.isEmptyOrSpaces(s)) {
|
||||
Set<TextRange> ranges = getPropertiesTextRanges(s);
|
||||
|
||||
int start = s.indexOf(mySelectedString);
|
||||
while (start >= 0) {
|
||||
int end = start + mySelectedString.length();
|
||||
boolean isInsideProperty = isInsideTextRanges(ranges, start, end);
|
||||
if (!isInsideProperty) {
|
||||
usages.add(new UsageInfo(xmlElement, start, end));
|
||||
}
|
||||
start = s.indexOf(mySelectedString, end);
|
||||
}
|
||||
}
|
||||
return usages;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<TextRange> getPropertiesTextRanges(String s) {
|
||||
Set<TextRange> ranges = new HashSet<TextRange>();
|
||||
private static List<TextRange> getPropertiesTextRanges(String s) {
|
||||
List<TextRange> ranges = new ArrayList<TextRange>();
|
||||
int startOffset = s.indexOf(PREFIX);
|
||||
while (startOffset >= 0) {
|
||||
int endOffset = s.indexOf(SUFFIX, startOffset);
|
||||
@@ -343,15 +353,13 @@ public class IntroducePropertyAction extends BaseRefactoringAction {
|
||||
return ranges;
|
||||
}
|
||||
|
||||
private static boolean isInsideTextRanges(@NotNull Set<TextRange> ranges, int start, int end) {
|
||||
boolean isInsideProperty = false;
|
||||
private static boolean isInsideTextRanges(@NotNull Collection<TextRange> ranges, int start, int end) {
|
||||
for (TextRange range : ranges) {
|
||||
if ((start >= range.getStartOffset() && (end <= range.getEndOffset() || start <= range.getEndOffset())) ||
|
||||
(end <= range.getEndOffset() && (end > range.getStartOffset()))) {
|
||||
isInsideProperty = true;
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return isInsideProperty;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,16 +31,15 @@ import java.util.List;
|
||||
* @author yole
|
||||
*/
|
||||
public class IncreaseIndentAction extends AbstractGuiEditorAction {
|
||||
private final IndentProperty myIndentProperty = new IndentProperty();
|
||||
|
||||
public IncreaseIndentAction() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
|
||||
IndentProperty indentProperty = IndentProperty.getInstance(editor.getProject());
|
||||
for(RadComponent c: selection) {
|
||||
int indent = myIndentProperty.getValue(c).intValue();
|
||||
myIndentProperty.setValueEx(c, adjustIndent(indent));
|
||||
int indent = indentProperty.getValue(c).intValue();
|
||||
indentProperty.setValueEx(c, adjustIndent(indent));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -172,6 +172,7 @@ class XmlMover extends LineMover {
|
||||
if (offset + 1 < document.getTextLength()) {
|
||||
final int line = document.getLineNumber(offset + 1);
|
||||
final LineRange toMove2 = info.toMove2;
|
||||
if (toMove2 == null) return;
|
||||
info.toMove2 = new LineRange(toMove2.startLine, Math.min(Math.max(line, toMove2.endLine), document.getLineCount() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user