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

This commit is contained in:
Kirill Kalishev
2012-01-10 20:06:26 +03:00
9 changed files with 57 additions and 73 deletions
@@ -49,6 +49,15 @@ public class IdeaProjectSettingsService extends ProjectSettingsService implement
});
}
public void openGlobalLibraries() {
final ProjectStructureConfigurable config = ProjectStructureConfigurable.getInstance(myProject);
ShowSettingsUtil.getInstance().editConfigurable(myProject, config, new Runnable() {
public void run() {
config.selectGlobalLibraries(true);
}
});
}
@Override
public boolean canOpenModuleSettings() {
return true;
@@ -413,6 +413,11 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
return navigateTo(place, requestFocus);
}
public ActionCallback selectGlobalLibraries(final boolean requestFocus) {
Place place = createPlaceFor(myGlobalLibrariesConfig);
return navigateTo(place, requestFocus);
}
public ActionCallback selectProjectOrGlobalLibrary(@NotNull Library library, boolean requestFocus) {
Place place = createProjectOrGlobalLibraryPlace(library);
return navigateTo(place, requestFocus);
@@ -409,6 +409,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
if (myEditor == null) {
myEditor = createEditor();
myEditor.getScrollPane().setBorder(null);
myHyperlinks = new EditorHyperlinkSupport(myEditor, myProject);
requestFlushImmediately();
myMainPanel.add(createCenterComponent(), BorderLayout.CENTER);
@@ -43,10 +43,7 @@ import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.ui.ScrollPaneFactory;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.ui.SpeedSearchComparator;
import com.intellij.ui.TreeSpeedSearch;
import com.intellij.ui.*;
import com.intellij.ui.popup.AbstractPopup;
import com.intellij.ui.speedSearch.ElementFilter;
import com.intellij.ui.speedSearch.SpeedSearchUtil;
@@ -397,7 +394,9 @@ public class FileStructurePopup implements Disposable {
}
myPrefferedWidth = Math.max(comboPanel.getPreferredSize().width, 350);
panel.add(comboPanel, BorderLayout.NORTH);
panel.add(ScrollPaneFactory.createScrollPane(myAbstractTreeBuilder.getTree()), BorderLayout.CENTER);
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myAbstractTreeBuilder.getTree());
scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP | SideBorder.BOTTOM));
panel.add(scrollPane, BorderLayout.CENTER);
panel.add(createSouthPanel(), BorderLayout.SOUTH);
return panel;
@@ -42,6 +42,9 @@ public class ProjectSettingsService {
public void openProjectSettings() {
}
public void openGlobalLibraries() {
}
public void openModuleSettings(final Module module) {
}
@@ -448,7 +448,7 @@ public class FileTreeModelBuilder {
PackageDependenciesNode directoryNode = myModuleDirNodes.get(virtualFile);
if (directoryNode != null) {
if (myCompactEmptyMiddlePackages) {
DirectoryNode nestedNode = ((DirectoryNode)directoryNode).getCompactedDirNode();
final DirectoryNode nestedNode = ((DirectoryNode)directoryNode).getCompactedDirNode();
if (nestedNode != null) { //decompact
boolean expand = false;
if (myTree != null){
@@ -465,7 +465,12 @@ public class FileTreeModelBuilder {
parentWrapper.add(nestedNode);
nestedNode.removeUpReference();
if (myTree != null && expand) {
myTree.expandPath(new TreePath(nestedNode.getPath()));
final Runnable expandRunnable = new Runnable() {
public void run() {
myTree.expandPath(new TreePath(nestedNode.getPath()));
}
};
SwingUtilities.invokeLater(expandRunnable);
}
return parentWrapper;
}
@@ -20,7 +20,10 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.light.LightMethodBuilder;
import com.intellij.psi.impl.light.LightMirrorMethod;
import com.intellij.psi.util.*;
import com.intellij.psi.util.CachedValue;
import com.intellij.psi.util.MethodSignature;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.containers.hash.HashSet;
import org.jetbrains.annotations.NotNull;
@@ -154,35 +157,20 @@ public class DelegatedMethodsContributor extends AstTransformContributor {
/**
* The key method of contributor. It collects all delegating methods of clazz
*
* If the return value is null, the result can be cached. It means that no already processed classes was touched by current processing. In
* other case some delegated methods can be missed.
*
* @param clazz class to process
* @param processed already visited classes
* @param collector result collection
* @return classes which were visited during current processing and were in processed at the very beginning of processing
*/
@Nullable
private static Set<PsiClass> process(PsiClass clazz,
PsiSubstitutor superClassSubsitutor,
Set<PsiClass> processed,
List<PsiMethod> collector,
GrTypeDefinition classToDelegateTo) {
final CachedValue<PsiMethod[]> data = clazz.getUserData(CACHED_DELEGATED_METHODS);
if (data != null) {
ContainerUtil.addAll(collector, data.getValue());
return null;
}
final Set<PsiClass> myProcessed = new HashSet<PsiClass>();
myProcessed.addAll(processed);
Set<PsiClass> alreadyVisited = null;
private static void process(PsiClass clazz,
PsiSubstitutor superClassSubsitutor,
Set<PsiClass> processed,
List<PsiMethod> collector,
GrTypeDefinition classToDelegateTo) {
final List<PsiMethod> result = new ArrayList<PsiMethod>();
//process super methods before delegated methods
for (PsiClassType superType : clazz.getSuperTypes()) {
alreadyVisited = processClassInner(superType, superClassSubsitutor, true, result, classToDelegateTo, processed, alreadyVisited);
processClassInner(superType, superClassSubsitutor, true, result, classToDelegateTo, processed);
}
if (clazz instanceof GrTypeDefinition) {
@@ -194,64 +182,36 @@ public class DelegatedMethodsContributor extends AstTransformContributor {
final PsiType type = field.getDeclaredType();
if (!(type instanceof PsiClassType)) continue;
alreadyVisited = processClassInner((PsiClassType)type, superClassSubsitutor, shouldDelegateDeprecated(delegate), result, classToDelegateTo, processed, alreadyVisited);
processClassInner((PsiClassType)type, superClassSubsitutor, shouldDelegateDeprecated(delegate), result, classToDelegateTo, processed);
}
}
collector.addAll(result);
if (alreadyVisited == null || !ContainerUtil.intersects(myProcessed, alreadyVisited)) {
final CachedValue<PsiMethod[]> value =
CachedValuesManager.getManager(clazz.getProject()).createCachedValue(new CachedValueProvider<PsiMethod[]>() {
@Override
public Result<PsiMethod[]> compute() {
return Result.create(result.toArray(new PsiMethod[result.size()]), PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT);
}
});
clazz.putUserData(CACHED_DELEGATED_METHODS, value);
}
return alreadyVisited;
}
@Nullable
private static Set<PsiClass> processClassInner(PsiClassType type,
PsiSubstitutor superClassSubstitutor,
boolean deprecated,
List<PsiMethod> result,
GrTypeDefinition classToDelegateTo,
Set<PsiClass> processed,
@Nullable Set<PsiClass> alreadyVisited) {
private static void processClassInner(PsiClassType type,
PsiSubstitutor superClassSubstitutor,
boolean deprecated,
List<PsiMethod> result,
GrTypeDefinition classToDelegateTo,
Set<PsiClass> processed) {
final PsiClassType.ClassResolveResult resolveResult = type.resolveGenerics();
final PsiClass psiClass = resolveResult.getElement();
if (psiClass == null) return alreadyVisited;
if (psiClass == null) return;
final String qname = psiClass.getQualifiedName();
if (CommonClassNames.JAVA_LANG_OBJECT.equals(qname)) return alreadyVisited;
if (GroovyCommonClassNames.GROOVY_OBJECT.equals(qname)) return alreadyVisited;
if (GroovyCommonClassNames.GROOVY_OBJECT_SUPPORT.equals(qname)) return alreadyVisited;
if (CommonClassNames.JAVA_LANG_OBJECT.equals(qname)) return;
if (GroovyCommonClassNames.GROOVY_OBJECT.equals(qname)) return;
if (GroovyCommonClassNames.GROOVY_OBJECT_SUPPORT.equals(qname)) return;
final PsiSubstitutor substitutor = TypesUtil.composeSubstitutors(resolveResult.getSubstitutor(), superClassSubstitutor);
if (processed.contains(psiClass)) {
if (alreadyVisited == null) alreadyVisited = new HashSet<PsiClass>();
alreadyVisited.add(psiClass);
return alreadyVisited;
}
if (processed.contains(psiClass)) return;
processed.add(psiClass);
collectMethods(psiClass, substitutor, deprecated, classToDelegateTo, result);
final Set<PsiClass> _alreadyVisited = process(psiClass, substitutor, processed, result, classToDelegateTo);
if (_alreadyVisited != null) {
if (alreadyVisited == null) {
alreadyVisited = _alreadyVisited;
}
else {
alreadyVisited.addAll(_alreadyVisited);
}
}
return alreadyVisited;
process(psiClass, substitutor, processed, result, classToDelegateTo);
}
private static void collectMethods(PsiClass currentClass,
@@ -227,6 +227,7 @@ public class MvcModuleStructureSynchronizer extends AbstractProjectComponent {
ApplicationManager.getApplication().assertIsDispatchThread();
synchronized (myActions) {
if (myActions.isEmpty()) {
if (myProject.isDisposed()) return;
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new DumbAwareRunnable() {
public void run() {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@@ -8,8 +8,7 @@
<properties/>
<border type="none"/>
<children>
<grid id="e7277" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<grid id="e7277" layout-manager="GridBagLayout">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
@@ -19,6 +18,7 @@
<component id="52bca" class="com.intellij.ui.components.JBLabel" binding="myTestLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
<properties>
<horizontalAlignment value="2"/>
@@ -31,6 +31,7 @@
<component id="4ae33" class="javax.swing.JComboBox" binding="myTypeChooser">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="10" bottom="0" right="0" weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
</component>