mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
Generated
-1
@@ -28,7 +28,6 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-swing.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/ant/lib/ant-javamail.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/ant/src/bundled_ant_src.zip!/bundled_ant_src/main" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/cglib-nodep-2.1_3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/cglib-src-2.1_3.jar!/src/proxy" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/dtdparser113.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-2
@@ -4,7 +4,5 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/easymockclassextension.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/easymock.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/org.eclipse.jdt.core_3.5.2.v_981_R35x.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/org.eclipse.jdt.core.source_3.5.2.v_981_R35x.jar!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="file://$PROJECT_DIR$/build/lib/gant/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/build/lib/gant/src.zip!/groovy" />
|
||||
<root url="jar://$PROJECT_DIR$/build/lib/gant/jps-sources.zip!/" />
|
||||
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/groovy-all-1.7.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/groovy-src-1.7.3.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/jdom.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/jdom.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -4,7 +4,5 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-1.0.1.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/jmock-cglib-1.0.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/junit-4.7.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/junit-4.7-src.jar!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/jh.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/jhsrc.jar!/src" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/jaxen-1.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/log4j.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/log4j.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -4,7 +4,6 @@
|
||||
<root url="jar://$PROJECT_DIR$/build/conf/mac/lib/quaqua.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/eawtstub.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/eawtstub_src.zip!/src" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -12,7 +12,5 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/hamcrest-library-1.0.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/dev/hamcrest-api-1.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/nanoxml-2.2.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/nanoxml.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/oromatcher.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/plugins/testng/lib/testng-jdk15.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/trove4j.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/trove4j_src.jar!/util/src" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/trove4j_src.jar!/src" />
|
||||
|
||||
Generated
-1
@@ -4,7 +4,6 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/velocity.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-lang-2.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/velocity-1.5-src.zip!/java" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/xstream.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/xerces.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/Xerces-J-src.2.8.1.zip!/xerces-2_8_1/src" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -5,7 +5,5 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/xbean.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/resolver.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/xmlrpc-2.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/xmlrpc2.src.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -4,7 +4,6 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/asm.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/asm-commons.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/asm-src.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-codec-1.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-collections.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-collections-3.1-src.zip!/commons-collections-3.1/src/java" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-lang-2.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/commons-net-2.0-patched.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/commons-net-2.0-patched-src.zip!/commons-net-2.0-src/src/main/java" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -3,7 +3,5 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/jcip-annotations.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/jgoodies-forms.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/jgoodies-forms-src.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-2
@@ -4,7 +4,5 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/jna-utils.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/jna.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-2
@@ -4,7 +4,5 @@
|
||||
<root url="jar://$PROJECT_DIR$/lib/microba.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/microba-src.zip!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/picocontainer.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/picocontainer-src.zip!/picocontainer-1_2/container/src/java" />
|
||||
</SOURCES>
|
||||
|
||||
Generated
-1
@@ -3,7 +3,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/serviceMessages.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/serviceMessages_201292_src.zip!/src" />
|
||||
</SOURCES>
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../../lib/dev/compilerapi.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
|
||||
@@ -48,6 +48,7 @@ public abstract class RunConfigurationExtension {
|
||||
public static final ExtensionPointName<RunConfigurationExtension> EP_NAME = new ExtensionPointName<RunConfigurationExtension>("com.intellij.runConfigurationExtension");
|
||||
public static final Key<List> RUN_EXTENSIONS = Key.create("run.extension.elemnts");
|
||||
public abstract void handleStartProcess(final ModuleBasedConfiguration configuration, final OSProcessHandler handler);
|
||||
@Nullable
|
||||
public abstract <T extends ModuleBasedConfiguration & CommonJavaRunConfigurationParameters> SettingsEditor createEditor(T configuration);
|
||||
public abstract String getEditorTitle();
|
||||
public abstract String getName();
|
||||
|
||||
+19
-13
@@ -285,7 +285,7 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
String underlyingFrameworkId = provider.getUnderlyingFrameworkId();
|
||||
FrameworkSupportNode parentNode = null;
|
||||
if (underlyingFrameworkId != null) {
|
||||
FrameworkSupportProvider parentProvider = findProvider(underlyingFrameworkId);
|
||||
FrameworkSupportProvider parentProvider = findProvider(underlyingFrameworkId, myProviders);
|
||||
if (parentProvider == null) {
|
||||
LOG.info("Cannot find id = " + underlyingFrameworkId);
|
||||
return null;
|
||||
@@ -300,8 +300,8 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private FrameworkSupportProvider findProvider(@NotNull String id) {
|
||||
for (FrameworkSupportProvider provider : myProviders) {
|
||||
private static FrameworkSupportProvider findProvider(@NotNull String id, final List<FrameworkSupportProvider> providers) {
|
||||
for (FrameworkSupportProvider provider : providers) {
|
||||
if (id.equals(provider.getId())) {
|
||||
return provider;
|
||||
}
|
||||
@@ -362,13 +362,7 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
}
|
||||
|
||||
private void sortFrameworks(final List<FrameworkSupportNode> nodes) {
|
||||
DFSTBuilder<FrameworkSupportProvider> builder = new DFSTBuilder<FrameworkSupportProvider>(GraphGenerator.create(CachingSemiGraph.create(new ProvidersGraph(myProviders))));
|
||||
if (!builder.isAcyclic()) {
|
||||
Pair<FrameworkSupportProvider,FrameworkSupportProvider> pair = builder.getCircularDependency();
|
||||
LOG.error("Circular dependency between providers '" + pair.getFirst().getId() + "' and '" + pair.getSecond().getId() + "' was found.");
|
||||
}
|
||||
|
||||
final Comparator<FrameworkSupportProvider> comparator = builder.comparator();
|
||||
final Comparator<FrameworkSupportProvider> comparator = getFrameworkSupportProvidersComparator(myProviders);
|
||||
Collections.sort(nodes, new Comparator<FrameworkSupportNode>() {
|
||||
public int compare(final FrameworkSupportNode o1, final FrameworkSupportNode o2) {
|
||||
return comparator.compare(o1.getProvider(), o2.getProvider());
|
||||
@@ -376,7 +370,19 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
});
|
||||
}
|
||||
|
||||
private class ProvidersGraph implements GraphGenerator.SemiGraph<FrameworkSupportProvider> {
|
||||
public static Comparator<FrameworkSupportProvider> getFrameworkSupportProvidersComparator(final List<FrameworkSupportProvider> providers) {
|
||||
DFSTBuilder<FrameworkSupportProvider>
|
||||
builder = new DFSTBuilder<FrameworkSupportProvider>(GraphGenerator.create(CachingSemiGraph.create(
|
||||
new ProvidersGraph(providers))));
|
||||
if (!builder.isAcyclic()) {
|
||||
Pair<FrameworkSupportProvider,FrameworkSupportProvider> pair = builder.getCircularDependency();
|
||||
LOG.error("Circular dependency between providers '" + pair.getFirst().getId() + "' and '" + pair.getSecond().getId() + "' was found.");
|
||||
}
|
||||
|
||||
return builder.comparator();
|
||||
}
|
||||
|
||||
private static class ProvidersGraph implements GraphGenerator.SemiGraph<FrameworkSupportProvider> {
|
||||
private final List<FrameworkSupportProvider> myFrameworkSupportProviders;
|
||||
|
||||
public ProvidersGraph(final List<FrameworkSupportProvider> frameworkSupportProviders) {
|
||||
@@ -392,13 +398,13 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
List<FrameworkSupportProvider> dependencies = new ArrayList<FrameworkSupportProvider>();
|
||||
String underlyingId = provider.getUnderlyingFrameworkId();
|
||||
if (underlyingId != null) {
|
||||
FrameworkSupportProvider underlyingProvider = findProvider(underlyingId);
|
||||
FrameworkSupportProvider underlyingProvider = findProvider(underlyingId, myFrameworkSupportProviders);
|
||||
if (underlyingProvider != null) {
|
||||
dependencies.add(underlyingProvider);
|
||||
}
|
||||
}
|
||||
for (String id : ids) {
|
||||
FrameworkSupportProvider dependency = findProvider(id);
|
||||
FrameworkSupportProvider dependency = findProvider(id, myFrameworkSupportProviders);
|
||||
if (dependency != null) {
|
||||
dependencies.add(dependency);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ package com.intellij.ide.util.newProjectWizard;
|
||||
|
||||
import com.intellij.ui.CheckboxTree;
|
||||
import com.intellij.ui.CheckedTreeNode;
|
||||
import com.intellij.ui.TreeSpeedSearch;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -63,6 +65,20 @@ public class FrameworksTree extends CheckboxTree {
|
||||
super.processMouseEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void installSpeedSearch() {
|
||||
new TreeSpeedSearch(this, new Convertor<TreePath, String>() {
|
||||
@Override
|
||||
public String convert(TreePath path) {
|
||||
final Object node = path.getLastPathComponent();
|
||||
if (node instanceof FrameworkSupportNode) {
|
||||
return ((FrameworkSupportNode)node).getTitle();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isProcessingMouseEventOnCheckbox() {
|
||||
return myProcessingMouseEventOnCheckbox;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ package com.intellij.ide.util.newProjectWizard;
|
||||
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
|
||||
import com.intellij.openapi.module.ModuleType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
@@ -41,7 +42,7 @@ public class StepSequence {
|
||||
myParentSequence = stepSequence;
|
||||
}
|
||||
|
||||
public void addCommonStep(ModuleWizardStep step){
|
||||
public void addCommonStep(@NotNull ModuleWizardStep step){
|
||||
myCommonSteps.add(step);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*
|
||||
* @since 5.1
|
||||
*/
|
||||
public class CreateClassAction extends CreateTemplateInPackageAction<PsiClass> {
|
||||
public class CreateClassAction extends JavaCreateTemplateInPackageAction<PsiClass> {
|
||||
public CreateClassAction() {
|
||||
super(IdeBundle.message("action.create.new.class"), IdeBundle.message("action.create.new.class"), Icons.CLASS_ICON, true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.actions;
|
||||
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public abstract class JavaCreateTemplateInPackageAction<T extends PsiElement> extends CreateTemplateInPackageAction<T> {
|
||||
|
||||
protected JavaCreateTemplateInPackageAction(String text, String description, Icon icon, boolean inSourceOnly) {
|
||||
super(text, description, icon, inSourceOnly);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean checkPackageExists(PsiDirectory directory) {
|
||||
return JavaDirectoryService.getInstance().getPackage(directory) != null;
|
||||
}
|
||||
|
||||
protected void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(dir, className);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,8 +29,10 @@ import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessTerminatedListener;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.ide.BrowserUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkType;
|
||||
@@ -38,6 +40,7 @@ import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ex.PathUtilEx;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.util.PathUtil;
|
||||
@@ -49,8 +52,12 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -75,6 +82,7 @@ public class JavadocConfiguration implements ModuleRunProfile, JDOMExternalizabl
|
||||
|
||||
private final Project myProject;
|
||||
private AnalysisScope myGenerationScope;
|
||||
private static final Logger LOGGER = Logger.getInstance("#" + JavadocConfiguration.class.getName());
|
||||
|
||||
public void setGenerationScope(AnalysisScope generationScope) {
|
||||
myGenerationScope = generationScope;
|
||||
@@ -236,22 +244,42 @@ public class JavadocConfiguration implements ModuleRunProfile, JDOMExternalizabl
|
||||
parameters.add(classPathString);
|
||||
}
|
||||
|
||||
parameters.add("-sourcepath");
|
||||
parameters.add(OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getSourcePathsList().getPathsString());
|
||||
|
||||
if (OUTPUT_DIRECTORY != null) {
|
||||
parameters.add("-d");
|
||||
parameters.add(OUTPUT_DIRECTORY.replace('/', File.separatorChar));
|
||||
}
|
||||
|
||||
final Collection<String> packages = new HashSet<String>();
|
||||
final Collection<String> sources = new HashSet<String>();
|
||||
myGenerationOptions.accept(new MyContentIterator(myProject, packages, sources));
|
||||
if (packages.size() + sources.size() == 0) {
|
||||
throw new CantRunException(JavadocBundle.message("javadoc.generate.no.classes.in.selected.packages.error"));
|
||||
try {
|
||||
File sourcepathTempFile = File.createTempFile("javadoc", "args.txt");
|
||||
sourcepathTempFile.deleteOnExit();
|
||||
parameters.add("@" + sourcepathTempFile.getCanonicalPath());
|
||||
final PrintWriter writer = new PrintWriter(new FileWriter(sourcepathTempFile));
|
||||
try {
|
||||
writer.println("-sourcepath");
|
||||
writer.println(OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getSourcePathsList().getPathsString());
|
||||
final Collection<String> packages = new HashSet<String>();
|
||||
final Collection<String> sources = new HashSet<String>();
|
||||
final Runnable findRunnable = new Runnable() {
|
||||
public void run() {
|
||||
myGenerationOptions.accept(new MyContentIterator(myProject, packages, sources));
|
||||
}
|
||||
};
|
||||
if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(findRunnable, "Search for sources to generate javadoc in...", false, myProject)) {
|
||||
return;
|
||||
}
|
||||
if (packages.size() + sources.size() == 0) {
|
||||
throw new CantRunException(JavadocBundle.message("javadoc.generate.no.classes.in.selected.packages.error"));
|
||||
}
|
||||
writer.println(StringUtil.join(packages, " "));
|
||||
writer.println(StringUtil.join(sources, " "));
|
||||
}
|
||||
finally {
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOGGER.error(e);
|
||||
}
|
||||
parameters.addAll(new ArrayList<String>(packages));
|
||||
parameters.addAll(new ArrayList<String>(sources));
|
||||
}
|
||||
|
||||
protected OSProcessHandler startProcess() throws ExecutionException {
|
||||
|
||||
@@ -185,6 +185,9 @@ public class PsiResolveHelperImpl implements PsiResolveHelper {
|
||||
if (wildcardToCapture != null) {
|
||||
if (lowerBound != PsiType.NULL) {
|
||||
if (!wildcardToCapture.isAssignableFrom(lowerBound)) return getFailedInferenceConstraint(typeParameter);
|
||||
if (wildcardToCapture.isSuper()) {
|
||||
return new Pair<PsiType, ConstraintType>(wildcardToCapture, ConstraintType.SUPERTYPE);
|
||||
}
|
||||
lowerBound = GenericsUtil.getLeastUpperBound(lowerBound, wildcardToCapture, typeParameter.getManager());
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -48,7 +48,11 @@ public class OptimizeImportsRefactoringHelper implements RefactoringHelper<Set<P
|
||||
}
|
||||
|
||||
public void performOperation(final Project project, final Set<PsiJavaFile> javaFiles) {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
public void run() {
|
||||
PsiDocumentManager.getInstance(project).commitAllDocuments();
|
||||
}
|
||||
});
|
||||
final Set<SmartPsiElementPointer<PsiImportStatementBase>> redundants = new HashSet<SmartPsiElementPointer<PsiImportStatementBase>>();
|
||||
final Runnable findRedundantImports = new Runnable() {
|
||||
public void run() {
|
||||
|
||||
@@ -190,7 +190,7 @@ the.refactoring.is.not.supported.on.non.static.inner.classes=The refactoring is
|
||||
the.selected.class.has.no.members.to.extract=The selected class has no members to extract.
|
||||
references.to.extract=References to extract
|
||||
extracting.from.class=Extracting from class:
|
||||
extracted.class.command.name=Extracted class {0}
|
||||
extracted.class.command.name=Extracted delegate {0}
|
||||
method.to.extract.parameters.from.label=Method to extract parameters from:
|
||||
name.for.new.parameter.label=Name for new parameter:
|
||||
method.selected.has.no.parameters=Method selected has no parameters.
|
||||
|
||||
@@ -229,6 +229,11 @@ public class ExtractMethodDialog extends AbstractExtractDialog {
|
||||
if (canBeVarargs) {
|
||||
myCbMakeVarargs = new NonFocusableCheckBox(RefactoringBundle.message("declare.varargs.checkbox"));
|
||||
updateVarargsEnabled();
|
||||
myCbMakeVarargs.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
updateSignature();
|
||||
}
|
||||
});
|
||||
myCbMakeVarargs.setSelected(false);
|
||||
panel.add(myCbMakeVarargs);
|
||||
}
|
||||
|
||||
@@ -31,10 +31,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ExtractClassHandler implements RefactoringActionHandler {
|
||||
|
||||
protected static String getRefactoringName() {
|
||||
return RefactorJBundle.message("extract.class");
|
||||
}
|
||||
|
||||
protected static String getHelpID() {
|
||||
return HelpID.ExtractClass;
|
||||
}
|
||||
|
||||
+7
-3
@@ -65,9 +65,13 @@ public class IntroduceFieldHandler extends BaseExpressionToFieldHandler {
|
||||
protected Settings showRefactoringDialog(Project project, Editor editor, PsiClass parentClass, PsiExpression expr,
|
||||
PsiType type,
|
||||
PsiExpression[] occurences, PsiElement anchorElement, PsiElement anchorElementIfAll) {
|
||||
final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(expr, PsiMethod.class);
|
||||
PsiElement element = expr.getUserData(ElementToWorkOn.PARENT);
|
||||
if (element == null) element = expr;
|
||||
final PsiMethod containingMethod = PsiTreeUtil.getParentOfType(expr != null ? expr : anchorElement, PsiMethod.class);
|
||||
PsiElement element = null;
|
||||
if (expr != null) {
|
||||
element = expr.getUserData(ElementToWorkOn.PARENT);
|
||||
if (element == null) element = expr;
|
||||
}
|
||||
if (element == null) element = anchorElement;
|
||||
final PsiModifierListOwner staticParentElement = PsiUtil.getEnclosingStaticElement(element, parentClass);
|
||||
boolean declareStatic = staticParentElement != null;
|
||||
|
||||
|
||||
+3
-1
@@ -233,7 +233,9 @@ public class InvertBooleanProcessor extends BaseRefactoringProcessor {
|
||||
((PsiPrefixExpression)expression.getParent()).getOperationSign().getTokenType() == JavaTokenType.EXCL) {
|
||||
expression = (PsiExpression)expression.getParent();
|
||||
}
|
||||
expression.replace(CodeInsightServicesUtil.invertCondition(expression));
|
||||
if (!(expression.getParent() instanceof PsiExpressionStatement)) {
|
||||
expression.replace(CodeInsightServicesUtil.invertCondition(expression));
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
|
||||
@@ -63,9 +63,9 @@ public class PullUpConflictsUtil {
|
||||
}
|
||||
|
||||
public static MultiMap<PsiElement, String> checkConflicts(final MemberInfo[] infos,
|
||||
PsiClass subclass,
|
||||
final PsiClass subclass,
|
||||
@Nullable PsiClass superClass,
|
||||
PsiPackage targetPackage,
|
||||
final PsiPackage targetPackage,
|
||||
PsiDirectory targetDirectory,
|
||||
final InterfaceContainmentVerifier interfaceContainmentVerifier,
|
||||
boolean movedMembers2Super) {
|
||||
@@ -143,6 +143,39 @@ public class PullUpConflictsUtil {
|
||||
}
|
||||
RefactoringConflictsUtil.analyzeModuleConflicts(subclass.getProject(), checkModuleConflictsList,
|
||||
new UsageInfo[0], targetRepresentativeElement, conflicts);
|
||||
for (final PsiMethod abstractMethod : abstractMethods) {
|
||||
final boolean toDifferentPackage =
|
||||
!Comparing.strEqual(targetPackage.getQualifiedName(), StringUtil.getPackageName(subclass.getQualifiedName()));
|
||||
abstractMethod.accept(new ClassMemberReferencesVisitor(subclass) {
|
||||
@Override
|
||||
protected void visitClassMemberReferenceElement(PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) {
|
||||
if (classMember != null && willBeMoved(classMember, movedMembers)) {
|
||||
boolean isAccessible = false;
|
||||
if (classMember.hasModifierProperty(PsiModifier.PRIVATE)) {
|
||||
isAccessible = true;
|
||||
}
|
||||
else if (classMember.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) &&
|
||||
toDifferentPackage) {
|
||||
isAccessible = true;
|
||||
}
|
||||
if (isAccessible) {
|
||||
String message = RefactoringUIUtil.getDescription(abstractMethod, false) +
|
||||
" uses " +
|
||||
RefactoringUIUtil.getDescription(classMember, true) +
|
||||
" which won't be accessible from the subclass.";
|
||||
message = CommonRefactoringUtil.capitalize(message);
|
||||
conflicts.putValue(classMember, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (abstractMethod.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) && toDifferentPackage) {
|
||||
String message = "Can't make " + RefactoringUIUtil.getDescription(abstractMethod, false) +
|
||||
" abstract as it won't be accessible from the subclass.";
|
||||
message = CommonRefactoringUtil.capitalize(message);
|
||||
conflicts.putValue(abstractMethod, message);
|
||||
}
|
||||
}
|
||||
return conflicts;
|
||||
}
|
||||
|
||||
|
||||
+13
-9
@@ -156,19 +156,21 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
|
||||
protected void performRefactoring(final UsageInfo[] usages) {
|
||||
try {
|
||||
// correct references to moved members from the outside
|
||||
LanguageExtension<MoveMemberHandler> extension=new LanguageExtension<MoveMemberHandler>("com.intellij.refactoring.moveMemberHandler");
|
||||
PsiClass targetClass = JavaPsiFacade.getInstance(myProject)
|
||||
.findClass(myOptions.getTargetClassName(), GlobalSearchScope.projectScope(myProject));
|
||||
if (targetClass == null) return;
|
||||
final Map<PsiMember, PsiElement> anchors = new HashMap<PsiMember, PsiElement>();
|
||||
for (PsiMember member : myMembersToMove) {
|
||||
anchors.put(member, extension.forLanguage(member.getLanguage()).getAnchor(member, targetClass));
|
||||
final MoveMemberHandler handler = MoveMemberHandler.EP_NAME.forLanguage(member.getLanguage());
|
||||
if (handler != null) {
|
||||
anchors.put(member, handler.getAnchor(member, targetClass));
|
||||
}
|
||||
}
|
||||
ArrayList<MoveMembersUsageInfo> otherUsages = new ArrayList<MoveMembersUsageInfo>();
|
||||
for (UsageInfo usageInfo : usages) {
|
||||
MoveMembersUsageInfo usage = (MoveMembersUsageInfo)usageInfo;
|
||||
if (!usage.reference.isValid()) continue;
|
||||
final MoveMemberHandler handler = extension.forLanguage(usageInfo.getElement().getLanguage());
|
||||
final MoveMemberHandler handler = MoveMemberHandler.EP_NAME.forLanguage(usageInfo.getElement().getLanguage());
|
||||
if (handler!=null) {
|
||||
if (handler.changeExternalUsage(myOptions, usage)) continue;
|
||||
}
|
||||
@@ -189,13 +191,15 @@ public class MoveMembersProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
}
|
||||
final RefactoringElementListener elementListener = getTransaction().getElementListener(member);
|
||||
final MoveMemberHandler handler = extension.forLanguage(member.getLanguage());
|
||||
PsiMember newMember=handler.doMove(myOptions, member, anchors.get(member), targetClass);
|
||||
elementListener.elementMoved(newMember);
|
||||
final MoveMemberHandler handler = MoveMemberHandler.EP_NAME.forLanguage(member.getLanguage());
|
||||
if (handler != null) {
|
||||
PsiMember newMember=handler.doMove(myOptions, member, anchors.get(member), targetClass);
|
||||
elementListener.elementMoved(newMember);
|
||||
|
||||
fixModifierList(newMember, usages);
|
||||
for (PsiReference reference : refsToBeRebind) {
|
||||
reference.bindToElement(newMember);
|
||||
fixModifierList(newMember, usages);
|
||||
for (PsiReference reference : refsToBeRebind) {
|
||||
reference.bindToElement(newMember);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
public class ExampleProblem {
|
||||
<T> void asserting(T t, Simple<T> l){
|
||||
}
|
||||
|
||||
<K> Simple<? super K> comp(K k){
|
||||
return null;
|
||||
}
|
||||
|
||||
public void main(String[] args) {
|
||||
asserting(0, comp(0));
|
||||
}
|
||||
}
|
||||
|
||||
class Simple<SST>{
|
||||
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package a;
|
||||
|
||||
public abstract class Test {
|
||||
abstract void x();
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
package b;
|
||||
class E{}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package b;
|
||||
|
||||
import a.Test;
|
||||
|
||||
public class TestSubclass extends Test {
|
||||
@java.lang.Override void x() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package a;
|
||||
public class Test {
|
||||
void x() {
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
package b;
|
||||
class E{}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
public abstract class Test {
|
||||
abstract void x();
|
||||
|
||||
private void xx(){}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class TestSubclass extends Test {
|
||||
@java.lang.Override
|
||||
void x() {
|
||||
xx();
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
public class Test {
|
||||
void x() {
|
||||
xx();
|
||||
}
|
||||
|
||||
private void xx(){}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
boolean f<caret>oo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void bar() {
|
||||
foo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class C {
|
||||
boolean fooInverted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void bar() {
|
||||
fooInverted();
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testExplicitMethodParameters() throws Exception { doTest(false); }
|
||||
public void testExplicitMethodParameters1() throws Exception { doTest(false); }
|
||||
public void testInferenceWithBounds() throws Exception {doTest(false);}
|
||||
public void testInferenceWithSuperBounds() throws Exception {doTest(false);}
|
||||
public void testVariance() throws Exception {doTest(false);}
|
||||
public void testForeachTypes() throws Exception {doTest(false);}
|
||||
public void testRawOverridingMethods() throws Exception {doTest(false);}
|
||||
|
||||
+4
-1
@@ -4,6 +4,7 @@ import com.intellij.facet.Facet;
|
||||
import com.intellij.facet.FacetManager;
|
||||
import com.intellij.facet.FacetTypeId;
|
||||
import com.intellij.facet.ui.FacetBasedFrameworkSupportProvider;
|
||||
import com.intellij.ide.util.newProjectWizard.AddSupportForFrameworksPanel;
|
||||
import com.intellij.ide.util.newProjectWizard.FrameworkSupportNode;
|
||||
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportCommunicator;
|
||||
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelImpl;
|
||||
@@ -31,7 +32,9 @@ public abstract class FrameworkSupportProviderTestCase extends IdeaTestCase {
|
||||
super.setUp();
|
||||
myFrameworkSupportModel = new FrameworkSupportModelImpl(getProject(), null);
|
||||
myNodes = new HashMap<FrameworkSupportProvider, FrameworkSupportNode>();
|
||||
for (FrameworkSupportProvider provider : FrameworkSupportProvider.EXTENSION_POINT.getExtensions()) {
|
||||
final FrameworkSupportProvider[] providers = FrameworkSupportProvider.EXTENSION_POINT.getExtensions().clone();
|
||||
Arrays.sort(providers, AddSupportForFrameworksPanel.getFrameworkSupportProvidersComparator(new ArrayList<FrameworkSupportProvider>(Arrays.asList(providers))));
|
||||
for (FrameworkSupportProvider provider : providers) {
|
||||
final FrameworkSupportNode node = new FrameworkSupportNode(provider, null, myFrameworkSupportModel, null, getTestRootDisposable());
|
||||
myNodes.put(provider, node);
|
||||
myFrameworkSupportModel.registerComponent(provider, node);
|
||||
|
||||
@@ -47,6 +47,20 @@ public class ExtractSuperClassTest extends CodeInsightTestCase {
|
||||
new RefactoringTestUtil.MemberDescriptor("x", PsiMethod.class));
|
||||
}
|
||||
|
||||
public void testConflictMoveAbstractWithPrivateMethod() throws Exception {
|
||||
doTest("Test", "TestSubclass",
|
||||
new String[] {"Method <b><code>x()</code></b> uses method <b><code>Test.xx()</code></b> which won't be accessible from the subclass."},
|
||||
new RefactoringTestUtil.MemberDescriptor("x", PsiMethod.class, true),
|
||||
new RefactoringTestUtil.MemberDescriptor("xx", PsiMethod.class));
|
||||
}
|
||||
|
||||
public void testConflictAbstractPackageLocalMethod() throws Exception {
|
||||
doTest("a.Test", "TestSubclass",
|
||||
new String[] {"Can't make method <b><code>x()</code></b> abstract as it won't be accessible from the subclass."},
|
||||
"b",
|
||||
new RefactoringTestUtil.MemberDescriptor("x", PsiMethod.class, true));
|
||||
}
|
||||
|
||||
public void testConflictUsingPackageLocalMethod() throws Exception {
|
||||
doTest("a.Test", "TestSubclass",
|
||||
new String[] {"method <b><code>Sup.foo()</code></b> won't be accessible"},
|
||||
|
||||
@@ -25,6 +25,7 @@ public class InvertBooleanTest extends LightCodeInsightTestCase {
|
||||
public void testParameter() throws Exception { doTest(); } //inverting boolean parameter
|
||||
|
||||
public void testParameter1() throws Exception { doTest(); } //inverting boolean parameter more advanced stuff
|
||||
public void testUnusedReturnValue() throws Exception { doTest(); }
|
||||
|
||||
private void doTest() throws Exception {
|
||||
configureByFile(TEST_ROOT + getTestName(true) + ".java");
|
||||
|
||||
@@ -159,13 +159,11 @@ public class ModuleRootsExternalizationTest extends ModuleTestCase {
|
||||
"<orderEntry type=\"module-library\">" +
|
||||
"<library>" +
|
||||
"<CLASSES><root url=\"file://$MODULE_DIR$/unnamedLibClasses\" /></CLASSES>" +
|
||||
"<JAVADOC /><SOURCES />" +
|
||||
"</library>" +
|
||||
"</orderEntry>" +
|
||||
"<orderEntry type=\"module-library\">" +
|
||||
"<library name=\"namedLibrary\">" +
|
||||
"<CLASSES><root url=\"file://$MODULE_DIR$/namedLibClasses\" /></CLASSES>" +
|
||||
"<JAVADOC /><SOURCES />" +
|
||||
"</library>" +
|
||||
"</orderEntry>" +
|
||||
"</root>", module);
|
||||
|
||||
@@ -47,7 +47,7 @@ public class LibraryTest extends IdeaTestCase {
|
||||
|
||||
final Element element = new Element("root");
|
||||
library.writeExternal(element);
|
||||
assertEquals("<root><library name=\"library\"><CLASSES><root url=\"file://x.jar\" /></CLASSES><JAVADOC /><SOURCES><root url=\"file://x-src.jar\" /></SOURCES></library></root>",
|
||||
assertEquals("<root><library name=\"library\"><CLASSES><root url=\"file://x.jar\" /></CLASSES><SOURCES><root url=\"file://x-src.jar\" /></SOURCES></library></root>",
|
||||
new XMLOutputter().outputString(element));
|
||||
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.intellij.psi.jsp;
|
||||
* @author ven
|
||||
*/
|
||||
public enum JspDirectiveKind {
|
||||
/** Mapped to both page and tag directives */
|
||||
PAGE,
|
||||
INCLUDE,
|
||||
TAGLIB,
|
||||
|
||||
@@ -29,9 +29,9 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.TableUtil;
|
||||
import com.intellij.ui.UIBundle;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.ItemRemovable;
|
||||
import com.intellij.util.ui.Table;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -66,7 +66,7 @@ public class ClassFilterEditor extends JPanel {
|
||||
myAddClassButton = new JButton(getAddButtonText());
|
||||
myAddPatternButton = new JButton(getAddPatternButtonText());
|
||||
myRemoveButton = new JButton(UIBundle.message("button.remove"));
|
||||
myTable = new Table();
|
||||
myTable = new JBTable();
|
||||
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
|
||||
|
||||
add(scrollPane, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 3, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 6), 0, 0));
|
||||
@@ -347,4 +347,8 @@ public class ClassFilterEditor extends JPanel {
|
||||
TableUtil.removeSelectedItems(myTable);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAddPatternButtonVisible(boolean visible) {
|
||||
myAddPatternButton.setVisible(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
@@ -47,16 +48,16 @@ public class ExecutionUtil {
|
||||
}
|
||||
|
||||
public static void handleExecutionError(@NotNull final Project project,
|
||||
@NotNull String toolWindowId,
|
||||
@NotNull final String toolWindowId,
|
||||
@NotNull String taskName,
|
||||
@NotNull ExecutionException e) {
|
||||
if (e instanceof RunCanceledByUserException) return;
|
||||
|
||||
LOG.debug(e);
|
||||
|
||||
String error = e.getMessage();
|
||||
HyperlinkListener listener = null;
|
||||
|
||||
LOG.debug(error);
|
||||
|
||||
if (error.contains("87") && e instanceof ProcessNotCreatedException) {
|
||||
final String commandLineString = ((ProcessNotCreatedException)e).getCommandLine().getCommandLineString();
|
||||
if (commandLineString.length() > 1024 * 32) {
|
||||
@@ -72,12 +73,18 @@ public class ExecutionUtil {
|
||||
};
|
||||
}
|
||||
}
|
||||
String message = ExecutionBundle.message("error.running.configuration.with.error.error.message", taskName, error);
|
||||
final String message = ExecutionBundle.message("error.running.configuration.with.error.error.message", taskName, error);
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
LOG.error(message);
|
||||
}
|
||||
|
||||
ToolWindowManager.getInstance(project).notifyByBalloon(toolWindowId, MessageType.ERROR, message, null, listener);
|
||||
final HyperlinkListener finalListener = listener;
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ToolWindowManager.getInstance(project).notifyByBalloon(toolWindowId, MessageType.ERROR, message, null, finalListener);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ package com.intellij.lang;
|
||||
import com.intellij.lang.documentation.CompositeDocumentationProvider;
|
||||
import com.intellij.lang.documentation.DocumentationProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LanguageDocumentation extends LanguageExtension<DocumentationProvider> {
|
||||
public static final LanguageDocumentation INSTANCE = new LanguageDocumentation();
|
||||
|
||||
@@ -32,11 +30,6 @@ public class LanguageDocumentation extends LanguageExtension<DocumentationProvid
|
||||
}
|
||||
|
||||
public DocumentationProvider forLanguage(final Language l) {
|
||||
final List<DocumentationProvider> providers = allForLanguage(l);
|
||||
if (providers.size() < 2) {
|
||||
return super.forLanguage(l);
|
||||
}
|
||||
|
||||
return new CompositeDocumentationProvider(providers);
|
||||
return CompositeDocumentationProvider.wrapProviders(allForLanguage(l));
|
||||
}
|
||||
}
|
||||
@@ -111,21 +111,27 @@ public interface PsiBuilder extends UserDataHolder {
|
||||
void done(IElementType type);
|
||||
|
||||
/**
|
||||
* Like done(), but collapses all tokens between start and end markers into single leaf node of given type.
|
||||
* Like {@linkplain #done(IElementType)}, but collapses all tokens between start and end markers
|
||||
* into single leaf node of given type.
|
||||
*
|
||||
* @param type the type of the node in the AST tree.
|
||||
*/
|
||||
void collapse(IElementType type);
|
||||
|
||||
/**
|
||||
* TODO doc
|
||||
* Like {@linkplain #done(IElementType)}, but the marker is completed (end marker inserted)
|
||||
* before specified one. All markers added between start of this marker and the marker specified as end one
|
||||
* must be either dropped or completed.
|
||||
*
|
||||
* @param type the type of the node in the AST tree.
|
||||
* @param before marker to complete this one before.
|
||||
*/
|
||||
void doneBefore(IElementType type, Marker before);
|
||||
|
||||
/**
|
||||
* TODO doc
|
||||
* Like {@linkplain #doneBefore(IElementType, Marker)}, but in addition an error element with given text
|
||||
* is inserted right before this marker's end.
|
||||
*
|
||||
* @param type the type of the node in the AST tree.
|
||||
* @param before marker to complete this one before.
|
||||
* @param errorMessage for error element.
|
||||
@@ -139,6 +145,14 @@ public interface PsiBuilder extends UserDataHolder {
|
||||
* @param message for error element.
|
||||
*/
|
||||
void error(String message);
|
||||
|
||||
/**
|
||||
* Like {@linkplain #error(String)}, but the marker is completed before specified one.
|
||||
*
|
||||
* @param message for error element.
|
||||
* @param before marker to complete this one before.
|
||||
*/
|
||||
void errorBefore(String message, Marker before);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+14
-13
@@ -28,24 +28,25 @@ public class CompositeDocumentationProvider implements DocumentationProvider, Ex
|
||||
|
||||
private final List<DocumentationProvider> myProviders;
|
||||
|
||||
public CompositeDocumentationProvider (DocumentationProvider ... documentationProviders) {
|
||||
this(Arrays.asList(documentationProviders));
|
||||
public static DocumentationProvider wrapProviders(Collection<DocumentationProvider> providers) {
|
||||
ArrayList<DocumentationProvider> list = new ArrayList<DocumentationProvider>();
|
||||
for (DocumentationProvider provider : providers) {
|
||||
if (provider instanceof CompositeDocumentationProvider) {
|
||||
list.addAll(((CompositeDocumentationProvider)provider).getProviders());
|
||||
}
|
||||
else if (provider != null) {
|
||||
list.add(provider);
|
||||
}
|
||||
}
|
||||
return list.size() == 1 ? list.get(0) : new CompositeDocumentationProvider(Collections.unmodifiableList(list));
|
||||
}
|
||||
|
||||
public CompositeDocumentationProvider(Collection<DocumentationProvider> providers) {
|
||||
myProviders = new ArrayList<DocumentationProvider>(providers);
|
||||
}
|
||||
|
||||
public void inject (DocumentationProvider provider) {
|
||||
myProviders.add ( provider );
|
||||
}
|
||||
|
||||
public void remove (DocumentationProvider provider) {
|
||||
myProviders.remove ( provider );
|
||||
private CompositeDocumentationProvider(List<DocumentationProvider> providers) {
|
||||
myProviders = providers;
|
||||
}
|
||||
|
||||
public List<DocumentationProvider> getProviders() {
|
||||
return Collections.unmodifiableList(myProviders);
|
||||
return myProviders;
|
||||
}
|
||||
|
||||
public String getQuickNavigateInfo(PsiElement element) {
|
||||
|
||||
@@ -38,6 +38,10 @@ public abstract class InlineActionHandler {
|
||||
return canInlineElement(element);
|
||||
}
|
||||
|
||||
public boolean isEnabledOnElement(PsiElement element, Editor editor) {
|
||||
return isEnabledOnElement(element);
|
||||
}
|
||||
|
||||
public abstract boolean isEnabledForLanguage(Language l);
|
||||
|
||||
public abstract boolean canInlineElement(PsiElement element);
|
||||
|
||||
@@ -431,6 +431,14 @@ public class PsiUtilBase {
|
||||
return narrowLanguage(lang, file.getLanguage());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiElement getElementAtCaret(Editor editor) {
|
||||
Project project = editor.getProject();
|
||||
if (project == null) return null;
|
||||
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
|
||||
return file == null ? null : file.findElementAt(editor.getCaretModel().getOffset());
|
||||
}
|
||||
|
||||
public static Language getDialect(@NotNull PsiElement element) {
|
||||
return narrowLanguage(element.getLanguage(), element.getContainingFile().getLanguage());
|
||||
}
|
||||
|
||||
+4
-11
@@ -64,7 +64,6 @@ import com.intellij.ui.popup.NotLookupOrSearchCondition;
|
||||
import com.intellij.ui.popup.PopupUpdateProcessor;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.update.Activatable;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -777,22 +776,16 @@ public class DocumentationManager {
|
||||
DocumentationProvider elementProvider =
|
||||
element == null || elementLanguage.is(containingFileLanguage) ? null : LanguageDocumentation.INSTANCE.forLanguage(elementLanguage);
|
||||
|
||||
addProviderToResult(result, elementProvider);
|
||||
addProviderToResult(result, originalProvider);
|
||||
result.add(elementProvider);
|
||||
result.add(originalProvider);
|
||||
|
||||
if (containingFile != null) {
|
||||
final Language baseLanguage = containingFile.getViewProvider().getBaseLanguage();
|
||||
if (!baseLanguage.is(containingFileLanguage)) {
|
||||
addProviderToResult(result, LanguageDocumentation.INSTANCE.forLanguage(baseLanguage));
|
||||
result.add(LanguageDocumentation.INSTANCE.forLanguage(baseLanguage));
|
||||
}
|
||||
}
|
||||
// return extensible documentation provider even if the list is empty
|
||||
return new CompositeDocumentationProvider(result);
|
||||
}
|
||||
|
||||
private static void addProviderToResult(final Set<DocumentationProvider> result, final DocumentationProvider t) {
|
||||
if (t instanceof CompositeDocumentationProvider) result.addAll(((CompositeDocumentationProvider)t).getProviders());
|
||||
else ContainerUtil.addIfNotNull(t, result);
|
||||
return CompositeDocumentationProvider.wrapProviders(result);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -70,6 +70,7 @@ public class TemplateState implements Disposable {
|
||||
private Editor myEditor;
|
||||
|
||||
private TemplateImpl myTemplate;
|
||||
private TemplateImpl myPrevTemplate;
|
||||
private TemplateSegments mySegments = null;
|
||||
private Map<String, String> myPredefinedVariableValues;
|
||||
|
||||
@@ -219,6 +220,7 @@ public class TemplateState implements Disposable {
|
||||
mySegments = null;
|
||||
}
|
||||
myTemplateRange = null;
|
||||
myPrevTemplate = myTemplate;
|
||||
myTemplate = null;
|
||||
releaseEditor();
|
||||
myTabStopHighlighters.clear();
|
||||
@@ -271,6 +273,7 @@ public class TemplateState implements Disposable {
|
||||
myTemplateIndented = false;
|
||||
myCurrentVariableNumber = -1;
|
||||
mySegments = new TemplateSegments(myEditor);
|
||||
myPrevTemplate = myTemplate;
|
||||
myTemplate = template;
|
||||
//myArgument = argument;
|
||||
myPredefinedVariableValues = predefinedVarValues;
|
||||
@@ -378,7 +381,7 @@ public class TemplateState implements Disposable {
|
||||
|
||||
private void afterChangedUpdate() {
|
||||
if (isFinished()) return;
|
||||
LOG.assertTrue(myTemplate != null);
|
||||
LOG.assertTrue(myTemplate != null, myPrevTemplate != null ? myPrevTemplate.getKey() : "prev template is null");
|
||||
if (myDocumentChanged) {
|
||||
if (myDocumentChangesTerminateTemplate || mySegments.isInvalid()) {
|
||||
final int oldIndex = myCurrentVariableNumber;
|
||||
|
||||
@@ -25,12 +25,11 @@ import com.intellij.ui.OptionGroup;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
// TODO copy-paste result of com.intellij.codeEditor.printing.ExportToHTMLDialog
|
||||
public class ExportToHTMLDialog extends DialogWrapper{
|
||||
private JCheckBox myCbOpenInBrowser;
|
||||
private final Project myProject;
|
||||
private TextFieldWithBrowseButton myTargetDirectoryField;
|
||||
private final boolean myCanBeOpenInBrowser;
|
||||
protected JCheckBox myCbOpenInBrowser;
|
||||
protected TextFieldWithBrowseButton myTargetDirectoryField;
|
||||
protected final boolean myCanBeOpenInBrowser;
|
||||
|
||||
public ExportToHTMLDialog(Project project, final boolean canBeOpenInBrowser) {
|
||||
super(project, true);
|
||||
@@ -54,11 +53,15 @@ public class ExportToHTMLDialog extends DialogWrapper{
|
||||
if (!myCanBeOpenInBrowser) return null;
|
||||
OptionGroup optionGroup = new OptionGroup(InspectionsBundle.message("inspection.export.options.panel.title"));
|
||||
|
||||
addOptions(optionGroup);
|
||||
|
||||
return optionGroup.createPanel();
|
||||
}
|
||||
|
||||
protected void addOptions(OptionGroup optionGroup) {
|
||||
myCbOpenInBrowser = new JCheckBox();
|
||||
myCbOpenInBrowser.setText(InspectionsBundle.message("inspection.export.open.option"));
|
||||
optionGroup.add(myCbOpenInBrowser);
|
||||
|
||||
return optionGroup.createPanel();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
||||
@@ -572,7 +572,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
|
||||
if (myTree == null) return null;
|
||||
TreePath[] paths = myTree.getSelectionPaths();
|
||||
|
||||
if (paths == null) return null;
|
||||
if (paths == null || paths.length == 0) return null;
|
||||
|
||||
if (paths.length > 1) {
|
||||
if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
*/
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.execution.process.ProcessListener;
|
||||
import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Roman.Chernyatchik
|
||||
@@ -32,6 +36,7 @@ public abstract class ExecutionMode {
|
||||
private final JComponent myProgressParentComponent;
|
||||
private Function<Object, Boolean> myShouldCancelFun;
|
||||
private final Object CANCEL_FUN_LOCK = new Object();
|
||||
private List<ProcessListener> myListeners = new ArrayList<ProcessListener>(1);
|
||||
|
||||
public ExecutionMode(final boolean cancelable,
|
||||
@Nullable final String title,
|
||||
@@ -94,4 +99,12 @@ public abstract class ExecutionMode {
|
||||
}
|
||||
}
|
||||
|
||||
public void addProcessListener(@NotNull final ProcessListener listener) {
|
||||
myListeners.add(listener);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<ProcessListener> getProcessListeners() {
|
||||
return myListeners;
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author oleg
|
||||
* @author Roman.Chernyatchik, oleg
|
||||
*/
|
||||
public class ExecutionModes {
|
||||
/**
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2010 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.
|
||||
@@ -23,7 +23,6 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.psi.JavaDirectoryService;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -71,7 +70,7 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
|
||||
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
|
||||
for (PsiDirectory dir : view.getDirectories()) {
|
||||
if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && JavaDirectoryService.getInstance().getPackage(dir) != null) {
|
||||
if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && checkPackageExists(dir)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -79,6 +78,8 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract boolean checkPackageExists(PsiDirectory directory);
|
||||
|
||||
@Nullable
|
||||
private T checkOrCreate(String newName, PsiDirectory directory, String templateName, boolean check) throws IncorrectOperationException {
|
||||
PsiDirectory dir = directory;
|
||||
@@ -113,10 +114,9 @@ public abstract class CreateTemplateInPackageAction<T extends PsiElement> extend
|
||||
return doCreate(dir, className, templateName);
|
||||
}
|
||||
|
||||
protected void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException {
|
||||
JavaDirectoryService.getInstance().checkCreateClass(dir, className);
|
||||
}
|
||||
protected abstract void doCheckCreate(PsiDirectory dir, String className, String templateName) throws IncorrectOperationException;
|
||||
|
||||
@Nullable
|
||||
protected abstract T doCreate(final PsiDirectory dir, final String className, String templateName) throws IncorrectOperationException;
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import com.intellij.ide.IdeView;
|
||||
import com.intellij.ide.projectView.ProjectView;
|
||||
import com.intellij.ide.projectView.impl.AbstractProjectViewPane;
|
||||
import com.intellij.ide.projectView.impl.ProjectRootsUtil;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.ide.ui.customization.CustomActionsSchema;
|
||||
import com.intellij.ide.util.DeleteHandler;
|
||||
import com.intellij.ide.util.DirectoryChooserUtil;
|
||||
@@ -190,7 +191,7 @@ public class NavBarPanel extends OpaquePanel.List implements DataProvider, Popup
|
||||
}
|
||||
});
|
||||
|
||||
installBorder(-1);
|
||||
installBorder(-1, false);
|
||||
|
||||
myCopyPasteDelegator = new CopyPasteDelegator(myProject, NavBarPanel.this) {
|
||||
@NotNull
|
||||
@@ -554,6 +555,10 @@ public class NavBarPanel extends OpaquePanel.List implements DataProvider, Popup
|
||||
}
|
||||
});
|
||||
|
||||
if (!isValid()) {
|
||||
validate();
|
||||
}
|
||||
|
||||
myNodePopup.showUnderneathOf(item);
|
||||
}
|
||||
}
|
||||
@@ -758,14 +763,26 @@ public class NavBarPanel extends OpaquePanel.List implements DataProvider, Popup
|
||||
myModelUpdateAlarm.cancelAllRequests();
|
||||
}
|
||||
|
||||
public void installBorder(final int rightOffset) {
|
||||
public void installBorder(final int rightOffset, final boolean isDocked) {
|
||||
setBorder(new Border() {
|
||||
public void paintBorder(final Component c, final Graphics g, final int x, final int y, final int width, final int height) {
|
||||
g.setColor(c.getBackground() != null ? c.getBackground().darker() : Color.darkGray);
|
||||
|
||||
boolean drawTopBorder = true;
|
||||
if (isDocked) {
|
||||
if (!UISettings.getInstance().SHOW_MAIN_TOOLBAR) {
|
||||
drawTopBorder = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (rightOffset == -1) {
|
||||
g.drawLine(0, 0, width - 1, 0);
|
||||
if (drawTopBorder) {
|
||||
g.drawLine(0, 0, width - 1, 0);
|
||||
}
|
||||
} else {
|
||||
g.drawLine(0, 0, width - rightOffset + 3, 0);
|
||||
if (drawTopBorder) {
|
||||
g.drawLine(0, 0, width - rightOffset + 3, 0);
|
||||
}
|
||||
}
|
||||
g.drawLine(0, height - 1 , width, height - 1);
|
||||
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class NavBarRootPaneExtension extends IdeRootPaneNorthExtension {
|
||||
myPanel.add(closeLabel, BorderLayout.EAST);
|
||||
|
||||
myPanel.putClientProperty("NavBarPanel", myNavigationBar);
|
||||
myNavigationBar.installBorder(0);
|
||||
myNavigationBar.installBorder(0, true);
|
||||
myPanel.setBorder(myNavigationBar.getBorder());
|
||||
myNavigationBar.setBorder(null);
|
||||
}
|
||||
|
||||
@@ -67,13 +67,14 @@ public class NavigationItemListCellRenderer extends OpaquePanel implements ListC
|
||||
final Color listBg = leftCellRendererComponent.getBackground();
|
||||
add(leftCellRendererComponent, BorderLayout.WEST);
|
||||
|
||||
setBackground(isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground());
|
||||
setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg);
|
||||
|
||||
if (hasRightRenderer){
|
||||
final DefaultListCellRenderer moduleRenderer = factory.getModuleRenderer();
|
||||
|
||||
final Component rightCellRendererComponent =
|
||||
moduleRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
((JComponent)rightCellRendererComponent).setOpaque(false);
|
||||
rightCellRendererComponent.setBackground(listBg);
|
||||
add(rightCellRendererComponent, BorderLayout.EAST);
|
||||
final JPanel spacer = new NonOpaquePanel();
|
||||
|
||||
@@ -28,38 +28,40 @@ import java.awt.*;
|
||||
*/
|
||||
public class PlatformModuleRendererFactory extends ModuleRendererFactory {
|
||||
public DefaultListCellRenderer getModuleRenderer() {
|
||||
return new DefaultListCellRenderer() {
|
||||
public Component getListCellRendererComponent(final JList list,
|
||||
final Object value,
|
||||
final int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
|
||||
String text = "";
|
||||
if (value instanceof NavigationItem) {
|
||||
final ItemPresentation presentation = ((NavigationItem)value).getPresentation();
|
||||
if (presentation != null) {
|
||||
String containerText = presentation.getLocationString();
|
||||
if (containerText != null && containerText.length() > 0) {
|
||||
text = " " + containerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setText(text);
|
||||
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
|
||||
setHorizontalTextPosition(SwingConstants.LEFT);
|
||||
setBackground(isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground());
|
||||
setForeground(isSelected ? UIUtil.getListSelectionForeground() : UIUtil.getInactiveTextColor());
|
||||
return component;
|
||||
}
|
||||
};
|
||||
return new PlatformModuleRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rendersLocationString() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class PlatformModuleRenderer extends DefaultListCellRenderer {
|
||||
public Component getListCellRendererComponent(final JList list,
|
||||
final Object value,
|
||||
final int index,
|
||||
final boolean isSelected,
|
||||
final boolean cellHasFocus) {
|
||||
final Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
|
||||
String text = "";
|
||||
if (value instanceof NavigationItem) {
|
||||
final ItemPresentation presentation = ((NavigationItem)value).getPresentation();
|
||||
if (presentation != null) {
|
||||
String containerText = presentation.getLocationString();
|
||||
if (containerText != null && containerText.length() > 0) {
|
||||
text = " " + containerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
setText(text);
|
||||
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 2));
|
||||
setHorizontalTextPosition(SwingConstants.LEFT);
|
||||
setBackground(isSelected ? UIUtil.getListSelectionBackground() : UIUtil.getListBackground());
|
||||
setForeground(isSelected ? UIUtil.getListSelectionForeground() : UIUtil.getInactiveTextColor());
|
||||
return component;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.intellij.ide.util.gotoByName;
|
||||
|
||||
import com.intellij.ide.util.PlatformModuleRendererFactory;
|
||||
import com.intellij.ide.util.PsiElementListCellRenderer;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
@@ -26,6 +27,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.ui.FilePathSplittingPolicy;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
@@ -72,6 +74,16 @@ public class GotoFileCellRenderer extends PsiElementListCellRenderer<PsiFile>{
|
||||
return url;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultListCellRenderer getRightCellRenderer() {
|
||||
final DefaultListCellRenderer rightRenderer = super.getRightCellRenderer();
|
||||
if (rightRenderer instanceof PlatformModuleRendererFactory.PlatformModuleRenderer) {
|
||||
// that renderer will display file path, but we're showing it ourselves - no need to show twice
|
||||
return null;
|
||||
}
|
||||
return rightRenderer;
|
||||
}
|
||||
|
||||
protected int getIconFlags() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -298,6 +298,11 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
myBuilder.error(this, message);
|
||||
}
|
||||
|
||||
public void errorBefore(final String message, final Marker before) {
|
||||
myType = TokenType.ERROR_ELEMENT;
|
||||
myBuilder.errorBefore(this, message, before);
|
||||
}
|
||||
|
||||
public IElementType getTokenType() {
|
||||
return myType;
|
||||
}
|
||||
@@ -564,15 +569,7 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public void doneBefore(Marker marker, Marker before) {
|
||||
// TODO: there could be not done markers after 'marker' and that's normal
|
||||
if (((StartMarker)marker).myDoneMarker != null) {
|
||||
LOG.error("Marker already done.");
|
||||
}
|
||||
|
||||
int idx = myProduction.lastIndexOf(marker);
|
||||
if (idx < 0) {
|
||||
LOG.error("Marker never been added.");
|
||||
}
|
||||
doValidityChecks(marker, before);
|
||||
|
||||
int beforeIndex = myProduction.lastIndexOf(before);
|
||||
|
||||
@@ -594,15 +591,27 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
}
|
||||
|
||||
public void error(Marker marker, String message) {
|
||||
doValidityChecks(marker);
|
||||
doValidityChecks(marker, null);
|
||||
|
||||
DoneWithErrorMarker doneMarker = new DoneWithErrorMarker((StartMarker)marker, myCurrentLexeme, message);
|
||||
((StartMarker)marker).myDoneMarker = doneMarker;
|
||||
myProduction.add(doneMarker);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
public void errorBefore(Marker marker, String message, Marker before) {
|
||||
doValidityChecks(marker, before);
|
||||
|
||||
int beforeIndex = myProduction.lastIndexOf(before);
|
||||
|
||||
DoneWithErrorMarker doneMarker = new DoneWithErrorMarker((StartMarker)marker, myCurrentLexeme, message);
|
||||
doneMarker.myLexemeIndex = ((StartMarker)before).myLexemeIndex;
|
||||
((StartMarker)marker).myDoneMarker = doneMarker;
|
||||
myProduction.add(beforeIndex, doneMarker);
|
||||
}
|
||||
|
||||
public void done(final Marker marker) {
|
||||
doValidityChecks(marker);
|
||||
doValidityChecks(marker, null);
|
||||
|
||||
DoneMarker doneMarker = DONE_MARKERS.alloc();
|
||||
doneMarker.myStart = (StartMarker)marker;
|
||||
@@ -618,30 +627,41 @@ public class PsiBuilderImpl extends UserDataHolderBase implements PsiBuilder {
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "SuspiciousMethodCalls"})
|
||||
private void doValidityChecks(final Marker marker) {
|
||||
if (myDebugMode) {
|
||||
final DoneMarker doneMarker = ((StartMarker)marker).myDoneMarker;
|
||||
if (doneMarker != null) {
|
||||
LOG.error("Marker already done.");
|
||||
}
|
||||
int idx = myProduction.lastIndexOf(marker);
|
||||
if (idx < 0) {
|
||||
LOG.error("Marker never been added.");
|
||||
}
|
||||
private void doValidityChecks(final Marker marker, @Nullable final Marker before) {
|
||||
if (!myDebugMode) return;
|
||||
|
||||
for (int i = myProduction.size() - 1; i > idx; i--) {
|
||||
Object item = myProduction.get(i);
|
||||
if (item instanceof StartMarker) {
|
||||
StartMarker otherMarker = (StartMarker)item;
|
||||
if (otherMarker.myDoneMarker == null) {
|
||||
final Throwable debugAllocOther = otherMarker.myDebugAllocationPosition;
|
||||
final Throwable debugAllocThis = ((StartMarker)marker).myDebugAllocationPosition;
|
||||
if (debugAllocOther != null) {
|
||||
debugAllocThis.printStackTrace(System.err);
|
||||
debugAllocOther.printStackTrace(System.err);
|
||||
}
|
||||
LOG.error("Another not done marker added after this one. Must be done before this.");
|
||||
final DoneMarker doneMarker = ((StartMarker)marker).myDoneMarker;
|
||||
if (doneMarker != null) {
|
||||
LOG.error("Marker already done.");
|
||||
}
|
||||
int idx = myProduction.lastIndexOf(marker);
|
||||
if (idx < 0) {
|
||||
LOG.error("Marker has never been added.");
|
||||
}
|
||||
|
||||
int endIdx = myProduction.size();
|
||||
if (before != null) {
|
||||
endIdx = myProduction.lastIndexOf(before);
|
||||
if (endIdx < 0) {
|
||||
LOG.error("'Before' marker has never been added.");
|
||||
}
|
||||
if (idx > endIdx) {
|
||||
LOG.error("'Before' marker precedes this one.");
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = endIdx - 1; i > idx; i--) {
|
||||
Object item = myProduction.get(i);
|
||||
if (item instanceof StartMarker) {
|
||||
StartMarker otherMarker = (StartMarker)item;
|
||||
if (otherMarker.myDoneMarker == null) {
|
||||
final Throwable debugAllocOther = otherMarker.myDebugAllocationPosition;
|
||||
final Throwable debugAllocThis = ((StartMarker)marker).myDebugAllocationPosition;
|
||||
if (debugAllocOther != null) {
|
||||
debugAllocThis.printStackTrace(System.err);
|
||||
debugAllocOther.printStackTrace(System.err);
|
||||
}
|
||||
LOG.error("Another not done marker added after this one. Must be done before this.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class LibraryImpl implements LibraryEx.ModifiableModelEx, LibraryEx {
|
||||
if (roots.size() == 0 && rootType.skipWriteIfEmpty()) continue; //compatibility iml/ipr
|
||||
final Element rootTypeElement = new Element(rootType.name());
|
||||
roots.writeExternal(rootTypeElement, ROOT_PATH_ELEMENT);
|
||||
element.addContent(rootTypeElement);
|
||||
if (rootTypeElement.getAttributes().size() > 0 || rootTypeElement.getContent().size() > 0) element.addContent(rootTypeElement);
|
||||
}
|
||||
List<String> urls = new ArrayList<String>(myJarDirectories.keySet());
|
||||
Collections.sort(urls, new Comparator<String>() {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.wm.ToolWindow;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -43,7 +44,7 @@ public class PlatformProjectViewOpener implements DirectoryProjectConfigurator {
|
||||
public void run() {
|
||||
if (project.isDisposed()) return;
|
||||
final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
|
||||
if (toolWindow != null) {
|
||||
if (toolWindow != null && toolWindow.getType() != ToolWindowType.SLIDING) {
|
||||
toolWindow.activate(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.psi.impl.include;
|
||||
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.containers.FactoryMap;
|
||||
@@ -68,14 +69,14 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
|
||||
return INDEX_ID;
|
||||
}
|
||||
|
||||
public DataIndexer<FileIncludeIndex.Key, List<FileIncludeInfoImpl>, FileContent> getIndexer() {
|
||||
return new DataIndexer<FileIncludeIndex.Key, List<FileIncludeInfoImpl>, FileContent>() {
|
||||
public DataIndexer<Key, List<FileIncludeInfoImpl>, FileContent> getIndexer() {
|
||||
return new DataIndexer<Key, List<FileIncludeInfoImpl>, FileContent>() {
|
||||
@NotNull
|
||||
public Map<FileIncludeIndex.Key, List<FileIncludeInfoImpl>> map(FileContent inputData) {
|
||||
public Map<Key, List<FileIncludeInfoImpl>> map(FileContent inputData) {
|
||||
|
||||
Map<FileIncludeIndex.Key, List<FileIncludeInfoImpl>> map = new FactoryMap<FileIncludeIndex.Key, List<FileIncludeInfoImpl>>() {
|
||||
Map<Key, List<FileIncludeInfoImpl>> map = new FactoryMap<Key, List<FileIncludeInfoImpl>>() {
|
||||
@Override
|
||||
protected List<FileIncludeInfoImpl> create(FileIncludeIndex.Key key) {
|
||||
protected List<FileIncludeInfoImpl> create(Key key) {
|
||||
return new ArrayList<FileIncludeInfoImpl>();
|
||||
}
|
||||
};
|
||||
@@ -144,6 +145,9 @@ public class FileIncludeIndex extends FileBasedIndexExtension<FileIncludeIndex.K
|
||||
public FileBasedIndex.InputFilter getInputFilter() {
|
||||
return new FileBasedIndex.InputFilter() {
|
||||
public boolean acceptInput(VirtualFile file) {
|
||||
if (file.getFileSystem() == JarFileSystem.getInstance()) {
|
||||
return false;
|
||||
}
|
||||
for (FileIncludeProvider provider : myProviders) {
|
||||
if (provider.acceptFile(file)) {
|
||||
return true;
|
||||
|
||||
+20
-15
@@ -83,12 +83,8 @@ public abstract class BaseRefactoringAction extends AnAction {
|
||||
presentation.setEnabled(true);
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
if (project == null) {
|
||||
disableAction(e);
|
||||
return;
|
||||
}
|
||||
if (isHidden()) {
|
||||
e.getPresentation().setVisible(false);
|
||||
if (project == null || isHidden()) {
|
||||
hideAction(e);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,7 +99,7 @@ public abstract class BaseRefactoringAction extends AnAction {
|
||||
|
||||
if (editor == null) {
|
||||
if (isAvailableInEditorOnly()) {
|
||||
disableAction(e);
|
||||
hideAction(e);
|
||||
return;
|
||||
}
|
||||
final PsiElement[] elements = getPsiElementArray(dataContext);
|
||||
@@ -116,21 +112,30 @@ public abstract class BaseRefactoringAction extends AnAction {
|
||||
PsiElement element = e.getData(LangDataKeys.PSI_ELEMENT);
|
||||
if (element == null || !isAvailableForLanguage(element.getLanguage())) {
|
||||
if (file == null) {
|
||||
disableAction(e);
|
||||
hideAction(e);
|
||||
return;
|
||||
}
|
||||
element = getElementAtCaret(editor, file);
|
||||
}
|
||||
final boolean isEnabled = element != null &&
|
||||
!(element instanceof SyntheticElement) &&
|
||||
isAvailableForLanguage(PsiUtilBase.getLanguageInEditor(editor, project)) &&
|
||||
isAvailableOnElementInEditor(element, editor);
|
||||
if (!isEnabled) {
|
||||
disableAction(e);
|
||||
boolean isVisible = element != null &&
|
||||
!(element instanceof SyntheticElement) &&
|
||||
isAvailableForLanguage(PsiUtilBase.getLanguageInEditor(editor, project));
|
||||
if (isVisible) {
|
||||
boolean isEnabled = isAvailableOnElementInEditor(element, editor);
|
||||
if (!isEnabled) {
|
||||
disableAction(e);
|
||||
}
|
||||
}
|
||||
else {
|
||||
hideAction(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void hideAction(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(false);
|
||||
}
|
||||
|
||||
protected boolean isHidden() {
|
||||
return false;
|
||||
}
|
||||
@@ -162,7 +167,7 @@ public abstract class BaseRefactoringAction extends AnAction {
|
||||
private static void disableAction(final AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(false);
|
||||
if (ActionPlaces.isPopupPlace(e.getPlace())) {
|
||||
e.getPresentation().setVisible(false);
|
||||
hideAction(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,16 +45,16 @@ public class InlineAction extends BasePlatformRefactoringAction {
|
||||
|
||||
@Override
|
||||
protected boolean isAvailableOnElementInEditor(PsiElement element, Editor editor) {
|
||||
return hasInlineActionHandler(element, PsiUtilBase.getLanguageInEditor(editor, element.getProject()));
|
||||
return hasInlineActionHandler(element, PsiUtilBase.getLanguageInEditor(editor, element.getProject()), editor);
|
||||
}
|
||||
|
||||
public boolean isEnabledOnElements(PsiElement[] elements) {
|
||||
return elements.length == 1 && hasInlineActionHandler(elements [0], null);
|
||||
return elements.length == 1 && hasInlineActionHandler(elements [0], null, null);
|
||||
}
|
||||
|
||||
private static boolean hasInlineActionHandler(PsiElement element, @Nullable Language editorLanguage) {
|
||||
private static boolean hasInlineActionHandler(PsiElement element, @Nullable Language editorLanguage, Editor editor) {
|
||||
for(InlineActionHandler handler: Extensions.getExtensions(InlineActionHandler.EP_NAME)) {
|
||||
if (handler.isEnabledOnElement(element)) {
|
||||
if (handler.isEnabledOnElement(element, editor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class RenameDialog extends RefactoringDialog {
|
||||
}
|
||||
|
||||
public String[] getSuggestedNames() {
|
||||
Set<String> result = new HashSet<String>();
|
||||
LinkedHashSet<String> result = new LinkedHashSet<String>();
|
||||
final NameSuggestionProvider[] providers = Extensions.getExtensions(NameSuggestionProvider.EP_NAME);
|
||||
for(NameSuggestionProvider provider: providers) {
|
||||
SuggestedNameInfo info = provider.getSuggestedNames(myPsiElement, myNameSuggestionContext, result);
|
||||
|
||||
+3
-1
@@ -227,7 +227,9 @@ public class VariableInplaceRenamer {
|
||||
}
|
||||
|
||||
//add highlights
|
||||
addHighlights(rangesToHighlight, topLevelEditor, myHighlighters, highlightManager);
|
||||
if (myHighlighters != null) { // can be null if finish is called during testing
|
||||
addHighlights(rangesToHighlight, topLevelEditor, myHighlighters, highlightManager);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.concurrency.Job;
|
||||
import com.intellij.concurrency.JobUtil;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.IndexNotReadyException;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.ui.EmptyIcon;
|
||||
@@ -66,29 +67,37 @@ public class DeferredIconImpl<T> implements DeferredIcon {
|
||||
if (!myIsScheduled) {
|
||||
myIsScheduled = true;
|
||||
|
||||
final Component target;
|
||||
final Ref<Component> target = new Ref<Component>(null);
|
||||
final Ref<Component> paintingParent = new Ref<Component>(null);
|
||||
final Ref<Rectangle> paintingParentRec = new Ref<Rectangle>(null);
|
||||
|
||||
final Container list = SwingUtilities.getAncestorOfClass(JList.class, c);
|
||||
if (list != null) {
|
||||
target = list;
|
||||
target.set(list);
|
||||
}
|
||||
else {
|
||||
final Container tree = SwingUtilities.getAncestorOfClass(JTree.class, c);
|
||||
if (tree != null) {
|
||||
target = tree;
|
||||
target.set(tree);
|
||||
}
|
||||
else {
|
||||
final Container table = SwingUtilities.getAncestorOfClass(JTable.class, c);
|
||||
if (table != null) {
|
||||
target = table;
|
||||
target.set(table);
|
||||
}
|
||||
else {
|
||||
target = c;
|
||||
target.set(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myLastTarget = new WeakReference<Component>(target);
|
||||
Container pp = SwingUtilities.getAncestorOfClass(PaintingParent.class, c);
|
||||
paintingParent.set(pp);
|
||||
if (paintingParent.get() != null) {
|
||||
paintingParentRec.set(((PaintingParent)pp).getChildRec(c));
|
||||
}
|
||||
|
||||
myLastTarget = new WeakReference<Component>(target.get());
|
||||
|
||||
JobUtil.submitToJobThread(new Runnable() {
|
||||
public void run() {
|
||||
@@ -100,10 +109,23 @@ public class DeferredIconImpl<T> implements DeferredIcon {
|
||||
//noinspection SSBasedInspection
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Component actualTarget = target.get();
|
||||
if (SwingUtilities.getWindowAncestor(actualTarget) == null) {
|
||||
actualTarget = paintingParent.get();
|
||||
if (actualTarget == null || SwingUtilities.getWindowAncestor(actualTarget) == null) {
|
||||
actualTarget = null;
|
||||
myLastTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
if (actualTarget == null) return;
|
||||
|
||||
myLastTarget = new WeakReference<Component>(actualTarget);
|
||||
|
||||
if (shouldRevalidate) {
|
||||
// revalidate will not work: jtree caches size of nodes
|
||||
if (target instanceof JTree) {
|
||||
final TreeUI ui = ((JTree)target).getUI();
|
||||
if (actualTarget instanceof JTree) {
|
||||
final TreeUI ui = ((JTree)actualTarget).getUI();
|
||||
if (ui instanceof BasicTreeUI) {
|
||||
// this call is "fake" and only need to reset tree layout cache
|
||||
((BasicTreeUI)ui).setLeftChildIndent(((Integer)UIManager.get("Tree.leftChildIndent")).intValue());
|
||||
@@ -111,11 +133,16 @@ public class DeferredIconImpl<T> implements DeferredIcon {
|
||||
}
|
||||
}
|
||||
|
||||
if (c == target) {
|
||||
if (c == actualTarget) {
|
||||
c.repaint(x, y, getIconWidth(), getIconHeight());
|
||||
}
|
||||
else {
|
||||
ourRepaintScheduler.pushDirtyComponent(target);
|
||||
Rectangle rec = null;
|
||||
if (paintingParentRec.get() != null) {
|
||||
rec = paintingParentRec.get();
|
||||
}
|
||||
|
||||
ourRepaintScheduler.pushDirtyComponent(actualTarget, rec);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -191,20 +218,44 @@ public class DeferredIconImpl<T> implements DeferredIcon {
|
||||
|
||||
private static class RepaintScheduler {
|
||||
private final Alarm myAlarm = new Alarm();
|
||||
private final Set<Component> myQueue = new LinkedHashSet<Component>();
|
||||
private final Set<RepaintRequest> myQueue = new LinkedHashSet<RepaintRequest>();
|
||||
|
||||
public void pushDirtyComponent(Component c) {
|
||||
public void pushDirtyComponent(final Component c, final Rectangle rec) {
|
||||
myAlarm.cancelAllRequests();
|
||||
myAlarm.addRequest(new Runnable() {
|
||||
public void run() {
|
||||
for (Component component : myQueue) {
|
||||
component.repaint();
|
||||
for (RepaintRequest each : myQueue) {
|
||||
Rectangle r = each.getRectangle();
|
||||
if (r != null) {
|
||||
each.getComponent().repaint(r.x, r.y, r.width, r.height);
|
||||
} else {
|
||||
each.getComponent().repaint();
|
||||
}
|
||||
}
|
||||
myQueue.clear();
|
||||
}
|
||||
}, 50);
|
||||
|
||||
myQueue.add(c);
|
||||
myQueue.add(new RepaintRequest(c, rec));
|
||||
}
|
||||
}
|
||||
|
||||
private static class RepaintRequest {
|
||||
private Component myComponent;
|
||||
private Rectangle myRectangle;
|
||||
|
||||
private RepaintRequest(Component component, Rectangle rectangle) {
|
||||
myComponent = component;
|
||||
myRectangle = rectangle;
|
||||
}
|
||||
|
||||
public Component getComponent() {
|
||||
return myComponent;
|
||||
}
|
||||
|
||||
public Rectangle getRectangle() {
|
||||
return myRectangle;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -97,25 +97,30 @@ public class TextFieldWithAutoCompletion extends EditorTextField {
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
final Editor editor = getEditor();
|
||||
assert editor != null;
|
||||
|
||||
editor.getSelectionModel().removeSelection();
|
||||
final String lookupPrefix = getCurrentLookupPrefix(getCurrentTextPrefix());
|
||||
final LookupImpl lookup =
|
||||
(LookupImpl)LookupManager.getInstance(getProject()).createLookup(editor,
|
||||
calcLookupItems(lookupPrefix),
|
||||
lookupPrefix != null ? lookupPrefix : "",
|
||||
LookupArranger.DEFAULT);
|
||||
final String advertisementText = getAdvertisementText();
|
||||
if (!StringUtil.isEmpty(advertisementText)) {
|
||||
lookup.setAdvertisementText(advertisementText);
|
||||
lookup.refreshUi();
|
||||
}
|
||||
lookup.show();
|
||||
showLookup();
|
||||
}
|
||||
}
|
||||
|
||||
public void showLookup() {
|
||||
if (LookupManager.getInstance(getProject()).getActiveLookup() != null) return;
|
||||
final Editor editor = getEditor();
|
||||
assert editor != null;
|
||||
|
||||
editor.getSelectionModel().removeSelection();
|
||||
final String lookupPrefix = getCurrentLookupPrefix(getCurrentTextPrefix());
|
||||
final LookupImpl lookup =
|
||||
(LookupImpl)LookupManager.getInstance(getProject()).createLookup(editor,
|
||||
calcLookupItems(lookupPrefix),
|
||||
lookupPrefix != null ? lookupPrefix : "",
|
||||
LookupArranger.DEFAULT);
|
||||
final String advertisementText = getAdvertisementText();
|
||||
if (!StringUtil.isEmpty(advertisementText)) {
|
||||
lookup.setAdvertisementText(advertisementText);
|
||||
lookup.refreshUi();
|
||||
}
|
||||
lookup.show();
|
||||
}
|
||||
|
||||
public void setAdvertisementText(@Nullable String text) {
|
||||
myAdText = text;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user