mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
Generated
+9
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="nekohtml">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/nekohtml-1.9.14.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@@ -41,37 +41,43 @@ private pass(String prop) {
|
||||
target('run_tests': 'Run java tests') {
|
||||
depends([compile])
|
||||
|
||||
ant.junit(fork: "yes", showoutput: "true", logfailedtests:false) {
|
||||
pass("idea.test.group")
|
||||
pass("idea.test.patterns")
|
||||
pass("idea.fast.only")
|
||||
pass("teamcity.build.tempDir")
|
||||
pass("teamcity.tests.recentlyFailedTests.file")
|
||||
jvmarg (value: "-Didea.platform.prefix=Idea")
|
||||
jvmarg (value: "-Djava.system.class.loader=com.intellij.util.lang.UrlClassLoader")
|
||||
def classpathFile = "$home/junit.classpath"
|
||||
List<String> testRuntimeClasspath = projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true)
|
||||
new File(classpathFile).text = testRuntimeClasspath.findAll({ new File((String)it).exists() }).join('\n')
|
||||
|
||||
System.getProperties().entrySet().each {
|
||||
if (it.key.startsWith("pass.")) {
|
||||
def trimmed = it.key.substring("pass.".length());
|
||||
jvmarg(value: "-D${trimmed}=${it.value}");
|
||||
};
|
||||
}
|
||||
testcases.each { testCase ->
|
||||
ant.junit(fork: "yes", showoutput: "true", logfailedtests: false) {
|
||||
jvmarg(value: "-Dclasspath.file=${classpathFile}")
|
||||
pass("idea.test.group")
|
||||
pass("idea.test.patterns")
|
||||
pass("idea.fast.only")
|
||||
pass("teamcity.build.tempDir")
|
||||
pass("teamcity.tests.recentlyFailedTests.file")
|
||||
jvmarg(value: "-Didea.platform.prefix=Idea")
|
||||
|
||||
commonJvmArgs().each { jvmarg(value: it) }
|
||||
|
||||
if (isDefined("jvm_args")) {
|
||||
jvm_args.each { jvmarg(value: it) }
|
||||
}
|
||||
|
||||
classpath {
|
||||
projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true).each {
|
||||
pathelement(location: it)
|
||||
System.getProperties().entrySet().each {
|
||||
if (it.key.startsWith("pass.")) {
|
||||
def trimmed = it.key.substring("pass.".length());
|
||||
jvmarg(value: "-D${trimmed}=${it.value}");
|
||||
};
|
||||
}
|
||||
pathelement(location: "${jdkHome}/lib/tools.jar")
|
||||
}
|
||||
|
||||
testcases.each {
|
||||
test (name: it)
|
||||
commonJvmArgs().each { jvmarg(value: it) }
|
||||
|
||||
jvmarg(value: "-Dbootstrap.testcases=$testCase")
|
||||
|
||||
if (isDefined("jvm_args")) {
|
||||
jvm_args.each { jvmarg(value: it) }
|
||||
}
|
||||
|
||||
classpath {
|
||||
projectBuilder.moduleRuntimeClasspath(findModule("tests_bootstrap"), false).each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
pathelement(location: "${jdkHome}/lib/tools.jar")
|
||||
}
|
||||
|
||||
test(name: 'com.intellij.tests.BootstrapTests')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.intellij.history.LocalHistory;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompileStatusNotification;
|
||||
@@ -31,7 +30,9 @@ public class CompileProjectAction extends CompileActionBase {
|
||||
protected void doAction(DataContext dataContext, final Project project) {
|
||||
CompilerManager.getInstance(project).rebuild(new CompileStatusNotification() {
|
||||
public void finished(boolean aborted, int errors, int warnings, final CompileContext compileContext) {
|
||||
if (aborted) return;
|
||||
if (aborted || project.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String text = getTemplatePresentation().getText();
|
||||
LocalHistory.getInstance().putSystemLabel(project, errors == 0
|
||||
|
||||
@@ -24,6 +24,7 @@ package com.intellij.compiler.impl;
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.compiler.CompilerMessageImpl;
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.ProblemsView;
|
||||
import com.intellij.compiler.progress.CompilerTask;
|
||||
import com.intellij.execution.impl.ExecutionManagerImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -156,7 +157,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
myTask.addMessage(msg);
|
||||
}
|
||||
if (myShouldUpdateProblemsView && msg.getCategory() == CompilerMessageCategory.ERROR) {
|
||||
ProblemsViewImpl.SERVICE.getInstance(myProject).addMessage(msg, mySessionId);
|
||||
ProblemsView.SERVICE.getInstance(myProject).addMessage(msg, mySessionId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ public class CompileDriver {
|
||||
@Override
|
||||
public void sessionTerminated(final UUID sessionId) {
|
||||
if (compileContext.shouldUpdateProblemsView()) {
|
||||
final ProblemsView view = ProblemsViewImpl.SERVICE.getInstance(myProject);
|
||||
final ProblemsView view = ProblemsView.SERVICE.getInstance(myProject);
|
||||
view.clearProgress();
|
||||
view.clearOldMessages(compileContext.getCompileScope(), compileContext.getSessionId());
|
||||
}
|
||||
|
||||
@@ -157,9 +157,10 @@ public class ProblemsViewImpl extends ProblemsView{
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final ToolWindowManager twManager = ToolWindowManager.getInstance(myProject);
|
||||
final ToolWindow tw = twManager.getToolWindow(PROBLEMS_TOOLWINDOW_ID);
|
||||
tw.setIcon(active ? myActiveIcon : myPassiveIcon);
|
||||
final ToolWindow tw = ToolWindowManager.getInstance(myProject).getToolWindow(PROBLEMS_TOOLWINDOW_ID);
|
||||
if (tw != null) {
|
||||
tw.setIcon(active ? myActiveIcon : myPassiveIcon);
|
||||
}
|
||||
}
|
||||
}, myProject.getDisposed());
|
||||
}
|
||||
|
||||
+36
-25
@@ -220,31 +220,11 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
|
||||
@Override
|
||||
public void visitForStatement(PsiForStatement statement) {
|
||||
PsiStatement initializer = statement.getInitialization();
|
||||
Evaluator initializerEvaluator = null;
|
||||
if(initializer != null){
|
||||
initializer.accept(this);
|
||||
initializerEvaluator = myResult;
|
||||
}
|
||||
|
||||
PsiExpression condition = statement.getCondition();
|
||||
Evaluator conditionEvaluator = null;
|
||||
if(condition != null) {
|
||||
condition.accept(this);
|
||||
conditionEvaluator = myResult;
|
||||
}
|
||||
|
||||
PsiStatement update = statement.getUpdate();
|
||||
Evaluator updateEvaluator = null;
|
||||
if(update != null){
|
||||
update.accept(this);
|
||||
updateEvaluator = myResult;
|
||||
}
|
||||
|
||||
PsiStatement body = statement.getBody();
|
||||
if(body == null) return;
|
||||
body.accept(this);
|
||||
Evaluator bodyEvaluator = myResult;
|
||||
Evaluator initializerEvaluator = accept(statement.getInitialization());
|
||||
Evaluator conditionEvaluator = accept(statement.getCondition());
|
||||
Evaluator updateEvaluator = accept(statement.getUpdate());
|
||||
Evaluator bodyEvaluator = accept(statement.getBody());
|
||||
if (bodyEvaluator == null) return;
|
||||
|
||||
String label = null;
|
||||
if(statement.getParent() instanceof PsiLabeledStatement) {
|
||||
@@ -253,6 +233,37 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
|
||||
myResult = new ForStatementEvaluator(initializerEvaluator, conditionEvaluator, updateEvaluator, bodyEvaluator, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitForeachStatement(PsiForeachStatement statement) {
|
||||
try {
|
||||
String iterationParameterName = statement.getIterationParameter().getName();
|
||||
myCurrentFragmentEvaluator.setInitialValue(iterationParameterName, null);
|
||||
SyntheticVariableEvaluator iterationParameterEvaluator = new SyntheticVariableEvaluator(myCurrentFragmentEvaluator, iterationParameterName);
|
||||
|
||||
Evaluator iteratedValueEvaluator = accept(statement.getIteratedValue());
|
||||
Evaluator bodyEvaluator = accept(statement.getBody());
|
||||
if (bodyEvaluator == null) return;
|
||||
|
||||
String label = null;
|
||||
if(statement.getParent() instanceof PsiLabeledStatement) {
|
||||
label = ((PsiLabeledStatement)statement.getParent()).getLabelIdentifier().getText();
|
||||
}
|
||||
myResult = new ForeachStatementEvaluator(iterationParameterEvaluator, iteratedValueEvaluator, bodyEvaluator, label);
|
||||
}
|
||||
catch (EvaluateException e) {
|
||||
throw new EvaluateRuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Evaluator accept(@Nullable PsiElement element) {
|
||||
if (element == null) {
|
||||
return null;
|
||||
}
|
||||
element.accept(this);
|
||||
return myResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitIfStatement(PsiIfStatement statement) {
|
||||
PsiStatement thenBranch = statement.getThenBranch();
|
||||
|
||||
+33
-53
@@ -16,87 +16,67 @@
|
||||
package com.intellij.debugger.engine.evaluation.expression;
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.sun.jdi.BooleanValue;
|
||||
|
||||
/**
|
||||
* @author lex
|
||||
*/
|
||||
public class ForStatementEvaluator implements Evaluator {
|
||||
public class ForStatementEvaluator extends ForStatementEvaluatorBase {
|
||||
private final Evaluator myInitializationEvaluator;
|
||||
private final Evaluator myConditionEvaluator;
|
||||
private final Evaluator myUpdateEvaluator;
|
||||
private final Evaluator myBodyEvaluator;
|
||||
|
||||
private Modifier myModifier;
|
||||
private final String myLabelName;
|
||||
|
||||
public ForStatementEvaluator(Evaluator initializationEvaluator,
|
||||
Evaluator conditionEvaluator,
|
||||
Evaluator updateEvaluator,
|
||||
Evaluator bodyEvaluator,
|
||||
String labelName) {
|
||||
myInitializationEvaluator = new DisableGC(initializationEvaluator);
|
||||
myConditionEvaluator = new DisableGC(conditionEvaluator);
|
||||
myUpdateEvaluator = new DisableGC(updateEvaluator);
|
||||
myBodyEvaluator = new DisableGC(bodyEvaluator);
|
||||
myLabelName = labelName;
|
||||
super(labelName);
|
||||
myInitializationEvaluator = initializationEvaluator != null ? new DisableGC(initializationEvaluator) : null;
|
||||
myConditionEvaluator = conditionEvaluator != null ? new DisableGC(conditionEvaluator) : null;
|
||||
myUpdateEvaluator = updateEvaluator != null ? new DisableGC(updateEvaluator) : null;
|
||||
myBodyEvaluator = bodyEvaluator != null ? new DisableGC(bodyEvaluator) : null;
|
||||
}
|
||||
|
||||
public Modifier getModifier() {
|
||||
return myModifier;
|
||||
}
|
||||
|
||||
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
|
||||
Object value = context.getDebugProcess().getVirtualMachineProxy().mirrorOf();
|
||||
@Override
|
||||
protected void evaluateBody(EvaluationContextImpl context) throws EvaluateException {
|
||||
if (myBodyEvaluator != null) {
|
||||
myBodyEvaluator.evaluate(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object evaluateInitialization(EvaluationContextImpl context, Object value) throws EvaluateException {
|
||||
if (myInitializationEvaluator != null) {
|
||||
value = myInitializationEvaluator.evaluate(context);
|
||||
myModifier = myInitializationEvaluator.getModifier();
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (myConditionEvaluator != null) {
|
||||
value = myConditionEvaluator.evaluate(context);
|
||||
myModifier = myConditionEvaluator.getModifier();
|
||||
if (!(value instanceof BooleanValue)) {
|
||||
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
|
||||
}
|
||||
else {
|
||||
if (!((BooleanValue)value).booleanValue()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
myBodyEvaluator.evaluate(context);
|
||||
}
|
||||
catch (BreakException e) {
|
||||
if (Comparing.equal(e.getLabelName(), myLabelName)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
catch (ContinueException e) {
|
||||
if (Comparing.equal(e.getLabelName(), myLabelName)) {
|
||||
//continue;
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
if (myUpdateEvaluator != null) {
|
||||
value = myUpdateEvaluator.evaluate(context);
|
||||
myModifier = myUpdateEvaluator.getModifier();
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object evaluateCondition(EvaluationContextImpl context) throws EvaluateException {
|
||||
if (myConditionEvaluator != null) {
|
||||
Object value = myConditionEvaluator.evaluate(context);
|
||||
myModifier = myConditionEvaluator.getModifier();
|
||||
return value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object evaluateUpdate(EvaluationContextImpl context, Object value) throws EvaluateException {
|
||||
if (myUpdateEvaluator != null) {
|
||||
value = myUpdateEvaluator.evaluate(context);
|
||||
myModifier = myUpdateEvaluator.getModifier();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.engine.evaluation.expression;
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.sun.jdi.BooleanValue;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public abstract class ForStatementEvaluatorBase implements Evaluator {
|
||||
private final String myLabelName;
|
||||
|
||||
public ForStatementEvaluatorBase(String labelName) {
|
||||
myLabelName = labelName;
|
||||
}
|
||||
|
||||
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
|
||||
Object value = context.getDebugProcess().getVirtualMachineProxy().mirrorOf();
|
||||
value = evaluateInitialization(context, value);
|
||||
|
||||
while (true) {
|
||||
// condition
|
||||
Object codition = evaluateCondition(context);
|
||||
if (codition instanceof Boolean) {
|
||||
if (!(Boolean)codition) break;
|
||||
}
|
||||
else if (codition instanceof BooleanValue) {
|
||||
if (!((BooleanValue)codition).booleanValue()) break;
|
||||
}
|
||||
else {
|
||||
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
|
||||
}
|
||||
|
||||
// body
|
||||
|
||||
try {
|
||||
evaluateBody(context);
|
||||
}
|
||||
catch (BreakException e) {
|
||||
if (Comparing.equal(e.getLabelName(), myLabelName)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
catch (ContinueException e) {
|
||||
if (Comparing.equal(e.getLabelName(), myLabelName)) {
|
||||
//continue;
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
// update
|
||||
value = evaluateUpdate(context, value);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
protected Object evaluateInitialization(EvaluationContextImpl context, Object value) throws EvaluateException {
|
||||
return value;
|
||||
}
|
||||
|
||||
protected Object evaluateCondition(EvaluationContextImpl context) throws EvaluateException {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void evaluateBody(EvaluationContextImpl context) throws EvaluateException {
|
||||
}
|
||||
|
||||
protected Object evaluateUpdate(EvaluationContextImpl context, Object value) throws EvaluateException {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.debugger.engine.evaluation.expression;
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.sun.jdi.ArrayReference;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class ForeachStatementEvaluator extends ForStatementEvaluatorBase {
|
||||
private final Evaluator myIterationParameterEvaluator;
|
||||
private final Evaluator myIterableEvaluator;
|
||||
private final Evaluator myBodyEvaluator;
|
||||
|
||||
private Evaluator myConditionEvaluator;
|
||||
private Evaluator myNextEvaluator;
|
||||
|
||||
private int myArrayLength = -1;
|
||||
private int myCurrentIndex = 0;
|
||||
|
||||
private Modifier myModifier;
|
||||
|
||||
public ForeachStatementEvaluator(Evaluator iterationParameterEvaluator,
|
||||
Evaluator iterableEvaluator,
|
||||
Evaluator bodyEvaluator,
|
||||
String labelName) {
|
||||
super(labelName);
|
||||
myIterationParameterEvaluator = iterationParameterEvaluator;
|
||||
myIterableEvaluator = new DisableGC(iterableEvaluator);
|
||||
myBodyEvaluator = bodyEvaluator != null ? new DisableGC(bodyEvaluator) : null;
|
||||
}
|
||||
|
||||
public Modifier getModifier() {
|
||||
return myModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object evaluateInitialization(EvaluationContextImpl context, Object value) throws EvaluateException {
|
||||
final Object iterable = myIterableEvaluator.evaluate(context);
|
||||
if (!(iterable instanceof ObjectReference)) {
|
||||
throw new EvaluateException("Unable to do foreach for" + iterable);
|
||||
}
|
||||
IdentityEvaluator iterableEvaluator = new IdentityEvaluator((Value)iterable);
|
||||
if (iterable instanceof ArrayReference) {
|
||||
myArrayLength = ((ArrayReference)iterable).length();
|
||||
myNextEvaluator = new AssignmentEvaluator(myIterationParameterEvaluator,
|
||||
new Evaluator() {
|
||||
@Override
|
||||
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
|
||||
return ((ArrayReference)iterable).getValue(myCurrentIndex++);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Modifier getModifier() {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
Object iterator = new MethodEvaluator(iterableEvaluator, null, "iterator", null, new Evaluator[0]).evaluate(context);
|
||||
IdentityEvaluator iteratorEvaluator = new IdentityEvaluator((Value)iterator);
|
||||
myConditionEvaluator = new MethodEvaluator(iteratorEvaluator, null, "hasNext", null, new Evaluator[0]);
|
||||
myNextEvaluator = new AssignmentEvaluator(myIterationParameterEvaluator,
|
||||
new MethodEvaluator(iteratorEvaluator, null, "next", null, new Evaluator[0]));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private boolean isArray() {
|
||||
return myArrayLength > -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object evaluateCondition(EvaluationContextImpl context) throws EvaluateException {
|
||||
if (isArray()) {
|
||||
return myCurrentIndex < myArrayLength;
|
||||
}
|
||||
else {
|
||||
Object res = myConditionEvaluator.evaluate(context);
|
||||
myModifier = myConditionEvaluator.getModifier();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void evaluateBody(EvaluationContextImpl context) throws EvaluateException {
|
||||
myNextEvaluator.evaluate(context);
|
||||
if (myBodyEvaluator != null) {
|
||||
myBodyEvaluator.evaluate(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
-3
@@ -25,12 +25,14 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.ui.DebuggerExpressionTextField;
|
||||
import com.intellij.debugger.ui.JavaDebuggerSupport;
|
||||
import com.intellij.debugger.ui.tree.render.*;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
@@ -141,10 +143,17 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
|
||||
}
|
||||
}
|
||||
}, myProject);
|
||||
myClassNameField.getEditorTextField().addFocusListener(new FocusAdapter() {
|
||||
final EditorTextField textField = myClassNameField.getEditorTextField();
|
||||
final FocusAdapter updateContextListener = new FocusAdapter() {
|
||||
public void focusLost(FocusEvent e) {
|
||||
final String qName = myClassNameField.getText();
|
||||
updateContext(qName);
|
||||
updateContext(myClassNameField.getText());
|
||||
}
|
||||
};
|
||||
textField.addFocusListener(updateContextListener);
|
||||
Disposer.register(myClassNameField, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
textField.removeFocusListener(updateContextListener);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -388,10 +397,12 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
|
||||
myChildrenEditor.dispose();
|
||||
myChildrenExpandedEditor.dispose();
|
||||
myListChildrenEditor.dispose();
|
||||
Disposer.dispose(myClassNameField);
|
||||
myLabelEditor = null;
|
||||
myChildrenEditor = null;
|
||||
myChildrenExpandedEditor = null;
|
||||
myListChildrenEditor = null;
|
||||
myClassNameField = null;
|
||||
myProject = null;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,6 +154,11 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
|
||||
@Override
|
||||
protected final void doOKAction() {
|
||||
if (!doFinishAction()) return;
|
||||
super.doOKAction();
|
||||
}
|
||||
|
||||
public boolean doFinishAction() {
|
||||
int idx = getCurrentStep();
|
||||
try {
|
||||
do {
|
||||
@@ -162,7 +167,7 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
step.updateStep();
|
||||
}
|
||||
if (!commitStepData(step)) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
step.onStepLeaving();
|
||||
try {
|
||||
@@ -170,18 +175,19 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
}
|
||||
catch (CommitStepException e) {
|
||||
handleCommitException(e);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (!isLastStep(idx)) {
|
||||
idx = getNextStep(idx);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (ModuleWizardStep wizardStep : mySteps) {
|
||||
try {
|
||||
wizardStep.onWizardFinished();
|
||||
}
|
||||
catch (CommitStepException e) {
|
||||
handleCommitException(e);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -192,7 +198,7 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
|
||||
myCurrentStep = idx;
|
||||
updateStep();
|
||||
}
|
||||
super.doOKAction();
|
||||
return true;
|
||||
}
|
||||
|
||||
private void handleCommitException(CommitStepException e) {
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="java-structure-view" exported="" />
|
||||
<orderEntry type="module" module-name="spellchecker" />
|
||||
<orderEntry type="library" name="nekohtml" level="project" />
|
||||
</component>
|
||||
<component name="copyright">
|
||||
<Base>
|
||||
|
||||
@@ -446,8 +446,10 @@ public class JavaCompletionUtil {
|
||||
|
||||
PsiSubstitutor plainSub = plainResult.getSubstitutor();
|
||||
PsiSubstitutor castSub = TypeConversionUtil.getSuperClassSubstitutor(plainClass, (PsiClassType)castType);
|
||||
PsiType returnType = method.getReturnType();
|
||||
if (method.getSignature(plainSub).equals(method.getSignature(castSub)) &&
|
||||
Comparing.equal(plainSub.substitute(method.getReturnType()), castSub.substitute(method.getReturnType())) &&
|
||||
returnType != null &&
|
||||
castSub.substitute(returnType).isAssignableFrom(plainSub.substitute(returnType)) &&
|
||||
processor.isAccessible(plainClass.findMethodBySignature(method, true))
|
||||
) {
|
||||
return item;
|
||||
|
||||
@@ -757,6 +757,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
|
||||
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<PsiReference> findReferencesToHighlight(@NotNull final PsiElement target, @NotNull final SearchScope searchScope) {
|
||||
if (target instanceof PsiMethod) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.util.NotNullFunction;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.download.DownloadableFileDescription;
|
||||
import com.intellij.util.download.DownloadableFileService;
|
||||
import org.apache.xerces.parsers.DOMParser;
|
||||
import org.cyberneko.html.parsers.DOMParser;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
@@ -40,11 +40,8 @@ import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -129,22 +126,9 @@ public abstract class FindJarFix<T extends PsiElement> implements IntentionActio
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Document doc;
|
||||
|
||||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
|
||||
builderFactory.setExpandEntityReferences(false);
|
||||
builderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||
|
||||
URL url = new URL(CLASS_ROOT_URL + fqn.replace('.', '/') + CLASS_PAGE_EXT);
|
||||
|
||||
InputStream stream = url.openStream();
|
||||
try {
|
||||
doc = builderFactory.newDocumentBuilder().parse(stream);
|
||||
}
|
||||
finally {
|
||||
stream.close();
|
||||
}
|
||||
|
||||
final DOMParser parser = new DOMParser();
|
||||
parser.parse(CLASS_ROOT_URL + fqn.replace('.', '/') + CLASS_PAGE_EXT);
|
||||
final Document doc = parser.getDocument();
|
||||
if (doc != null) {
|
||||
final NodeList links = doc.getElementsByTagName(LINK_TAG_NAME);
|
||||
for (int i = 0; i < links.getLength(); i++) {
|
||||
|
||||
+1
@@ -54,6 +54,7 @@ public class VariableInIncompleteCodeSearcher extends QueryExecutorBase<PsiRefer
|
||||
if (element instanceof PsiJavaCodeReferenceElement) {
|
||||
final PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)element;
|
||||
if (!ref.isQualified() && name.equals(ref.getText()) &&
|
||||
!(ref.getParent() instanceof PsiMethodCallExpression) &&
|
||||
ref.resolve() == null && ref.advancedResolve(true).getElement() == refElement) {
|
||||
consumer.process(ref);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class Test {
|
||||
public boolean isConsideredFinal(int cl) {
|
||||
return haveSeenAllExp<caret>ectedAtCl(cl);
|
||||
}
|
||||
|
||||
private boolean haveSeenAllExpectedAtCl(int cl) {
|
||||
return cl == cl();
|
||||
}
|
||||
|
||||
int cl() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class Test {
|
||||
public boolean isConsideredFinal(int cl) {
|
||||
return cl == cl();
|
||||
}
|
||||
|
||||
int cl() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -15,11 +15,8 @@
|
||||
*/
|
||||
package com.intellij.openapi.editor.impl;
|
||||
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeInsight.daemon.impl.CodeFoldingPassFactory;
|
||||
import com.intellij.mock.MockProgressIndicator;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||
|
||||
@@ -43,14 +40,7 @@ public class FoldingExceptionTest extends LightCodeInsightTestCase {
|
||||
}
|
||||
|
||||
private static void runFoldingPass() {
|
||||
PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(getProject());
|
||||
psiDocumentManager.commitAllDocuments();
|
||||
PsiFile psiFile = psiDocumentManager.getPsiFile(myEditor.getDocument());
|
||||
assertNotNull(psiFile);
|
||||
|
||||
CodeFoldingPassFactory factory = getProject().getComponent(CodeFoldingPassFactory.class);
|
||||
TextEditorHighlightingPass highlightingPass = factory.createHighlightingPass(psiFile, myEditor);
|
||||
highlightingPass.collectInformation(new MockProgressIndicator());
|
||||
highlightingPass.doApplyInformationToEditor();
|
||||
PsiDocumentManager.getInstance(ourProject).commitAllDocuments();
|
||||
EditorTestUtil.runTextEditorHighlightingPass(myEditor, CodeFoldingPassFactory.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,6 +264,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSameVarMethodNames() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTestInlineThisOnly() {
|
||||
@NonNls String fileName = "/refactoring/inlineMethod/" + getTestName(false) + ".java";
|
||||
configureByFile(fileName);
|
||||
|
||||
@@ -58,7 +58,6 @@ import java.util.List;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> extends PlatformTestCase {
|
||||
|
||||
protected static final String DEFAULT_SDK = "default";
|
||||
protected final List<Sdk> mySdks = new ArrayList<Sdk>();
|
||||
protected T myWizard;
|
||||
@@ -133,6 +132,7 @@ public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> ext
|
||||
throw new RuntimeException(currentStep + " is not validated");
|
||||
}
|
||||
}
|
||||
myWizard.doFinishAction();
|
||||
}
|
||||
|
||||
protected void createWizard(Project project) throws IOException {
|
||||
|
||||
+31
-7
@@ -39,6 +39,7 @@ import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectUtilCore;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
@@ -294,7 +295,14 @@ public class RefManagerImpl extends RefManager {
|
||||
public void findAllDeclarations() {
|
||||
if (!myDeclarationsFound) {
|
||||
long before = System.currentTimeMillis();
|
||||
getScope().accept(myProjectIterator);
|
||||
final AnalysisScope scope = getScope();
|
||||
scope.accept(myProjectIterator);
|
||||
for (Module module : ModuleManager.getInstance(getProject()).getModules()) {
|
||||
//init all ref modules in scope
|
||||
if (scope.containsModule(module)) {
|
||||
getRefModule(module);
|
||||
}
|
||||
}
|
||||
myDeclarationsFound = true;
|
||||
|
||||
LOG.info("Total duration of processing project usages:" + (System.currentTimeMillis() - before));
|
||||
@@ -559,15 +567,31 @@ public class RefManagerImpl extends RefManager {
|
||||
if (module == null) {
|
||||
return null;
|
||||
}
|
||||
if (myModules == null) {
|
||||
myModules = new THashMap<Module, RefModule>();
|
||||
myLock.readLock().lock();
|
||||
try {
|
||||
if (myModules != null) {
|
||||
RefModule refModule = myModules.get(module);
|
||||
if (refModule != null) {
|
||||
return refModule;
|
||||
}
|
||||
}
|
||||
}
|
||||
RefModule refModule = myModules.get(module);
|
||||
if (refModule == null) {
|
||||
refModule = new RefModuleImpl(module, this);
|
||||
finally {
|
||||
myLock.readLock().unlock();
|
||||
}
|
||||
|
||||
myLock.writeLock().lock();
|
||||
try {
|
||||
if (myModules == null) {
|
||||
myModules = new THashMap<Module, RefModule>();
|
||||
}
|
||||
final RefModule refModule = new RefModuleImpl(module, this);
|
||||
myModules.put(module, refModule);
|
||||
return refModule;
|
||||
}
|
||||
finally {
|
||||
myLock.writeLock().unlock();
|
||||
}
|
||||
return refModule;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "MethodNamesDifferingOnlyByCase"})
|
||||
public class Main {
|
||||
@@ -122,7 +123,7 @@ public class Main {
|
||||
|
||||
private static void installPatch() throws IOException {
|
||||
String platform = System.getProperty(PLATFORM_PREFIX_PROPERTY, "idea");
|
||||
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
|
||||
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase(Locale.US);
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
|
||||
// always delete previous patch copy
|
||||
@@ -148,6 +149,7 @@ public class Main {
|
||||
args.add(Restarter.createTempExecutable(launcher).getPath());
|
||||
}
|
||||
|
||||
//noinspection SpellCheckingInspection
|
||||
Collections.addAll(args,
|
||||
System.getProperty("java.home") + "/bin/java",
|
||||
"-Xmx500m",
|
||||
|
||||
@@ -15,14 +15,18 @@
|
||||
*/
|
||||
package com.intellij.openapi.project;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public abstract class DumbModeTask {
|
||||
public abstract class DumbModeTask implements Disposable {
|
||||
|
||||
public abstract void performInDumbMode(@NotNull ProgressIndicator indicator);
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,7 +176,9 @@ public abstract class DumbService {
|
||||
return new ArrayList<T>(collection);
|
||||
}
|
||||
|
||||
public abstract void queueTask(DumbModeTask task);
|
||||
public abstract void queueTask(@NotNull DumbModeTask task);
|
||||
|
||||
public abstract void cancelTask(@NotNull DumbModeTask task);
|
||||
|
||||
public abstract JComponent wrapGently(@NotNull JComponent dumbUnawareContent, @NotNull Disposable parentDisposable);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.project.DumbModeTask;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -50,10 +51,14 @@ public class MockDumbService extends DumbService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueTask(DumbModeTask task) {
|
||||
public void queueTask(@NotNull DumbModeTask task) {
|
||||
task.performInDumbMode(new EmptyProgressIndicator());
|
||||
Disposer.dispose(task);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelTask(@NotNull DumbModeTask task) { }
|
||||
|
||||
@Override
|
||||
public JComponent wrapGently(@NotNull JComponent dumbUnawareContent, @NotNull Disposable parentDisposable) {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,17 +27,14 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class TooManyUsagesStatus {
|
||||
private static final Key<TooManyUsagesStatus> KEY = Key.create("TooManyUsagesStatus");
|
||||
private static final Null NULL = new Null();
|
||||
private static final NullStatus NULL_STATUS = new NullStatus();
|
||||
|
||||
@NotNull
|
||||
public static TooManyUsagesStatus getFrom(@Nullable ProgressIndicator indicator) {
|
||||
TooManyUsagesStatus data = null;
|
||||
if (indicator instanceof UserDataHolder) {
|
||||
data = ((UserDataHolder)indicator).getUserData(KEY);
|
||||
}
|
||||
if (data == null) data = NULL;
|
||||
return data;
|
||||
TooManyUsagesStatus data = indicator instanceof UserDataHolder ? ((UserDataHolder)indicator).getUserData(KEY) : null;
|
||||
return data == null ? NULL_STATUS : data;
|
||||
}
|
||||
|
||||
public static TooManyUsagesStatus createFor(@NotNull ProgressIndicator indicator) {
|
||||
TooManyUsagesStatus data = null;
|
||||
if (indicator instanceof UserDataHolder) {
|
||||
@@ -76,7 +73,7 @@ public class TooManyUsagesStatus {
|
||||
}
|
||||
}
|
||||
|
||||
private static class Null extends TooManyUsagesStatus {
|
||||
private static class NullStatus extends TooManyUsagesStatus {
|
||||
@Override
|
||||
public boolean switchTooManyUsagesStatus() {
|
||||
return false;
|
||||
|
||||
@@ -315,7 +315,8 @@ public class BlockSupportImpl extends BlockSupport {
|
||||
PsiTreeChangeEventImpl event = new PsiTreeChangeEventImpl(manager);
|
||||
event.setParent(scope);
|
||||
event.setFile(scope.getContainingFile());
|
||||
event.setOffset(scope.getTextRange().getStartOffset());
|
||||
TextRange range = scope.getTextRange();
|
||||
event.setOffset(range == null ? 0 : range.getStartOffset());
|
||||
event.setOldLength(scope.getTextLength());
|
||||
// the "generic" event is being sent on every PSI change. It does not carry any specific info except the fact that "something has changed"
|
||||
event.setGenericChange(isGenericChange);
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ public class ContentRootData extends AbstractExternalEntityData {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class SourceRootComparator implements Comparator<SourceRoot> {
|
||||
private static final class SourceRootComparator implements Comparator<SourceRoot>, Serializable {
|
||||
private static final SourceRootComparator INSTANCE = new SourceRootComparator();
|
||||
|
||||
@Override
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 945 B |
+3
-1
@@ -127,7 +127,9 @@ public class PassExecutorService implements Disposable {
|
||||
TextEditorHighlightingPass textEditorHighlightingPass = convertToTextHighlightingPass(pass, document, nextPassId, prevId);
|
||||
document = textEditorHighlightingPass.getDocument();
|
||||
documentBoundPasses.putValue(fileEditor, textEditorHighlightingPass);
|
||||
documentToEditors.putValue(document, fileEditor);
|
||||
if (document != null) {
|
||||
documentToEditors.putValue(document, fileEditor);
|
||||
}
|
||||
prevId = textEditorHighlightingPass.getId();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,17 +159,24 @@ public class FoldingUpdate {
|
||||
final List<EditorWindow> injectedEditors = new ArrayList<EditorWindow>();
|
||||
final List<PsiFile> injectedFiles = new ArrayList<PsiFile>();
|
||||
final List<FoldingMap> maps = new ArrayList<FoldingMap>();
|
||||
for (DocumentWindow injectedDocument : injectedDocuments) {
|
||||
PsiFile injectedFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedDocument);
|
||||
if (injectedFile == null || !injectedFile.isValid() || !injectedDocument.isValid()) continue;
|
||||
Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile);
|
||||
if (!(injectedEditor instanceof EditorWindow)) continue;
|
||||
for (final DocumentWindow injectedDocument : injectedDocuments) {
|
||||
if (!injectedDocument.isValid()) {
|
||||
continue;
|
||||
}
|
||||
InjectedLanguageUtil.enumerate(injectedDocument, file, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
|
||||
@Override
|
||||
public void visit(@NotNull PsiFile injectedFile, @NotNull List<PsiLanguageInjectionHost.Shred> places) {
|
||||
if (!injectedFile.isValid()) return;
|
||||
Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile);
|
||||
if (!(injectedEditor instanceof EditorWindow)) return;
|
||||
|
||||
injectedEditors.add((EditorWindow)injectedEditor);
|
||||
injectedFiles.add(injectedFile);
|
||||
final FoldingMap map = new FoldingMap();
|
||||
maps.add(map);
|
||||
getFoldingsFor(injectedFile, injectedDocument, map, false);
|
||||
injectedEditors.add((EditorWindow)injectedEditor);
|
||||
injectedFiles.add(injectedFile);
|
||||
final FoldingMap map = new FoldingMap();
|
||||
maps.add(map);
|
||||
getFoldingsFor(injectedFile, injectedDocument, map, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return new Runnable() {
|
||||
|
||||
+8
-3
@@ -26,12 +26,14 @@ import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.ListPopup;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.ui.ClickListener;
|
||||
import com.intellij.ui.EditorNotificationPanel;
|
||||
import com.intellij.ui.LightColors;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -73,7 +75,7 @@ public class FileLevelIntentionComponent extends EditorNotificationPanel {
|
||||
}
|
||||
|
||||
myLabel.setText(description);
|
||||
myLabel.setIcon(SeverityRegistrar.getSeverityRegistrar(project).compare(severity, HighlightSeverity.ERROR) >= 0 ? AllIcons.Actions.QuickfixBulb : AllIcons.Actions.IntentionBulb);
|
||||
myGearLabel.setIcon(AllIcons.General.Gear);
|
||||
|
||||
new ClickListener() {
|
||||
@Override
|
||||
@@ -86,10 +88,13 @@ public class FileLevelIntentionComponent extends EditorNotificationPanel {
|
||||
step = step.getSubStep(actionWithTextCaching, null);
|
||||
}
|
||||
}
|
||||
JBPopupFactory.getInstance().createListPopup(step).showUnderneathOf(myLabel);
|
||||
ListPopup popup = JBPopupFactory.getInstance().createListPopup(step);
|
||||
Dimension dimension = popup.getContent().getPreferredSize();
|
||||
Point at = new Point(-dimension.width + myGearLabel.getWidth(), FileLevelIntentionComponent.this.getHeight());
|
||||
popup.show(new RelativePoint(e.getComponent(), at));
|
||||
return true;
|
||||
}
|
||||
}.installOn(myLabel);
|
||||
}.installOn(myGearLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -143,6 +143,7 @@ public abstract class AbstractFindUsagesDialog extends DialogWrapper {
|
||||
return panel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final FindUsagesOptions calcFindUsagesOptions() {
|
||||
calcFindUsagesOptions(myFindUsagesOptions);
|
||||
return myFindUsagesOptions;
|
||||
|
||||
@@ -47,6 +47,7 @@ import java.util.Collections;
|
||||
*/
|
||||
public abstract class FindUsagesHandler {
|
||||
// return this handler if you want to cancel the search
|
||||
@NotNull
|
||||
public static final FindUsagesHandler NULL_HANDLER = new FindUsagesHandler(PsiUtilCore.NULL_PSI_ELEMENT){};
|
||||
|
||||
private final PsiElement myPsiElement;
|
||||
@@ -204,6 +205,7 @@ public abstract class FindUsagesHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<PsiReference> findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) {
|
||||
return ReferencesSearch.search(target, searchScope, false).findAll();
|
||||
}
|
||||
|
||||
+2
-1
@@ -116,6 +116,7 @@ public class PsiElement2UsageTargetAdapter
|
||||
return getElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getPresentableText();
|
||||
}
|
||||
@@ -209,7 +210,7 @@ public class PsiElement2UsageTargetAdapter
|
||||
@Override
|
||||
public String getLongDescriptiveName() {
|
||||
SearchScope searchScope = myOptions.searchScope;
|
||||
String scopeString = searchScope == null ? null : searchScope.getDisplayName();
|
||||
String scopeString = searchScope.getDisplayName();
|
||||
PsiElement psiElement = getElement();
|
||||
|
||||
return psiElement == null ? UsageViewBundle.message("node.invalid") :
|
||||
|
||||
+10
-3
@@ -164,14 +164,21 @@ public class PushedFilePropertiesUpdater {
|
||||
});
|
||||
}
|
||||
|
||||
private void queueTask(Runnable task) {
|
||||
myTasks.offer(task);
|
||||
DumbService.getInstance(myProject).queueTask(new DumbModeTask() {
|
||||
private void queueTask(Runnable action) {
|
||||
myTasks.offer(action);
|
||||
final DumbModeTask task = new DumbModeTask() {
|
||||
@Override
|
||||
public void performInDumbMode(@NotNull ProgressIndicator indicator) {
|
||||
performPushTasks();
|
||||
}
|
||||
};
|
||||
myProject.getMessageBus().connect(task).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
|
||||
@Override
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
DumbService.getInstance(myProject).cancelTask(task);
|
||||
}
|
||||
});
|
||||
DumbService.getInstance(myProject).queueTask(task);
|
||||
}
|
||||
|
||||
private void performPushTasks() {
|
||||
|
||||
+1
-11
@@ -43,7 +43,6 @@ import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Segment;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
@@ -141,18 +140,9 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme
|
||||
if (indicator != null && indicator.isCanceled()) return false;
|
||||
if (documentManager.isUncommited(hostDocument) || !hostPsiFile.isValid()) return false; // will be committed later
|
||||
|
||||
Segment[] ranges = documentWindow.getHostRanges();
|
||||
Segment rangeMarker = ranges.length > 0 ? ranges[0] : null;
|
||||
PsiElement element = rangeMarker == null ? null : hostPsiFile.findElementAt(rangeMarker.getStartOffset());
|
||||
if (element == null) {
|
||||
synchronized (PsiLock.LOCK) {
|
||||
injected.remove(documentWindow);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
final DocumentWindow[] stillInjectedDocument = {null};
|
||||
// it is here where the reparse happens and old file contents replaced
|
||||
InjectedLanguageUtil.enumerate(element, hostPsiFile, true, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
|
||||
InjectedLanguageUtil.enumerate(documentWindow, hostPsiFile, new PsiLanguageInjectionHost.InjectedPsiVisitor() {
|
||||
@Override
|
||||
public void visit(@NotNull PsiFile injectedPsi, @NotNull List<PsiLanguageInjectionHost.Shred> places) {
|
||||
stillInjectedDocument[0] = (DocumentWindow)injectedPsi.getViewProvider().getDocument();
|
||||
|
||||
+11
@@ -92,6 +92,17 @@ public class InjectedLanguageUtil {
|
||||
return ((DocumentWindowImpl)myFileViewProvider.getDocument()).getShreds();
|
||||
}
|
||||
|
||||
public static void enumerate(@NotNull DocumentWindow documentWindow,
|
||||
@NotNull PsiFile hostPsiFile,
|
||||
@NotNull PsiLanguageInjectionHost.InjectedPsiVisitor visitor) {
|
||||
Segment[] ranges = documentWindow.getHostRanges();
|
||||
Segment rangeMarker = ranges.length > 0 ? ranges[0] : null;
|
||||
PsiElement element = rangeMarker == null ? null : hostPsiFile.findElementAt(rangeMarker.getStartOffset());
|
||||
if (element != null) {
|
||||
enumerate(element, hostPsiFile, true, visitor);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean enumerate(@NotNull PsiElement host, @NotNull PsiLanguageInjectionHost.InjectedPsiVisitor visitor) {
|
||||
PsiFile containingFile = host.getContainingFile();
|
||||
return enumerate(host, containingFile, true, visitor);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.util.indexing;
|
||||
|
||||
import com.intellij.ProjectTopics;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.caches.FileContent;
|
||||
import com.intellij.ide.startup.impl.StartupManagerImpl;
|
||||
@@ -24,8 +25,11 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.CacheUpdateRunner;
|
||||
import com.intellij.openapi.project.DumbModeTask;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.CollectingContentIterator;
|
||||
import com.intellij.openapi.roots.ModuleRootAdapter;
|
||||
import com.intellij.openapi.roots.ModuleRootEvent;
|
||||
import com.intellij.openapi.roots.impl.PushedFilePropertiesUpdater;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -48,6 +52,12 @@ public class UnindexedFilesUpdater extends DumbModeTask {
|
||||
public UnindexedFilesUpdater(final Project project, boolean onStartup) {
|
||||
myProject = project;
|
||||
myOnStartup = onStartup;
|
||||
project.getMessageBus().connect(this).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootAdapter() {
|
||||
@Override
|
||||
public void rootsChanged(ModuleRootEvent event) {
|
||||
DumbService.getInstance(project).cancelTask(UnindexedFilesUpdater.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateUnindexedFiles(ProgressIndicator indicator) {
|
||||
|
||||
@@ -87,6 +87,9 @@ public class FixedSizeButton extends JButton {
|
||||
public Dimension getPreferredSize() {
|
||||
if (myComponent != null) {
|
||||
int size = myComponent.getPreferredSize().height;
|
||||
if (myComponent instanceof ComboBox && (UIUtil.isUnderIntelliJLaF() || UIUtil.isUnderDarcula())) {
|
||||
size -= 2; // decrement to match JTextField's preferred height
|
||||
}
|
||||
return new Dimension(size, size);
|
||||
}
|
||||
else if (mySize != -1) {
|
||||
@@ -108,5 +111,18 @@ public class FixedSizeButton extends JButton {
|
||||
public void setSize(int size) {
|
||||
mySize = size;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(int x, int y, int width, int height) {
|
||||
int size = Math.min(width, height);
|
||||
super.setBounds(x, y, size, size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBounds(Rectangle r) {
|
||||
int size = Math.min(r.width, r.height);
|
||||
r.width = size;
|
||||
r.height = size;
|
||||
super.setBounds(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,11 +36,12 @@ import java.awt.*;
|
||||
*/
|
||||
public class EditorNotificationPanel extends JPanel {
|
||||
protected final JLabel myLabel = new JLabel();
|
||||
protected final JLabel myGearLabel = new JLabel();
|
||||
protected final JPanel myLinksPanel;
|
||||
|
||||
public EditorNotificationPanel() {
|
||||
super(new BorderLayout());
|
||||
setBorder(BorderFactory.createEmptyBorder(1, 15, 1, 15));
|
||||
setBorder(BorderFactory.createEmptyBorder(1, 10, 1, 10));
|
||||
|
||||
setPreferredSize(new Dimension(-1, 24));
|
||||
|
||||
@@ -48,7 +49,13 @@ public class EditorNotificationPanel extends JPanel {
|
||||
|
||||
myLinksPanel = new JPanel(new FlowLayout());
|
||||
myLinksPanel.setBackground(getBackground());
|
||||
add(myLinksPanel, BorderLayout.EAST);
|
||||
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
panel.setBackground(getBackground());
|
||||
myGearLabel.setBorder(IdeBorderFactory.createEmptyBorder(0, 3, 0, 0));
|
||||
panel.add(myLinksPanel, BorderLayout.WEST);
|
||||
panel.add(myGearLabel, BorderLayout.EAST);
|
||||
add(panel, BorderLayout.EAST);
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
|
||||
+57
-38
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -74,9 +74,11 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
g.fillRect(0, 0, size.width, size.height);
|
||||
}
|
||||
|
||||
if (b.isSelected() && b.getSelectedIcon() != null) {
|
||||
final boolean selected = b.isSelected();
|
||||
final boolean enabled = b.isEnabled();
|
||||
if (selected && b.getSelectedIcon() != null) {
|
||||
b.getSelectedIcon().paintIcon(b, g, iconRect.x + 4, iconRect.y + 2);
|
||||
} else if (!b.isSelected() && b.getIcon() != null) {
|
||||
} else if (!selected && b.getIcon() != null) {
|
||||
b.getIcon().paintIcon(b, g, iconRect.x + 4, iconRect.y + 2);
|
||||
} else {
|
||||
final int x = iconRect.x + 3;
|
||||
@@ -98,15 +100,18 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
final boolean armed = b.getModel().isArmed();
|
||||
|
||||
if (c.hasFocus()) {
|
||||
g.setPaint(UIUtil.getGradientPaint(w/2, 1, getFocusedBackgroundColor1(armed), w/2, h, getFocusedBackgroundColor2(armed)));
|
||||
g.fillRoundRect(0, 0, w - 2, h - 2, 4, 4);
|
||||
g.setPaint(UIUtil.getGradientPaint(w/2, 1, getFocusedBackgroundColor1(armed, selected), w/2, h, getFocusedBackgroundColor2(armed, selected)));
|
||||
g.fillRoundRect(0, 0, w, h, 4, 4);
|
||||
|
||||
DarculaUIUtil.paintFocusRing(g, 1, 1, w - 2, h - 2);
|
||||
} else {
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, getBackgroundColor1(), w / 2, h, getBackgroundColor2()));
|
||||
g.fillRoundRect(0, 0, w, h - 1 , 4, 4);
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, getBackgroundColor1(enabled, selected), w / 2, h, getBackgroundColor2(enabled,
|
||||
selected)));
|
||||
g.fillRoundRect(0, 0, w, h , 4, 4);
|
||||
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, getBorderColor1(b.isEnabled()), w / 2, h, getBorderColor2(b.isEnabled())));
|
||||
final Color borderColor1 = getBorderColor1(enabled, selected);
|
||||
final Color borderColor2 = getBorderColor2(enabled, selected);
|
||||
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, borderColor1, w / 2, h, borderColor2));
|
||||
g.drawRoundRect(0, (UIUtil.isUnderDarcula() ? 1 : 0), w, h - 1, 4, 4);
|
||||
|
||||
g.setPaint(getInactiveFillColor());
|
||||
@@ -114,14 +119,7 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
}
|
||||
|
||||
if (b.getModel().isSelected()) {
|
||||
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
g.setStroke(new BasicStroke(1 *2.0f, BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
|
||||
g.setPaint(getShadowColor(b.isEnabled()));
|
||||
g.drawLine(4, 7, 7, 11);
|
||||
g.drawLine(7, 11, w, 2);
|
||||
g.setPaint(getCheckSignColor(b.isEnabled()));
|
||||
g.drawLine(4, 5, 7, 9);
|
||||
g.drawLine(7, 9, w, 0);
|
||||
paintCheckSign(g, enabled, w, h);
|
||||
}
|
||||
g.translate(-x, -y);
|
||||
config.restore();
|
||||
@@ -142,46 +140,57 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
}
|
||||
}
|
||||
|
||||
protected void paintCheckSign(Graphics2D g, boolean enabled, int w, int h) {
|
||||
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
g.setStroke(new BasicStroke(1 *2.0f, BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
|
||||
g.setPaint(getShadowColor(enabled, true));
|
||||
g.drawLine(4, 7, 7, 11);
|
||||
g.drawLine(7, 11, w, 2);
|
||||
g.setPaint(getCheckSignColor(enabled, true));
|
||||
g.drawLine(4, 5, 7, 9);
|
||||
g.drawLine(7, 9, w, 0);
|
||||
}
|
||||
|
||||
protected Color getInactiveFillColor() {
|
||||
return getColor("inactiveFillColor", Gray._40.withAlpha(180));
|
||||
}
|
||||
|
||||
protected Color getBorderColor1(boolean enabled) {
|
||||
return enabled ? getColor("borderColor1", Gray._120.withAlpha(0x5a))
|
||||
: getColor("disabledBorderColor1", Gray._120.withAlpha(90));
|
||||
protected Color getBorderColor1(boolean enabled, boolean selected) {
|
||||
return enabled ? getColor("borderColor1", Gray._120.withAlpha(0x5a), selected)
|
||||
: getColor("disabledBorderColor1", Gray._120.withAlpha(90), selected);
|
||||
}
|
||||
|
||||
protected Color getBorderColor2(boolean enabled) {
|
||||
return enabled ? getColor("borderColor2", Gray._105.withAlpha(90))
|
||||
: getColor("disabledBorderColor2", Gray._105.withAlpha(90));
|
||||
protected Color getBorderColor2(boolean enabled, boolean selected) {
|
||||
return enabled ? getColor("borderColor2", Gray._105.withAlpha(90), selected)
|
||||
: getColor("disabledBorderColor2", Gray._105.withAlpha(90), selected);
|
||||
}
|
||||
|
||||
protected Color getBackgroundColor1() {
|
||||
return getColor("backgroundColor1", Gray._110);
|
||||
protected Color getBackgroundColor1(boolean enabled, boolean selected) {
|
||||
return getColor("backgroundColor1", Gray._110, selected);
|
||||
}
|
||||
|
||||
protected Color getBackgroundColor2() {
|
||||
return getColor("backgroundColor2", Gray._95);
|
||||
protected Color getBackgroundColor2(boolean enabled, boolean selected) {
|
||||
return getColor("backgroundColor2", Gray._95, selected);
|
||||
}
|
||||
|
||||
protected Color getCheckSignColor(boolean enabled) {
|
||||
return enabled ? getColor("checkSignColor", Gray._170)
|
||||
: getColor("checkSignColorDisabled", Gray._120);
|
||||
protected Color getCheckSignColor(boolean enabled, boolean selected) {
|
||||
return enabled ? getColor("checkSignColor", Gray._170, selected)
|
||||
: getColor("checkSignColorDisabled", Gray._120, selected);
|
||||
}
|
||||
|
||||
protected Color getShadowColor(boolean enabled) {
|
||||
return enabled ? getColor("shadowColor", Gray._30)
|
||||
: getColor("shadowColorDisabled", Gray._60);
|
||||
protected Color getShadowColor(boolean enabled, boolean selected) {
|
||||
return enabled ? getColor("shadowColor", Gray._30, selected)
|
||||
: getColor("shadowColorDisabled", Gray._60, selected);
|
||||
}
|
||||
|
||||
protected Color getFocusedBackgroundColor1(boolean armed) {
|
||||
return armed ? getColor("focusedArmed.backgroundColor1", Gray._100)
|
||||
: getColor("focused.backgroundColor1", Gray._120);
|
||||
protected Color getFocusedBackgroundColor1(boolean armed, boolean selected) {
|
||||
return armed ? getColor("focusedArmed.backgroundColor1", Gray._100, selected)
|
||||
: getColor("focused.backgroundColor1", Gray._120, selected);
|
||||
}
|
||||
|
||||
protected Color getFocusedBackgroundColor2(boolean armed) {
|
||||
return armed ? getColor("focusedArmed.backgroundColor2", Gray._55)
|
||||
: getColor("focused.backgroundColor2", Gray._75);
|
||||
protected Color getFocusedBackgroundColor2(boolean armed, boolean selected) {
|
||||
return armed ? getColor("focusedArmed.backgroundColor2", Gray._55, selected)
|
||||
: getColor("focused.backgroundColor2", Gray._75, selected);
|
||||
}
|
||||
|
||||
protected static Color getColor(String shortPropertyName, Color defaultValue) {
|
||||
@@ -189,6 +198,16 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
|
||||
return color == null ? defaultValue : color;
|
||||
}
|
||||
|
||||
protected static Color getColor(String shortPropertyName, Color defaultValue, boolean selected) {
|
||||
if (selected) {
|
||||
final Color color = getColor(shortPropertyName + ".selected", null);
|
||||
if (color != null) {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
return getColor(shortPropertyName, defaultValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getDefaultIcon() {
|
||||
return new IconUIResource(EmptyIcon.create(20));
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ide.ui.laf.intellij;
|
||||
|
||||
import com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxUI;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.plaf.ComponentUI;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class IntelliJCheckBoxUI extends DarculaCheckBoxUI {
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass", "UnusedDeclaration"})
|
||||
public static ComponentUI createUI(JComponent c) {
|
||||
return new IntelliJCheckBoxUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void paintCheckSign(Graphics2D g, boolean enabled, int w, int h) {
|
||||
g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
|
||||
g.setStroke(new BasicStroke(1 *2.0f, BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
|
||||
|
||||
g.setPaint(getShadowColor(enabled, true));
|
||||
g.drawLine(5, 9, 7, 11);
|
||||
g.drawLine(7, 11, w-3, 5);
|
||||
g.setPaint(getCheckSignColor(enabled, true));
|
||||
g.drawLine(5, 7, 7, 9);
|
||||
g.drawLine(7, 9, w-3, 3);
|
||||
}
|
||||
}
|
||||
@@ -88,23 +88,33 @@ ProgressBar.foreground=808080
|
||||
FormattedTextField.background=ffffff
|
||||
|
||||
|
||||
CheckBoxUI=com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxUI
|
||||
CheckBoxUI=com.intellij.ide.ui.laf.intellij.IntelliJCheckBoxUI
|
||||
CheckBox.border=com.intellij.ide.ui.laf.darcula.ui.DarculaCheckBoxBorder
|
||||
CheckBox.darcula.inactiveFillColor=00000000
|
||||
CheckBox.darcula.borderColor1=444444
|
||||
CheckBox.darcula.borderColor1.selected=2C90FB
|
||||
CheckBox.darcula.borderColor2=444444
|
||||
CheckBox.darcula.borderColor2.selected=2C90FB
|
||||
CheckBox.darcula.disabledBorderColor1=969696
|
||||
CheckBox.darcula.disabledBorderColor2=969696
|
||||
CheckBox.darcula.backgroundColor1=ffffff
|
||||
CheckBox.darcula.backgroundColor1.selected=3B98FB
|
||||
CheckBox.darcula.backgroundColor2=ffffff
|
||||
CheckBox.darcula.backgroundColor2.selected=3B98FB
|
||||
CheckBox.darcula.checkSignColor=444444
|
||||
CheckBox.darcula.checkSignColor.selected=ffffff
|
||||
CheckBox.darcula.checkSignColorDisabled=999999
|
||||
CheckBox.darcula.shadowColor=55555530
|
||||
CheckBox.darcula.shadowColor.selected=1D7BDD
|
||||
CheckBox.darcula.shadowColorDisabled=eeeeee
|
||||
CheckBox.darcula.focusedArmed.backgroundColor1=ffffff
|
||||
CheckBox.darcula.focusedArmed.backgroundColor1.selected=3B98FB
|
||||
CheckBox.darcula.focusedArmed.backgroundColor2=ffffff
|
||||
CheckBox.darcula.focusedArmed.backgroundColor2.selected=3B98FB
|
||||
CheckBox.darcula.focused.backgroundColor1=eeeeee
|
||||
CheckBox.darcula.focused.backgroundColor1.selected=3B98FB
|
||||
CheckBox.darcula.focused.backgroundColor2=eeeeee
|
||||
CheckBox.darcula.focused.backgroundColor2.selected=3B98FB
|
||||
|
||||
ComboBoxUI=com.intellij.ide.ui.laf.darcula.ui.DarculaComboBoxUI
|
||||
ComboBox.disabledBackground=e8e8e8
|
||||
|
||||
@@ -218,7 +218,13 @@ public class IdeaApplication {
|
||||
|
||||
@Nullable
|
||||
private SplashScreen getSplashScreen() {
|
||||
return SplashScreen.getSplashScreen();
|
||||
try {
|
||||
return SplashScreen.getSplashScreen();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
LOG.warn(t);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1049,6 +1049,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
|
||||
@Override
|
||||
public void assertReadAccessAllowed() {
|
||||
if (myHeadlessMode) return;
|
||||
if (!isReadAccessAllowed()) {
|
||||
LOG.error(
|
||||
"Read access is allowed from event dispatch thread or inside read-action only" +
|
||||
|
||||
+12
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,10 +55,12 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
|
||||
if (myDumbModeAction == DumbModeAction.CANCEL) {
|
||||
task.getProject().getMessageBus().connect(this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
|
||||
|
||||
@Override
|
||||
public void enteredDumbMode() {
|
||||
cancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exitDumbMode() {
|
||||
}
|
||||
});
|
||||
@@ -69,6 +71,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
|
||||
super(info.isCancellable(), true, project, info.getCancelText());
|
||||
if (project != null) {
|
||||
final ProjectManagerAdapter myListener = new ProjectManagerAdapter() {
|
||||
@Override
|
||||
public void projectClosing(Project closingProject) {
|
||||
if (isRunning()) {
|
||||
cancel();
|
||||
@@ -107,23 +110,28 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
|
||||
@Nls final String cancelButtonText,
|
||||
@Nls final String backgroundStopTooltip, final boolean cancellable) {
|
||||
this(project, new TaskInfo() {
|
||||
@Override
|
||||
public String getProcessId() {
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getTitle() {
|
||||
return progressTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelText() {
|
||||
return cancelButtonText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCancelTooltipText() {
|
||||
return backgroundStopTooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancellable() {
|
||||
return cancellable;
|
||||
}
|
||||
@@ -134,6 +142,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
|
||||
return myDumbModeAction;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showDialog() {
|
||||
if (myDisposed) return;
|
||||
|
||||
@@ -144,6 +153,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
|
||||
super.showDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void background() {
|
||||
if (myDisposed) return;
|
||||
|
||||
@@ -158,6 +168,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
myDisposed = true;
|
||||
|
||||
@@ -17,7 +17,6 @@ package com.intellij.openapi.project;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.caches.CacheUpdater;
|
||||
import com.intellij.ide.util.DelegatingProgressIndicator;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -28,6 +27,7 @@ import com.intellij.openapi.progress.*;
|
||||
import com.intellij.openapi.progress.util.ProgressIndicatorBase;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.ShutDownTracker;
|
||||
import com.intellij.openapi.wm.AppIconScheme;
|
||||
@@ -37,9 +37,9 @@ import com.intellij.openapi.wm.ex.ProgressIndicatorEx;
|
||||
import com.intellij.openapi.wm.ex.StatusBarEx;
|
||||
import com.intellij.ui.AppIcon;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.Queue;
|
||||
import com.intellij.util.io.storage.HeavyProcessLatch;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -48,28 +48,55 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public class DumbServiceImpl extends DumbService {
|
||||
public class DumbServiceImpl extends DumbService implements Disposable {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.project.DumbServiceImpl");
|
||||
private volatile boolean myDumb = false;
|
||||
private final DumbModeListener myPublisher;
|
||||
private final Queue<DumbModeTask> myUpdatesQueue = new Queue<DumbModeTask>(5);
|
||||
|
||||
/**
|
||||
* Per-task progress indicators. Modified from EDT only.
|
||||
* The task is removed from this map after it's finished or when the project is disposed.
|
||||
*/
|
||||
private final Map<DumbModeTask, ProgressIndicatorEx> myProgresses = ContainerUtil.newConcurrentMap();
|
||||
|
||||
private final Queue<Runnable> myRunWhenSmartQueue = new Queue<Runnable>(5);
|
||||
private final Project myProject;
|
||||
|
||||
public DumbServiceImpl(Project project) {
|
||||
myProject = project;
|
||||
myPublisher = project.getMessageBus().syncPublisher(DUMB_MODE);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"MethodOverridesStaticMethodOfSuperclass"})
|
||||
public static DumbServiceImpl getInstance(@NotNull Project project) {
|
||||
return (DumbServiceImpl)DumbService.getInstance(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueTask(final DumbModeTask task) {
|
||||
public void queueTask(@NotNull final DumbModeTask task) {
|
||||
scheduleCacheUpdate(task, true);
|
||||
}
|
||||
|
||||
public DumbServiceImpl(Project project, MessageBus bus) {
|
||||
myProject = project;
|
||||
myPublisher = bus.syncPublisher(DUMB_MODE);
|
||||
@Override
|
||||
public void cancelTask(@NotNull DumbModeTask task) {
|
||||
ProgressIndicatorEx indicator = myProgresses.get(task);
|
||||
if (indicator != null) {
|
||||
indicator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
myUpdatesQueue.clear();
|
||||
myRunWhenSmartQueue.clear();
|
||||
for (DumbModeTask task : new ArrayList<DumbModeTask>(myProgresses.keySet())) {
|
||||
cancelTask(task);
|
||||
Disposer.dispose(task);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,6 +161,7 @@ public class DumbServiceImpl extends DumbService {
|
||||
if (indicator != null) {
|
||||
indicator.popState();
|
||||
}
|
||||
Disposer.dispose(task);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -145,6 +173,14 @@ public class DumbServiceImpl extends DumbService {
|
||||
return;
|
||||
}
|
||||
myUpdatesQueue.addLast(task);
|
||||
myProgresses.put(task, new ProgressIndicatorBase());
|
||||
Disposer.register(task, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
application.assertIsDispatchThread();
|
||||
myProgresses.remove(task);
|
||||
}
|
||||
});
|
||||
// ok to test and set the flag like this, because the change is always done from dispatch thread
|
||||
if (!myDumb) {
|
||||
// always change dumb status inside write action.
|
||||
@@ -294,14 +330,12 @@ public class DumbServiceImpl extends DumbService {
|
||||
((ProgressIndicatorEx)indicator).addStateDelegate(new AppIconProgress());
|
||||
}
|
||||
|
||||
final ProgressIndicator proxy = new DelegatingProgressIndicator(indicator);
|
||||
|
||||
final ShutDownTracker shutdownTracker = ShutDownTracker.getInstance();
|
||||
final Thread self = Thread.currentThread();
|
||||
try {
|
||||
HeavyProcessLatch.INSTANCE.processStarted();
|
||||
shutdownTracker.registerStopperThread(self);
|
||||
runTasks(proxy);
|
||||
runTasks(indicator);
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
LOG.error(e);
|
||||
@@ -313,16 +347,26 @@ public class DumbServiceImpl extends DumbService {
|
||||
}
|
||||
}
|
||||
|
||||
private void runTasks(ProgressIndicator indicator) {
|
||||
private void runTasks(ProgressIndicator visibleIndicator) {
|
||||
DumbModeTask prevTask = null;
|
||||
while (true) {
|
||||
DumbModeTask task = getNextTask();
|
||||
DumbModeTask task = getNextTask(prevTask);
|
||||
if (task == null) break;
|
||||
|
||||
try {
|
||||
if (ApplicationManager.getApplication().isInternal()) LOG.info("Running dumb mode task: " + task);
|
||||
|
||||
final ProgressIndicatorEx indicator = myProgresses.get(task);
|
||||
assert indicator != null;
|
||||
indicator.checkCanceled();
|
||||
|
||||
if (visibleIndicator instanceof ProgressIndicatorEx) {
|
||||
indicator.addStateDelegate((ProgressIndicatorEx)visibleIndicator);
|
||||
}
|
||||
|
||||
indicator.setIndeterminate(true);
|
||||
indicator.setText(IdeBundle.message("progress.indexing.scanning"));
|
||||
|
||||
task.performInDumbMode(indicator);
|
||||
}
|
||||
catch (ProcessCanceledException ignored) {
|
||||
@@ -330,6 +374,7 @@ public class DumbServiceImpl extends DumbService {
|
||||
catch (Throwable unexpected) {
|
||||
LOG.error(unexpected);
|
||||
}
|
||||
prevTask = task;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,16 +382,30 @@ public class DumbServiceImpl extends DumbService {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private DumbModeTask getNextTask() {
|
||||
private DumbModeTask getNextTask(@Nullable final DumbModeTask prevTask) {
|
||||
final Ref<DumbModeTask> nextTask = Ref.create();
|
||||
UIUtil.invokeAndWaitIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (myProject.isDisposed()) return;
|
||||
if (myUpdatesQueue.isEmpty()) {
|
||||
updateFinished();
|
||||
} else {
|
||||
nextTask.set(myUpdatesQueue.pullFirst());
|
||||
if (prevTask != null) {
|
||||
Disposer.dispose(prevTask);
|
||||
}
|
||||
|
||||
while (true) {
|
||||
if (myUpdatesQueue.isEmpty()) {
|
||||
updateFinished();
|
||||
return;
|
||||
}
|
||||
|
||||
DumbModeTask queuedTask = myUpdatesQueue.pullFirst();
|
||||
if (myProgresses.get(queuedTask).isCanceled()) {
|
||||
Disposer.dispose(queuedTask);
|
||||
continue;
|
||||
}
|
||||
|
||||
nextTask.set(queuedTask);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -53,6 +53,7 @@ public class HideableDecorator {
|
||||
};
|
||||
myPanel.add(myTitledSeparator, BorderLayout.NORTH);
|
||||
myTitledSeparator.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
updateIcon();
|
||||
myTitledSeparator.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
@@ -66,6 +67,12 @@ public class HideableDecorator {
|
||||
});
|
||||
}
|
||||
|
||||
private void updateIcon() {
|
||||
final Icon icon = myOn ? AllIcons.General.SplitDown : AllIcons.General.SplitRight;
|
||||
myTitledSeparator.getLabel().setIcon(icon);
|
||||
myTitledSeparator.getLabel().setDisabledIcon(IconLoader.getTransparentIcon(icon, 0.5f));
|
||||
}
|
||||
|
||||
public void setContentComponent(@Nullable JComponent content) {
|
||||
if (content == null && myContent != null) {
|
||||
myPanel.remove(myContent);
|
||||
@@ -101,8 +108,7 @@ public class HideableDecorator {
|
||||
|
||||
protected void on() {
|
||||
myOn = true;
|
||||
myTitledSeparator.getLabel().setIcon(AllIcons.General.SplitDown);
|
||||
myTitledSeparator.getLabel().setDisabledIcon(IconLoader.getTransparentIcon(AllIcons.General.SplitDown, 0.5f));
|
||||
updateIcon();
|
||||
myTitledSeparator.getLabel().setIconTextGap(5);
|
||||
if (myContent != null) {
|
||||
myContent.setVisible(true);
|
||||
@@ -114,8 +120,7 @@ public class HideableDecorator {
|
||||
|
||||
protected void off() {
|
||||
myOn = false;
|
||||
myTitledSeparator.getLabel().setIcon(AllIcons.General.SplitRight);
|
||||
myTitledSeparator.getLabel().setDisabledIcon(IconLoader.getTransparentIcon(AllIcons.General.SplitRight, 0.5f));
|
||||
updateIcon();
|
||||
if (myContent != null) {
|
||||
myContent.setVisible(false);
|
||||
myPreviousContentSize = myContent.getSize();
|
||||
|
||||
+5
@@ -15,6 +15,11 @@ public abstract class ServerRuntimeInstance<D extends DeploymentConfiguration> {
|
||||
|
||||
public abstract void computeDeployments(@NotNull ComputeDeploymentsCallback callback);
|
||||
|
||||
@NotNull
|
||||
public String getDeploymentName(@NotNull DeploymentSource source, D configuration) {
|
||||
return getDeploymentName(source);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getDeploymentName(@NotNull DeploymentSource source) {
|
||||
return source.getPresentableName();
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
@Override
|
||||
public void connected(@NotNull ServerRuntimeInstance<D> instance) {
|
||||
DeploymentSource source = task.getSource();
|
||||
String deploymentName = instance.getDeploymentName(source);
|
||||
String deploymentName = instance.getDeploymentName(source, task.getConfiguration());
|
||||
DeploymentImpl deployment;
|
||||
synchronized (myLocalDeployments) {
|
||||
deployment = new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYING, null, null, task);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,10 +15,8 @@
|
||||
*/
|
||||
package com.intellij.psi.formatter;
|
||||
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeInsight.daemon.impl.CodeFoldingPassFactory;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.mock.MockProgressIndicator;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
@@ -42,6 +40,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.testFramework.EditorTestUtil;
|
||||
import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
@@ -199,7 +198,7 @@ public abstract class FormatterTestCase extends LightPlatformTestCase {
|
||||
assertEquals(file.getText(), document.getText());
|
||||
|
||||
if (false && doCheckDocumentUpdate()) {
|
||||
makeFolding(file, editor);
|
||||
EditorTestUtil.runTextEditorHighlightingPass(editor, CodeFoldingPassFactory.class);
|
||||
}
|
||||
try {
|
||||
if (doReformatRangeTest) {
|
||||
@@ -225,13 +224,6 @@ public abstract class FormatterTestCase extends LightPlatformTestCase {
|
||||
assertEquals(textAfter, file.getText());
|
||||
}
|
||||
|
||||
protected static void makeFolding(final PsiFile file, final EditorImpl editor) {
|
||||
final CodeFoldingPassFactory factory = getProject().getComponent(CodeFoldingPassFactory.class);
|
||||
final TextEditorHighlightingPass highlightingPass = factory.createHighlightingPass(file, editor);
|
||||
highlightingPass.collectInformation(new MockProgressIndicator());
|
||||
highlightingPass.doApplyInformationToEditor();
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UNUSED_SYMBOL"})
|
||||
private void checkPsi(final PsiFile file, String textAfter) {
|
||||
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPass;
|
||||
import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.mock.MockProgressIndicator;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
@@ -32,10 +35,13 @@ import com.intellij.openapi.editor.impl.SoftWrapModelImpl;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapDrawingType;
|
||||
import com.intellij.openapi.editor.impl.softwrap.SoftWrapPainter;
|
||||
import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -432,6 +438,20 @@ public class EditorTestUtil {
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
public static <T extends TextEditorHighlightingPassFactory> void runTextEditorHighlightingPass(@NotNull Editor editor, @NotNull Class<T> passFactory) {
|
||||
Project project = editor.getProject();
|
||||
assertNotNull(project);
|
||||
PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
|
||||
PsiFile psiFile = psiDocumentManager.getPsiFile(editor.getDocument());
|
||||
assertNotNull(psiFile);
|
||||
|
||||
T factory = project.getComponent(passFactory);
|
||||
TextEditorHighlightingPass pass = factory.createHighlightingPass(psiFile, editor);
|
||||
assertNotNull(pass);
|
||||
pass.collectInformation(new MockProgressIndicator());
|
||||
pass.applyInformationToEditor();
|
||||
}
|
||||
|
||||
public static class CaretAndSelectionState {
|
||||
public final List<CaretInfo> carets = new ArrayList<CaretInfo>();
|
||||
@Nullable
|
||||
|
||||
@@ -174,7 +174,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
|
||||
final SearchForUsagesRunnable runnable = new SearchForUsagesRunnable(myProject, usageView, presentation, searchFor, searcherFactory, processPresentation, listener);
|
||||
final Factory<ProgressIndicator> progressIndicatorFactory = processPresentation.getProgressIndicatorFactory();
|
||||
|
||||
final ProgressIndicator progressIndicator = progressIndicatorFactory != null ? progressIndicatorFactory.create() : null;
|
||||
final ProgressIndicator progressIndicator = progressIndicatorFactory == null ? null : progressIndicatorFactory.create();
|
||||
|
||||
final AtomicBoolean findUsagesStartedShown = new AtomicBoolean();
|
||||
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
|
||||
|
||||
@@ -836,6 +836,7 @@ public class AllIcons {
|
||||
public static final Icon PinToolWindow = IconLoader.getIcon("/nodes/pinToolWindow.png"); // 13x13
|
||||
public static final Icon Plugin = IconLoader.getIcon("/nodes/plugin.png"); // 16x16
|
||||
public static final Icon PluginJB = IconLoader.getIcon("/nodes/pluginJB.png"); // 16x16
|
||||
public static final Icon PluginLogo = IconLoader.getIcon("/nodes/pluginLogo.png"); // 32x32
|
||||
public static final Icon Pluginnotinstalled = IconLoader.getIcon("/nodes/pluginnotinstalled.png"); // 16x16
|
||||
public static final Icon Pluginobsolete = IconLoader.getIcon("/nodes/pluginobsolete.png"); // 16x16
|
||||
public static final Icon PluginRestart = IconLoader.getIcon("/nodes/pluginRestart.png"); // 16x16
|
||||
|
||||
+25
-13
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 Bas Leijdekkers
|
||||
* Copyright 2006-2014 Bas Leijdekkers
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Query;
|
||||
@@ -79,7 +80,8 @@ public class TypeParameterExtendsFinalClassInspection extends BaseInspection {
|
||||
final PsiElement parent = element.getParent();
|
||||
if (parent instanceof PsiTypeParameter) {
|
||||
final PsiTypeParameter typeParameter = (PsiTypeParameter)parent;
|
||||
replaceTypeParameterAndReferencesWithType(typeParameter);
|
||||
replaceTypeParameterUsagesWithType(typeParameter);
|
||||
typeParameter.delete();
|
||||
}
|
||||
else if (parent instanceof PsiTypeElement) {
|
||||
final PsiTypeElement typeElement = (PsiTypeElement)parent;
|
||||
@@ -91,25 +93,18 @@ public class TypeParameterExtendsFinalClassInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
private static void replaceTypeParameterAndReferencesWithType(PsiTypeParameter typeParameter) {
|
||||
final PsiReferenceList extendsList = typeParameter.getExtendsList();
|
||||
final PsiClassType[] referenceElements = extendsList.getReferencedTypes();
|
||||
if (referenceElements.length < 1) {
|
||||
return;
|
||||
}
|
||||
final PsiClass finalClass = referenceElements[0].resolve();
|
||||
if (finalClass == null) {
|
||||
private static void replaceTypeParameterUsagesWithType(PsiTypeParameter typeParameter) {
|
||||
final PsiClassType[] types = typeParameter.getExtendsList().getReferencedTypes();
|
||||
if (types.length < 1) {
|
||||
return;
|
||||
}
|
||||
final Project project = typeParameter.getProject();
|
||||
final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
|
||||
final PsiJavaCodeReferenceElement classReference = factory.createClassReferenceElement(finalClass);
|
||||
final PsiJavaCodeReferenceElement classReference = JavaPsiFacade.getElementFactory(project).createReferenceElementByType(types[0]);
|
||||
final Query<PsiReference> query = ReferencesSearch.search(typeParameter, typeParameter.getUseScope());
|
||||
for (PsiReference reference : query) {
|
||||
final PsiElement referenceElement = reference.getElement();
|
||||
referenceElement.replace(classReference);
|
||||
}
|
||||
typeParameter.delete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,6 +118,9 @@ public class TypeParameterExtendsFinalClassInspection extends BaseInspection {
|
||||
@Override
|
||||
public void visitTypeParameter(PsiTypeParameter classParameter) {
|
||||
super.visitTypeParameter(classParameter);
|
||||
if (!PsiUtil.isLanguageLevel5OrHigher(classParameter)) {
|
||||
return;
|
||||
}
|
||||
final PsiClassType[] extendsListTypes = classParameter.getExtendsListTypes();
|
||||
if (extendsListTypes.length < 1) {
|
||||
return;
|
||||
@@ -140,6 +138,9 @@ public class TypeParameterExtendsFinalClassInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
public void visitTypeElement(PsiTypeElement typeElement) {
|
||||
if (!PsiUtil.isLanguageLevel5OrHigher(typeElement)) {
|
||||
return;
|
||||
}
|
||||
super.visitTypeElement(typeElement);
|
||||
final PsiType type = typeElement.getType();
|
||||
if (!(type instanceof PsiWildcardType)) {
|
||||
@@ -155,6 +156,17 @@ public class TypeParameterExtendsFinalClassInspection extends BaseInspection {
|
||||
if (aClass == null || !aClass.hasModifierProperty(PsiModifier.FINAL)) {
|
||||
return;
|
||||
}
|
||||
if (aClass.hasTypeParameters() && !PsiUtil.isLanguageLevel8OrHigher(typeElement)) {
|
||||
final PsiType[] parameters = classType.getParameters();
|
||||
if (parameters.length == 0) {
|
||||
return;
|
||||
}
|
||||
for (PsiType parameter : parameters) {
|
||||
if (parameter instanceof PsiWildcardType) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!shouldReport(typeElement)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class FinalClassWithTypeParamer {
|
||||
|
||||
A<String> t;
|
||||
}
|
||||
final class A<T> {}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
class FinalClassWithTypeParamer<T<caret> extends A<String>> {
|
||||
|
||||
T t;
|
||||
}
|
||||
final class A<T> {}
|
||||
+7
-3
@@ -3,12 +3,16 @@ package com.siyeh.igtest.inheritance.type_parameter_extends_final_class;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
public class TypeParameterExtendsFinalClass<T extends String> {}
|
||||
public class TypeParameterExtendsFinalClass<<warning descr="Type parameter 'T' extends 'final' class 'String'">T</warning> extends String> {}
|
||||
final class Usee {}
|
||||
|
||||
class User {
|
||||
List<? extends Usee> list;
|
||||
List<<warning descr="Wildcard type argument '?' extends 'final' class 'Usee'">?</warning> extends Usee> list;
|
||||
List<? extends List> l;
|
||||
private static final Collection<? extends Class> ourStopSearch = Collections.singleton(String.class);
|
||||
Collection<<warning descr="Wildcard type argument '?' extends 'final' class 'FieldIdentifier'">?</warning> extends FieldIdentifier<String>> a = Collections.singleton(new FieldIdentifier<String>());
|
||||
Collection<? extends FieldIdentifier<?>> b = Collections.singleton(new FieldIdentifier<String>());
|
||||
static final class FieldIdentifier<T> {}
|
||||
}
|
||||
abstract class MyList implements List<Integer> {
|
||||
@Override
|
||||
@@ -16,7 +20,7 @@ abstract class MyList implements List<Integer> {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
abstract class SampleMap<T extends String> implements Map<String, Object> {
|
||||
abstract class SampleMap<<warning descr="Type parameter 'T' extends 'final' class 'String'">T</warning> extends String> implements Map<String, Object> {
|
||||
|
||||
public void putAll(final Map<? extends String, ?> m) {
|
||||
final Set<? extends Entry<? extends String,?>> entries = m.entrySet();
|
||||
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>TypeParameterExtendsFinalClass.java</file>
|
||||
<line>6</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Type parameter extends final class</problem_class>
|
||||
<description>Type parameter <code>T</code> extends final class 'String' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TypeParameterExtendsFinalClass.java</file>
|
||||
<line>10</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Type parameter extends final class</problem_class>
|
||||
<description>Wildcard type argument <code>?</code> extends final class 'Usee' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TypeParameterExtendsFinalClass.java</file>
|
||||
<line>19</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Type parameter extends final class</problem_class>
|
||||
<description>Type parameter <code>T</code> extends 'final' class 'String' #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.siyeh.ig.fixes.inheritance;
|
||||
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.IGQuickFixesTestCase;
|
||||
import com.siyeh.ig.inheritance.TypeParameterExtendsFinalClassInspection;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class TypeParameterExtendsFinalClassFixTest extends IGQuickFixesTestCase {
|
||||
|
||||
public void testFinalClassWithTypeParameter() { doTest(); }
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.enableInspections(new TypeParameterExtendsFinalClassInspection());
|
||||
myRelativePath = "inheritance/type_parameter_extends_final_class";
|
||||
myDefaultHint = InspectionGadgetsBundle.message("type.parameter.extends.final.class.quickfix");
|
||||
}
|
||||
}
|
||||
+20
-4
@@ -1,10 +1,26 @@
|
||||
package com.siyeh.ig.inheritance;
|
||||
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TypeParameterExtendsFinalClassInspectionTest extends IGInspectionTestCase {
|
||||
/**
|
||||
* @author bas
|
||||
*/
|
||||
public class TypeParameterExtendsFinalClassInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
doTest("com/siyeh/igtest/inheritance/type_parameter_extends_final_class", new TypeParameterExtendsFinalClassInspection());
|
||||
public void testTypeParameterExtendsFinalClass() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new TypeParameterExtendsFinalClassInspection();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return JAVA_1_7;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<orderEntry type="module" module-name="execution-impl" />
|
||||
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
|
||||
<orderEntry type="module" module-name="java-impl" />
|
||||
<orderEntry type="library" name="TestNG" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="TestNG" level="project" />
|
||||
<orderEntry type="module" module-name="compiler-impl" />
|
||||
<orderEntry type="module" module-name="properties" />
|
||||
<orderEntry type="module" module-name="idea-ui" scope="TEST" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -62,7 +62,10 @@ public class EclipseImportWizardTest extends ProjectWizardTestCase {
|
||||
}
|
||||
|
||||
public void testImportingFromTwoProviders() throws Exception {
|
||||
File file = createTempFile("Foo.java", "class Foo {}");
|
||||
File dir = createTempDirectory();
|
||||
File file = new File(dir, "Foo.java");
|
||||
FileUtil.writeToFile(file, "class Foo {}");
|
||||
System.out.println("file = " + file);
|
||||
Module module = importProjectFrom(file.getParent(), null, new ImportFromSourcesProvider(),
|
||||
new EclipseProjectImportProvider(new EclipseImportBuilder()));
|
||||
VirtualFile[] sourceRoots = ModuleRootManager.getInstance(module).getSourceRoots();
|
||||
|
||||
+31
-22
@@ -17,9 +17,10 @@ package org.jetbrains.plugins.gradle.tooling.builder;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.ResolutionStrategy;
|
||||
import org.gradle.api.artifacts.ConfigurationContainer;
|
||||
import org.gradle.plugins.ide.idea.IdeaPlugin;
|
||||
import org.gradle.plugins.ide.idea.model.Dependency;
|
||||
import org.gradle.plugins.ide.idea.model.IdeaModule;
|
||||
import org.gradle.plugins.ide.idea.model.ModuleLibrary;
|
||||
import org.gradle.plugins.ide.idea.model.Path;
|
||||
import org.gradle.util.GradleVersion;
|
||||
@@ -31,7 +32,6 @@ import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder;
|
||||
import org.jetbrains.plugins.gradle.tooling.ModelBuilderService;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.BuildScriptClasspathModelImpl;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.ClasspathEntryModelImpl;
|
||||
import org.jetbrains.plugins.gradle.tooling.internal.ConfigurationDelegate;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@@ -43,6 +43,10 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class ModelBuildScriptClasspathBuilderImpl implements ModelBuilderService {
|
||||
|
||||
private static final String COMPILE_SCOPE = "COMPILE";
|
||||
private static final String PLUS_CONFIGURATION = "plus";
|
||||
private static final String MINUS_CONFIGURATION = "minus";
|
||||
private static final String CLASSPATH_CONFIGURATION_NAME = "classpath";
|
||||
private final Map<String, BuildScriptClasspathModelImpl> cache = new ConcurrentHashMap<String, BuildScriptClasspathModelImpl>();
|
||||
|
||||
@Override
|
||||
@@ -72,44 +76,49 @@ public class ModelBuildScriptClasspathBuilderImpl implements ModelBuilderService
|
||||
}
|
||||
}
|
||||
}
|
||||
Configuration configuration = project.getBuildscript().getConfigurations().findByName("classpath");
|
||||
if (configuration == null) return null;
|
||||
Configuration classpathConfiguration = project.getBuildscript().getConfigurations().findByName(CLASSPATH_CONFIGURATION_NAME);
|
||||
if (classpathConfiguration == null) return null;
|
||||
|
||||
final ResolutionStrategy resolutionStrategy = configuration.getResolutionStrategy();
|
||||
configuration = new ConfigurationDelegate(configuration.copy()) {
|
||||
@Override
|
||||
public ResolutionStrategy getResolutionStrategy() {
|
||||
return resolutionStrategy;
|
||||
}
|
||||
};
|
||||
final Configuration configuration;
|
||||
final IdeaModule ideaModule = ideaPlugin.getModel().getModule();
|
||||
final ConfigurationContainer configurations = ideaModule.getProject().getConfigurations();
|
||||
|
||||
if (classpathConfiguration.getState() == Configuration.State.UNRESOLVED) {
|
||||
configuration = classpathConfiguration;
|
||||
configurations.add(configuration);
|
||||
}
|
||||
else {
|
||||
configuration = configurations.maybeCreate(UUID.randomUUID().toString());
|
||||
configuration.getDependencies().addAll(classpathConfiguration.getAllDependencies());
|
||||
configuration.getArtifacts().addAll(classpathConfiguration.getAllArtifacts());
|
||||
}
|
||||
|
||||
Collection<Configuration> plusConfigurations = Collections.singletonList(configuration);
|
||||
|
||||
final Map<String, Map<String, Collection<Configuration>>> scopes =
|
||||
new HashMap<String, Map<String, Collection<Configuration>>>(ideaPlugin.getModel().getModule().getScopes());
|
||||
new HashMap<String, Map<String, Collection<Configuration>>>(ideaModule.getScopes());
|
||||
|
||||
Map<String, Map<String, Collection<Configuration>>> buildScriptScope = new HashMap<String, Map<String, Collection<Configuration>>>();
|
||||
Map<String, Collection<Configuration>> plusConfiguration = new HashMap<String, Collection<Configuration>>();
|
||||
plusConfiguration.put("plus", plusConfigurations);
|
||||
if (scopes.get("COMPILE") != null) {
|
||||
plusConfiguration.put("minus", scopes.get("COMPILE").get("plus"));
|
||||
plusConfiguration.put(PLUS_CONFIGURATION, plusConfigurations);
|
||||
if (scopes.get(COMPILE_SCOPE) != null) {
|
||||
plusConfiguration.put(MINUS_CONFIGURATION, scopes.get(COMPILE_SCOPE).get(PLUS_CONFIGURATION));
|
||||
}
|
||||
buildScriptScope.put("COMPILE", plusConfiguration);
|
||||
ideaPlugin.getModel().getModule().setScopes(buildScriptScope);
|
||||
ideaPlugin.getModel().getModule().getProject().getConfigurations().add(configuration);
|
||||
final Set<Dependency> buildScriptDependencies = ideaPlugin.getModel().getModule().resolveDependencies();
|
||||
buildScriptScope.put(COMPILE_SCOPE, plusConfiguration);
|
||||
ideaModule.setScopes(buildScriptScope);
|
||||
final Set<Dependency> buildScriptDependencies = ideaModule.resolveDependencies();
|
||||
for (Dependency dependency : buildScriptDependencies) {
|
||||
if (dependency instanceof ModuleLibrary) {
|
||||
ModuleLibrary moduleLibrary = (ModuleLibrary)dependency;
|
||||
if ("COMPILE".equals(moduleLibrary.getScope())) {
|
||||
if (COMPILE_SCOPE.equals(moduleLibrary.getScope())) {
|
||||
buildScriptClasspath.add(new ClasspathEntryModelImpl(
|
||||
convert(moduleLibrary.getClasses()), convert(moduleLibrary.getSources()), convert(moduleLibrary.getJavadoc())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ideaPlugin.getModel().getModule().setScopes(scopes);
|
||||
ideaPlugin.getModel().getModule().getProject().getConfigurations().remove(configuration);
|
||||
ideaModule.setScopes(scopes);
|
||||
configurations.remove(configuration);
|
||||
}
|
||||
|
||||
cache.put(project.getPath(), buildScriptClasspath);
|
||||
|
||||
-318
@@ -1,318 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.gradle.tooling.internal;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
import org.gradle.api.artifacts.*;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.file.FileTree;
|
||||
import org.gradle.api.specs.Spec;
|
||||
import org.gradle.api.tasks.StopExecutionException;
|
||||
import org.gradle.api.tasks.TaskDependency;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Vladislav.Soroka
|
||||
* @since 5/28/2014
|
||||
*/
|
||||
public class ConfigurationDelegate implements Configuration {
|
||||
@NotNull
|
||||
private final Configuration delegate;
|
||||
|
||||
public ConfigurationDelegate(@NotNull Configuration configuration) {
|
||||
delegate = configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolutionStrategy getResolutionStrategy() {
|
||||
return delegate.getResolutionStrategy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration resolutionStrategy(Closure closure) {
|
||||
return delegate.resolutionStrategy(closure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public State getState() {
|
||||
return delegate.getState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return delegate.isVisible();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration setVisible(boolean visible) {
|
||||
return delegate.setVisible(visible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Configuration> getExtendsFrom() {
|
||||
return delegate.getExtendsFrom();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration setExtendsFrom(Set<Configuration> superConfigs) {
|
||||
return delegate.setExtendsFrom(superConfigs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration extendsFrom(Configuration... superConfigs) {
|
||||
return delegate.extendsFrom(superConfigs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTransitive() {
|
||||
return delegate.isTransitive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration setTransitive(boolean t) {
|
||||
return delegate.setTransitive(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return delegate.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration setDescription(String description) {
|
||||
return delegate.setDescription(description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Configuration> getHierarchy() {
|
||||
return delegate.getHierarchy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<File> resolve() {
|
||||
return delegate.resolve();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<File> files(Closure dependencySpecClosure) {
|
||||
return delegate.files(dependencySpecClosure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<File> files(Spec<? super Dependency> dependencySpec) {
|
||||
return delegate.files(dependencySpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<File> files(Dependency... dependencies) {
|
||||
return delegate.files(dependencies);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection fileCollection(Spec<? super Dependency> dependencySpec) {
|
||||
return delegate.fileCollection(dependencySpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection fileCollection(Closure dependencySpecClosure) {
|
||||
return delegate.fileCollection(dependencySpecClosure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection fileCollection(Dependency... dependencies) {
|
||||
return delegate.fileCollection(dependencies);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolvedConfiguration getResolvedConfiguration() {
|
||||
return delegate.getResolvedConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUploadTaskName() {
|
||||
return delegate.getUploadTaskName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDependency getBuildDependencies() {
|
||||
return delegate.getBuildDependencies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskDependency getTaskDependencyFromProjectDependency(boolean useDependedOn, String taskName) {
|
||||
return delegate.getTaskDependencyFromProjectDependency(useDependedOn, taskName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DependencySet getDependencies() {
|
||||
return delegate.getDependencies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DependencySet getAllDependencies() {
|
||||
return delegate.getAllDependencies();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PublishArtifactSet getArtifacts() {
|
||||
return delegate.getArtifacts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PublishArtifactSet getAllArtifacts() {
|
||||
return delegate.getAllArtifacts();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<ExcludeRule> getExcludeRules() {
|
||||
return delegate.getExcludeRules();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration exclude(Map<String, String> excludeProperties) {
|
||||
return delegate.exclude(excludeProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Configuration> getAll() {
|
||||
return delegate.getAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResolvableDependencies getIncoming() {
|
||||
return delegate.getIncoming();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration copy() {
|
||||
return delegate.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration copyRecursive() {
|
||||
return delegate.copyRecursive();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration copy(Spec<? super Dependency> dependencySpec) {
|
||||
return delegate.copy(dependencySpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration copyRecursive(Spec<? super Dependency> dependencySpec) {
|
||||
return delegate.copyRecursive(dependencySpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration copy(Closure dependencySpec) {
|
||||
return delegate.copy(dependencySpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration copyRecursive(Closure dependencySpec) {
|
||||
return delegate.copyRecursive(dependencySpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getSingleFile() throws IllegalStateException {
|
||||
return delegate.getSingleFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<File> getFiles() {
|
||||
return delegate.getFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(File file) {
|
||||
return delegate.contains(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAsPath() {
|
||||
return delegate.getAsPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection plus(FileCollection collection) {
|
||||
return delegate.plus(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection minus(FileCollection collection) {
|
||||
return delegate.minus(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection filter(Closure filterClosure) {
|
||||
return delegate.filter(filterClosure);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection filter(Spec<? super File> filterSpec) {
|
||||
return delegate.filter(filterSpec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object asType(Class<?> type) throws UnsupportedOperationException {
|
||||
return delegate.asType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection add(FileCollection collection) throws UnsupportedOperationException {
|
||||
return delegate.add(collection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return delegate.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileCollection stopExecutionIfEmpty() throws StopExecutionException {
|
||||
return delegate.stopExecutionIfEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileTree getAsFileTree() {
|
||||
return delegate.getAsFileTree();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToAntBuilder(Object builder, String nodeName, AntType type) {
|
||||
delegate.addToAntBuilder(builder, nodeName, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object addToAntBuilder(Object builder, String nodeName) {
|
||||
return delegate.addToAntBuilder(builder, nodeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<File> iterator() {
|
||||
return delegate.iterator();
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,7 @@
|
||||
<depends optional="true" config-file="groovy-copyright.xml">com.intellij.copyright</depends>
|
||||
<depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.intelliLang</depends>
|
||||
<depends optional="true">AntSupport</depends>
|
||||
<depends optional="true">cucumber</depends>
|
||||
<depends optional="true">ByteCodeViewer</depends>
|
||||
<depends optional="true" config-file="groovy-byte-code-viewer.xml">ByteCodeViewer</depends>
|
||||
|
||||
<extensionPoints>
|
||||
<extensionPoint name="methodComparator" interface="org.jetbrains.plugins.groovy.lang.resolve.GrMethodComparator"/>
|
||||
@@ -1510,10 +1509,6 @@
|
||||
<codeFragmentFactory implementation="org.jetbrains.plugins.groovy.debugger.GroovyCodeFragmentFactory"/>
|
||||
</extensions>
|
||||
|
||||
<extensions defaultExtensionNs="ByteCodeViewer">
|
||||
<classSearcher implementation="org.jetbrains.plugins.groovy.byteCodeViewer.GroovyScriptClassSearcher"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
<action id="Groovy.Shell.Execute" class="com.intellij.openapi.actionSystem.EmptyAction" text="Execute Groovy Code"
|
||||
description="Execute Groovy code in console">
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<idea-plugin>
|
||||
<extensions defaultExtensionNs="ByteCodeViewer">
|
||||
<classSearcher implementation="org.jetbrains.plugins.groovy.byteCodeViewer.GroovyScriptClassSearcher"/>
|
||||
</extensions>
|
||||
</idea-plugin>
|
||||
+2
-1
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.reference.RefManager;
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.containers.BidirectionalMap;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -65,7 +66,7 @@ public class InconsistentPropertiesEndsInspectionProvider implements Inconsisten
|
||||
final IProperty property = file.findPropertyByKey(commonKey);
|
||||
assert property != null;
|
||||
final String propertyValue = property.getValue();
|
||||
if (propertyValue == null) {
|
||||
if (StringUtil.isEmptyOrSpaces(propertyValue)) {
|
||||
continue;
|
||||
}
|
||||
final char lastChar = propertyValue.charAt(propertyValue.length() - 1);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PyCharmNewProjectDialog extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
public Dimension getMinimumSize() {
|
||||
return new Dimension(800, 500);
|
||||
return new Dimension(650, 450);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.platform.DirectoryProjectGenerator;
|
||||
import com.intellij.remote.RemoteSdkCredentials;
|
||||
import com.jetbrains.python.remote.PythonRemoteInterpreterManager;
|
||||
import com.jetbrains.python.remote.RemoteProjectSettings;
|
||||
import icons.PythonIcons;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -50,13 +53,13 @@ public class PythonBaseProjectGenerator extends PythonProjectGenerator implement
|
||||
@Override
|
||||
public void generateProject(@NotNull final Project project, @NotNull VirtualFile baseDir, final Object settings,
|
||||
@NotNull final Module module) {
|
||||
/*if (settings instanceof RemoteProjectSettings) {
|
||||
if (settings instanceof RemoteProjectSettings) {
|
||||
PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();
|
||||
assert manager != null;
|
||||
manager.createDeployment(project, baseDir, (RemoteProjectSettings)settings,
|
||||
(RemoteSdkCredentials)myProjectAction.getSdk().getSdkAdditionalData());
|
||||
(RemoteSdkCredentials)((RemoteProjectSettings)settings).getSdk().getSdkAdditionalData());
|
||||
}
|
||||
else */if (settings instanceof PyNewProjectSettings) {
|
||||
else if (settings instanceof PyNewProjectSettings) {
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
+13
-7
@@ -24,6 +24,7 @@ import com.intellij.platform.DirectoryProjectGenerator;
|
||||
import com.intellij.platform.WebProjectGenerator;
|
||||
import com.intellij.ui.DocumentAdapter;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.util.NullableConsumer;
|
||||
import com.intellij.util.ui.CenteredIcon;
|
||||
import com.jetbrains.python.PythonSdkChooserCombo;
|
||||
@@ -103,14 +104,20 @@ abstract public class AbstractProjectSettingsStep extends AbstractActionWithPane
|
||||
@Override
|
||||
public JPanel createPanel() {
|
||||
final JPanel mainPanel = new JPanel(new BorderLayout());
|
||||
mainPanel.setPreferredSize(new Dimension(mainPanel.getPreferredSize().width, 450));
|
||||
final JPanel scrollPanel = new JPanel(new BorderLayout());
|
||||
|
||||
mainPanel.setPreferredSize(new Dimension(mainPanel.getPreferredSize().width, 400));
|
||||
|
||||
final JPanel panel = createBasePanel();
|
||||
mainPanel.add(panel, BorderLayout.NORTH);
|
||||
|
||||
scrollPanel.add(panel, BorderLayout.NORTH);
|
||||
final JPanel advancedSettings = createAdvancedSettings();
|
||||
if (advancedSettings != null)
|
||||
mainPanel.add(advancedSettings, BorderLayout.CENTER);
|
||||
if (advancedSettings != null) {
|
||||
scrollPanel.add(advancedSettings, BorderLayout.CENTER);
|
||||
}
|
||||
final JBScrollPane scrollPane = new JBScrollPane(scrollPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
|
||||
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
scrollPane.setBorder(null);
|
||||
mainPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
final JPanel bottomPanel = new JPanel(new BorderLayout());
|
||||
myCreateButton = new Button(myCreateAction, myCreateAction.getTemplatePresentation());
|
||||
@@ -118,10 +125,9 @@ abstract public class AbstractProjectSettingsStep extends AbstractActionWithPane
|
||||
myCreateButton.setPreferredSize(new Dimension(mainPanel.getPreferredSize().width, 40));
|
||||
myErrorLabel = new JLabel("");
|
||||
myErrorLabel.setForeground(JBColor.RED);
|
||||
bottomPanel.add(myErrorLabel, BorderLayout.SOUTH);
|
||||
bottomPanel.add(myErrorLabel, BorderLayout.NORTH);
|
||||
bottomPanel.add(myCreateButton, BorderLayout.CENTER);
|
||||
mainPanel.add(bottomPanel, BorderLayout.SOUTH);
|
||||
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.newProject.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.platform.DirectoryProjectGenerator;
|
||||
import com.intellij.util.NullableConsumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PluginSpecificProjectsStep extends DefaultActionGroup implements DumbAware {
|
||||
|
||||
public PluginSpecificProjectsStep(@NotNull final NullableConsumer<AbstractProjectSettingsStep> callback,
|
||||
@NotNull final List<DirectoryProjectGenerator> projectGenerators) {
|
||||
super("Plugin-specific", true);
|
||||
getTemplatePresentation().setIcon(AllIcons.Nodes.PluginLogo);
|
||||
for (DirectoryProjectGenerator generator : projectGenerators) {
|
||||
add(new ProjectSpecificAction(callback, generator));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.jetbrains.python.newProject.actions;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.ide.GeneralSettings;
|
||||
import com.intellij.ide.util.projectWizard.WebProjectTemplate;
|
||||
import com.intellij.internal.statistic.UsageTrigger;
|
||||
@@ -172,8 +173,17 @@ public class PyCharmNewProjectStep extends DefaultActionGroup implements DumbAwa
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
List<DirectoryProjectGenerator> pluginSpecificGenerators = Lists.newArrayList();
|
||||
for (DirectoryProjectGenerator generator : generators) {
|
||||
add(new ProjectSpecificAction(callback, generator));
|
||||
if (generator instanceof PythonProjectGenerator)
|
||||
add(new ProjectSpecificAction(callback, generator));
|
||||
else
|
||||
pluginSpecificGenerators.add(generator);
|
||||
}
|
||||
|
||||
if (!pluginSpecificGenerators.isEmpty()) {
|
||||
add(new PluginSpecificProjectsStep(callback, pluginSpecificGenerators));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.jetbrains.python.packaging;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -39,6 +40,7 @@ public abstract class PyPackageManager {
|
||||
public abstract void showInstallationError(Project project, String title, String description);
|
||||
public abstract void showInstallationError(Component owner, String title, String description);
|
||||
public abstract void refresh();
|
||||
@Nullable
|
||||
public abstract PyPackage findPackage(String name) throws PyExternalProcessException;
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.jetbrains.python.packaging;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -26,10 +27,13 @@ import java.util.List;
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class PyPackageManagers {
|
||||
|
||||
@NotNull
|
||||
public static PyPackageManagers getInstance() {
|
||||
return ServiceManager.getService(PyPackageManagers.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract PyPackageManager forSdk(Sdk sdk);
|
||||
|
||||
/**
|
||||
|
||||
+4
-2
@@ -35,9 +35,11 @@
|
||||
<text value="Templates folder:"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="586f" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="myTemplatesFolder">
|
||||
<component id="37ce3" class="javax.swing.JTextField" binding="myTemplatesFolder">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
|
||||
+4
-11
@@ -2,17 +2,14 @@ package com.jetbrains.python.templateLanguages;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class TemplateLanguagePanel extends JPanel {
|
||||
private TextFieldWithBrowseButton myTemplatesFolder;
|
||||
private JTextField myTemplatesFolder;
|
||||
private JPanel myMainPanel;
|
||||
private JLabel myTemplatesFolderLabel;
|
||||
private JComboBox myTemplateLanguage;
|
||||
@@ -26,12 +23,12 @@ public class TemplateLanguagePanel extends JPanel {
|
||||
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
|
||||
descriptor.withTreeRootVisible(true);
|
||||
descriptor.setShowFileSystemRoots(true);
|
||||
myTemplatesFolder.addBrowseFolderListener("Select Template Folder",
|
||||
"Select template folder", null, descriptor);
|
||||
List<String> templateConfigurations = TemplatesService.getAllTemplateLanguages();
|
||||
for (String configuration : templateConfigurations) {
|
||||
myTemplateLanguage.addItem(configuration);
|
||||
if (!configuration.equals(TemplatesService.WEB2PY))
|
||||
myTemplateLanguage.addItem(configuration);
|
||||
}
|
||||
myTemplatesFolder.setText(DEFAULT_TEMPLATES_FOLDER);
|
||||
}
|
||||
|
||||
public String getTemplatesFolder() {
|
||||
@@ -43,10 +40,6 @@ public class TemplateLanguagePanel extends JPanel {
|
||||
return selectedItem != null ? (String)selectedItem : null;
|
||||
}
|
||||
|
||||
public void setTemplatesRoot(String contentRoot) {
|
||||
myTemplatesFolder.setText(FileUtil.toSystemDependentName(contentRoot) + File.separator + DEFAULT_TEMPLATES_FOLDER);
|
||||
}
|
||||
|
||||
public void setTemplateLanguage(String language) {
|
||||
myTemplateLanguage.setSelectedItem(language);
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@ package com.jetbrains.python.templateLanguages;
|
||||
import com.intellij.lang.Language;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.jetbrains.python.packaging.PyPackageManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
@@ -67,5 +69,7 @@ public abstract class TemplatesService {
|
||||
public abstract void setTemplateFileTypes(List<String> fileTypes);
|
||||
|
||||
public abstract void generateTemplates(@NotNull final TemplateSettingsHolder settings, VirtualFile baseDir);
|
||||
public abstract void installTemplateEngine(@NotNull final TemplateSettingsHolder settings, @NotNull final PyPackageManager packageManager,
|
||||
@NotNull final Project project, boolean isDjango);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ public interface PyFile extends PyElement, PsiFile, PyDocStringOwner, ScopeOwner
|
||||
|
||||
List<PyClass> getTopLevelClasses();
|
||||
|
||||
@NotNull
|
||||
List<PyFunction> getTopLevelFunctions();
|
||||
|
||||
List<PyTargetExpression> getTopLevelAttributes();
|
||||
|
||||
@@ -236,6 +236,7 @@ public class PyPsiUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static <T, U extends PsiElement> List<T> collectStubChildren(U e,
|
||||
final StubElement<U> stub, final IElementType elementType,
|
||||
final Class<T> itemClass) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -72,6 +72,7 @@ public class PyModuleFindUsagesHandler extends FindUsagesHandler {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<PsiReference> findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) {
|
||||
if (target instanceof PyImportedModule) {
|
||||
|
||||
@@ -603,6 +603,7 @@ public class PyPackageManagerImpl extends PyPackageManager {
|
||||
return packages != null ? findPackageByName(name, packages) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PyPackage findPackageByName(String name, List<PyPackage> packages) {
|
||||
for (PyPackage pkg : packages) {
|
||||
if (name.equalsIgnoreCase(pkg.getName())) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.jetbrains.python.packaging;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -29,6 +30,7 @@ import java.util.Map;
|
||||
public class PyPackageManagersImpl extends PyPackageManagers {
|
||||
private final Map<String, PyPackageManagerImpl> myInstances = new HashMap<String, PyPackageManagerImpl>();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public synchronized PyPackageManager forSdk(Sdk sdk) {
|
||||
final String name = sdk.getName();
|
||||
|
||||
@@ -419,6 +419,7 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression {
|
||||
return PyPsiUtils.collectStubChildren(this, this.getStub(), PyElementTypes.CLASS_DECLARATION, PyClass.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<PyFunction> getTopLevelFunctions() {
|
||||
return PyPsiUtils.collectStubChildren(this, this.getStub(), PyElementTypes.FUNCTION_DECLARATION, PyFunction.class);
|
||||
|
||||
@@ -15,10 +15,12 @@
|
||||
*/
|
||||
package com.jetbrains.python.remote;
|
||||
|
||||
import com.jetbrains.python.newProject.PyNewProjectSettings;
|
||||
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public class RemoteProjectSettings {
|
||||
public class RemoteProjectSettings extends PyNewProjectSettings {
|
||||
private String myDeploymentName;
|
||||
private String myRemoteRoot;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user