Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
Dmitry Avdeev
2010-01-22 12:59:15 +03:00
13 changed files with 164 additions and 46 deletions
@@ -18,12 +18,10 @@ package com.intellij.patterns;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.PsiParameterList;
import com.intellij.psi.*;
import com.intellij.psi.search.searches.SuperMethodsSearch;
import com.intellij.psi.util.MethodSignatureBackedByPsiMethod;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.ProcessingContext;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NonNls;
@@ -67,13 +65,28 @@ public class PsiMethodPattern extends PsiMemberPattern<PsiMethod,PsiMethodPatter
if (dotsIndex > 0) {
final PsiParameter[] psiParameters = parameterList.getParameters();
for (int i = 0; i < dotsIndex; i++) {
if (!Comparing.equal("?", types[i]) && !types[i].equals(psiParameters[i].getType().getCanonicalText())) {
if (!Comparing.equal("?", types[i]) && !typeEquivalent(psiParameters[i].getType(), types[i])) {
return false;
}
}
}
return true;
}
private boolean typeEquivalent(PsiType type, String expectedText) {
final PsiType erasure = TypeConversionUtil.erasure(type);
final String text;
if (erasure instanceof PsiEllipsisType && expectedText.endsWith("[]")) {
text = ((PsiEllipsisType)erasure).getComponentType().getCanonicalText() + "[]";
}
else if (erasure instanceof PsiArrayType && expectedText.endsWith("...")) {
text = ((PsiArrayType)erasure).getComponentType().getCanonicalText() +"...";
}
else {
text = erasure.getCanonicalText();
}
return expectedText.equals(text);
}
});
}
@@ -35,6 +35,10 @@ public class SemKey<T extends SemElement> {
myUniqueId = counter.getAndIncrement();
}
public SemKey<? super T>[] getSupers() {
return mySupers;
}
public boolean isKindOf(SemKey<?> another) {
if (another == this) return true;
for (final SemKey<? super T> superKey : mySupers) {
@@ -25,6 +25,7 @@ import com.intellij.psi.impl.PsiManagerEx;
import com.intellij.psi.util.PsiModificationTracker;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.NullableFunction;
import com.intellij.util.Processor;
import com.intellij.util.SmartList;
import com.intellij.util.containers.ConcurrentHashMap;
import com.intellij.util.containers.ContainerUtil;
@@ -130,13 +131,17 @@ public class SemServiceImpl extends SemService{
SemKey[] allKeys = map.keySet().toArray(new SemKey[map.size()]);
for (final SemKey key : allKeys) {
myProducers.put(key, map.get(key));
for (final SemKey concrete : allKeys) {
if (concrete.isKindOf(key)) {
myInheritors.putValue(key, concrete);
}
}
}
ContainerUtil.process(allKeys, new Processor<SemKey>() {
public boolean process(SemKey key) {
myInheritors.putValue(key, key);
for (SemKey parent : key.getSupers()) {
myInheritors.putValue(parent, key);
process(parent);
}
return true;
}
});
for (final SemKey each : myInheritors.keySet()) {
final List<SemKey> inheritors = new ArrayList<SemKey>(myInheritors.get(each));
Collections.sort(inheritors, KEY_COMPARATOR);
@@ -172,7 +177,7 @@ public class SemServiceImpl extends SemService{
private List<SemElement> createSemElements(SemKey key, PsiElement psi) {
List<SemElement> result = null;
final Collection<NullableFunction<PsiElement, ? extends SemElement>> producers = myProducers.get(key);
if (!producers.isEmpty()) {
if (producers != null && !producers.isEmpty()) {
for (final NullableFunction<PsiElement, ? extends SemElement> producer : producers) {
final SemElement element = producer.fun(psi);
if (element != null) {
@@ -223,6 +223,10 @@ public class FileBasedIndex implements ApplicationComponent {
}
});
myChangedFilesCollector = new ChangedFilesCollector();
}
public void initComponent() {
final File workInProgressFile = getMarkerFile();
if (workInProgressFile.exists()) {
// previous IDEA session was closed incorrectly, so drop all indices
@@ -256,11 +260,13 @@ public class FileBasedIndex implements ApplicationComponent {
}
}
myChangedFilesCollector = new ChangedFilesCollector();
vfManager.addVirtualFileListener(myChangedFilesCollector);
myVfManager.addVirtualFileListener(myChangedFilesCollector);
registerIndexableSet(new AdditionalIndexableFileSet());
}
catch (IOException e) {
throw new RuntimeException(e);
}
finally {
ShutDownTracker.getInstance().registerShutdownTask(new Runnable() {
public void run() {
@@ -432,9 +438,6 @@ public class FileBasedIndex implements ApplicationComponent {
return "FileBasedIndex";
}
public void initComponent() {
}
public void disposeComponent() {
performShutdown();
}
@@ -111,6 +111,7 @@
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "org.springframework.jdbc.core.BatchPreparedStatementSetter").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String[]").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").withParameters("java.lang.String").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").withParameters("java.lang.String", "org.springframework.jdbc.core.CallableStatementCallback").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").withParameters("java.lang.String", "org.springframework.jdbc.core.PreparedStatementCallback").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "java.lang.Object[]", "int[]", "org.springframework.jdbc.core.ResultSetExtractor").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "java.lang.Object[]", "int[]", "org.springframework.jdbc.core.RowCallbackHandler").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
@@ -220,14 +221,40 @@
</injection>
<injection language="SQL" injector-id="java">
<display-name>SimpleJdbcOperations (org.springframework.jdbc.core.simple)</display-name>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper<T>", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "java.util.List").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "java.util.List", "int[]").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "java.util.Map[]").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource[]").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class<T>", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper<T>", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "java.lang.Class", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.RowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").withParameters("java.lang.String", "org.springframework.jdbc.core.simple.ParameterizedRowMapper", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.lang.Object...").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "java.util.Map").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").withParameters("java.lang.String", "org.springframework.jdbc.core.namedparam.SqlParameterSource").definedInClass("org.springframework.jdbc.core.simple.SimpleJdbcOperations"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>SqlCall.SqlCall (org.springframework.jdbc.object)</display-name>
@@ -239,6 +266,12 @@
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]", "java.lang.Class").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>SqlFunction.SqlFunction (org.springframework.jdbc.object)</display-name>
<place disabled="true"><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
<place disabled="true"><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
<place><![CDATA[psiParameter().ofMethod(1, psiMethod().withName("SqlFunction").withParameters("javax.sql.DataSource", "java.lang.String", "int[]", "java.lang.Class").definedInClass("org.springframework.jdbc.object.SqlFunction"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>SqlOperation.newPreparedStatementCreator (org.springframework.jdbc.object)</display-name>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("newPreparedStatementCreator").withParameters("java.lang.String", "java.lang.Object[]").definedInClass("org.springframework.jdbc.object.SqlOperation"))]]></place>
@@ -16,24 +16,26 @@
package com.intellij.cvsSupport2.actions;
import com.intellij.CvsBundle;
import com.intellij.util.Consumer;
import com.intellij.cvsSupport2.actions.cvsContext.CvsContext;
import com.intellij.cvsSupport2.actions.cvsContext.CvsContextWrapper;
import com.intellij.cvsSupport2.config.CvsRootConfiguration;
import com.intellij.cvsSupport2.config.ui.SelectCvsConfigurationDialog;
import com.intellij.cvsSupport2.connections.CvsEnvironment;
import com.intellij.cvsSupport2.cvsBrowser.ui.BrowserPanel;
import com.intellij.cvsSupport2.cvsExecution.ModalityContext;
import com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl;
import com.intellij.cvsSupport2.cvshandlers.AbstractCvsHandler;
import com.intellij.cvsSupport2.cvshandlers.CvsHandler;
import com.intellij.cvsSupport2.cvshandlers.FileSetToBeUpdated;
import com.intellij.cvsSupport2.cvsoperations.common.LoginPerformer;
import com.intellij.cvsSupport2.ui.CvsTabbedWindow;
import com.intellij.cvsSupport2.connections.CvsEnvironment;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.actions.VcsContext;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.actions.VcsContext;
import com.intellij.util.Consumer;
import java.util.Collections;
@@ -75,6 +77,12 @@ public class BrowseCvsRepositoryAction extends AbstractAction{
CvsTabbedWindow tabbedWindow,
boolean successfully,
CvsHandler handler) {
if (! loginImpl(context.getProject(), new ModalityContextImpl(ModalityState.NON_MODAL, false),
new Consumer<VcsException>() {
public void consume(VcsException e) {
//
}
})) return;
super.onActionPerformed(context, tabbedWindow, successfully, handler);
if (successfully){
Project project = context.getProject();
@@ -105,14 +113,25 @@ public class BrowseCvsRepositoryAction extends AbstractAction{
}
public boolean login(ModalityContext executor) throws Exception {
final LoginPerformer.MyProjectKnown performer =
return loginImpl(myProject, executor, new Consumer<VcsException>() {
public void consume(VcsException e) {
myErrors.add(e);
}
});
/*final LoginPerformer.MyProjectKnown performer =
new LoginPerformer.MyProjectKnown(myProject, Collections.<CvsEnvironment>singletonList(mySelectedConfiguration),
new Consumer<VcsException>() {
public void consume(VcsException e) {
myErrors.add(e);
}
});
return performer.loginAll(executor);
return performer.loginAll(executor, false);*/
}
}
public boolean loginImpl(final Project project, final ModalityContext executor, final Consumer<VcsException> exceptionConsumer) {
final LoginPerformer.MyProjectKnown performer =
new LoginPerformer.MyProjectKnown(project, Collections.<CvsEnvironment>singletonList(mySelectedConfiguration), exceptionConsumer);
return performer.loginAll(executor, false);
}
}
@@ -51,6 +51,10 @@ public abstract class LoginPerformer<T extends CvsEnvironment> {
protected abstract Project getProject(T root);
public boolean loginAll(final ModalityContext executor) {
return loginAll(executor, true);
}
public boolean loginAll(final ModalityContext executor, final boolean goOffline) {
for (T root : myRoots) {
final Project project = getProject(root);
@@ -59,7 +63,9 @@ public abstract class LoginPerformer<T extends CvsEnvironment> {
final ThreeState checkResult = checkLoginWorker(worker, executor, project, myForceCheck);
if (! ThreeState.YES.equals(checkResult)) {
if (ThreeState.UNSURE.equals(checkResult)) {
worker.goOffline();
if (goOffline) {
worker.goOffline();
}
myExceptionConsumer.consume(new CvsException("Authentication canceled", root.getCvsRootAsString()));
}
return false;
@@ -16,14 +16,22 @@
package com.intellij.cvsSupport2.ui.experts;
import com.intellij.cvsSupport2.config.CvsRootConfiguration;
import com.intellij.cvsSupport2.connections.CvsEnvironment;
import com.intellij.cvsSupport2.cvsBrowser.CvsElement;
import com.intellij.cvsSupport2.cvsBrowser.CvsTree;
import com.intellij.cvsSupport2.cvsBrowser.LoginAbortedException;
import com.intellij.cvsSupport2.cvsExecution.ModalityContextImpl;
import com.intellij.cvsSupport2.cvsoperations.common.LoginPerformer;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.util.Consumer;
import javax.swing.*;
import java.awt.*;
import java.util.Collections;
import java.util.Observable;
import java.util.Observer;
@@ -60,9 +68,28 @@ public class SelectCvsElementStep extends WizardStep {
return myCvsTree.getCurrentSelection().length > 0;
}
private boolean isLogged(final CvsRootConfiguration selectedConfiguration) {
final Ref<Boolean> errors = new Ref<Boolean>();
final LoginPerformer.MyProjectKnown performer = new LoginPerformer.MyProjectKnown(
myProject, Collections.<CvsEnvironment>singletonList(selectedConfiguration),
new Consumer<VcsException>() {
public void consume(VcsException e) {
errors.set(Boolean.TRUE);
}
});
final boolean logged = performer.loginAll(
new ModalityContextImpl(ModalityState.stateForComponent(mySelectCVSConfigurationStep.getComponent()), false), false);
if ((! logged) || (! errors.isNull())) {
return false;
}
return true;
}
public boolean setActive() {
CvsRootConfiguration selectedConfiguration =
mySelectCVSConfigurationStep.getSelectedConfiguration();
if (! isLogged(selectedConfiguration)) return false;
if (myCvsTree == null || !Comparing.equal(myConfiguration, selectedConfiguration)) {
myConfiguration = selectedConfiguration;
if (myConfiguration == null) return false;
@@ -38,7 +38,6 @@ public class GroovyFileType extends LanguageFileType {
public static final GroovyFileType GROOVY_FILE_TYPE = new GroovyFileType();
public static final Language GROOVY_LANGUAGE = GROOVY_FILE_TYPE.getLanguage();
public static final Icon GROOVY_LOGO = GroovyIcons.GROOVY_ICON_16x16;
@NonNls public static final String DEFAULT_EXTENSION = "groovy";
private GroovyFileType() {
@@ -64,7 +63,7 @@ public class GroovyFileType extends LanguageFileType {
}
public Icon getIcon() {
return GROOVY_LOGO;
return GroovyIcons.GROOVY_ICON_16x16;
}
public boolean isJVMDebuggingSupported() {
@@ -40,7 +40,7 @@ public class GroovyIconProvider extends IconProvider implements DumbAware {
if (typeDefinitions.length > 0) {
return typeDefinitions[0].getIcon(flags);
}
return GroovyFileType.GROOVY_LOGO;
return GroovyIcons.GROOVY_ICON_16x16;
}
return GroovyScriptType.getScriptType(file).getScriptIcon();
@@ -20,7 +20,7 @@ import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.GroovyIcons;
import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfiguration;
import org.jetbrains.plugins.groovy.runner.GroovyScriptRunner;
@@ -44,7 +44,7 @@ public abstract class GroovyScriptType {
@NotNull
@Override
public Icon getScriptIcon() {
return GroovyFileType.GROOVY_LOGO;
return GroovyIcons.GROOVY_ICON_16x16;
}
@Override
@@ -36,6 +36,7 @@ import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.GroovyIcons;
import org.jetbrains.plugins.groovy.dsl.GroovyDslFileIndex;
import org.jetbrains.plugins.groovy.dsl.GroovyScriptDescriptor;
import org.jetbrains.plugins.groovy.extensions.GroovyScriptType;
@@ -300,7 +301,7 @@ public class GroovyFileImpl extends GroovyFileBaseImpl implements GroovyFile {
if (isScript()) {
return GroovyScriptType.getScriptType(this).getScriptIcon();
}
return GroovyFileType.GROOVY_LOGO;
return GroovyIcons.GROOVY_ICON_16x16;
}
public GrImportStatement addImportForClass(PsiClass aClass) {
@@ -142,22 +142,26 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent<S
}
public void consume(final SvnBranchConfigurationNew prev, final SvnBranchConfigurationNew next) {
final Set<String> oldUrls = (prev == null) ? Collections.<String>emptySet() : new HashSet<String>(prev.getBranchUrls());
final Application application = ApplicationManager.getApplication();
application.executeOnPooledThread(new Runnable() {
public void run() {
final SvnVcs vcs = SvnVcs.getInstance(myProject);
if (! vcs.isVcsBackgroundOperationsAllowed(myRoot)) return;
for (String newBranchUrl : next.getBranchUrls()) {
if (myAll || (! oldUrls.contains(newBranchUrl))) {
new NewRootBunch.BranchesLoadRunnable(myProject, myBunch, newBranchUrl, InfoReliability.defaultValues, myRoot, null).run();
}
}
loadImpl(prev, next);
}
});
}
protected void loadImpl(final SvnBranchConfigurationNew prev, final SvnBranchConfigurationNew next) {
final Set<String> oldUrls = (prev == null) ? Collections.<String>emptySet() : new HashSet<String>(prev.getBranchUrls());
final SvnVcs vcs = SvnVcs.getInstance(myProject);
if (! vcs.isVcsBackgroundOperationsAllowed(myRoot)) return;
for (String newBranchUrl : next.getBranchUrls()) {
if (myAll || (! oldUrls.contains(newBranchUrl))) {
new NewRootBunch.BranchesLoadRunnable(myProject, myBunch, newBranchUrl, InfoReliability.defaultValues, myRoot, null).run();
}
}
}
public void setAll(boolean all) {
myAll = all;
}
@@ -200,11 +204,15 @@ public class SvnBranchConfigurationManager implements PersistentStateComponent<S
}
((ProjectLevelVcsManagerImpl) myVcsManager).addInitializationRequest(VcsInitObject.BRANCHES, new Runnable() {
public void run() {
for (Pair<VirtualFile, SvnBranchConfigurationNew> pair : whatToInit) {
final BranchesPreloader branchesPreloader = new BranchesPreloader(myProject, myBunch, pair.getFirst());
branchesPreloader.setAll(true);
branchesPreloader.consume(null, pair.getSecond());
}
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
public void run() {
for (Pair<VirtualFile, SvnBranchConfigurationNew> pair : whatToInit) {
final BranchesPreloader branchesPreloader = new BranchesPreloader(myProject, myBunch, pair.getFirst());
branchesPreloader.setAll(true);
branchesPreloader.loadImpl(null, pair.getSecond());
}
}
});
}
});
object.myConfigurationMap.clear();