mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' into upsource-master
Conflicts: build/scripts/libLicenses.gant images/src/org/intellij/images/index/ImageInfoIndex.java java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java java/execution/impl/src/com/intellij/execution/actions/AbstractRerunFailedTestsAction.java jps/jps-builders/src/org/jetbrains/jps/cmdline/BuildSession.java jps/jps-builders/src/org/jetbrains/jps/incremental/IncProjectBuilder.java jps/jps-builders/src/org/jetbrains/jps/incremental/storage/BuildDataManager.java jps/jps-builders/src/org/jetbrains/jps/javac/JavacMain.java jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager.java jps/jps-builders/src/org/jetbrains/jps/javac/OptimizedFileManager17.java jps/model/src/org/jetbrains/jps/idea/IdeaProjectLoader.groovy platform/lang-api/src/com/intellij/execution/runners/ExecutionEnvironment.java platform/lang-impl/src/com/intellij/codeInsight/editorActions/CopyPasteIndentProcessor.java platform/platform-impl/src/com/intellij/featureStatistics/actions/ShowFeatureUsageStatisticsDialog.java platform/platform-resources-en/src/messages/ActionsBundle.properties platform/util/src/com/intellij/icons/AllIcons.java plugins/IdeaTestAssistant/src/com/intellij/testAssistant/TestDataHighlightingPass.java plugins/java-i18n/src/com/intellij/spellchecker/LiteralExpressionTokenizer.java plugins/junit/src/com/intellij/execution/junit/JUnitConfigurationType.java plugins/spellchecker/src/com/intellij/spellchecker/tokenizer/EscapeSequenceTokenizer.java
This commit is contained in:
+11
@@ -50,9 +50,20 @@ public class EclipseCompiler extends ExternalCompiler {
|
||||
|
||||
private final Project myProject;
|
||||
private final List<File> myTempFiles = new ArrayList<File>();
|
||||
private static final String COMPILER_CLASS_NAME = "org.eclipse.jdt.core.compiler.batch.BatchCompiler";
|
||||
@NonNls private static final String PATH_TO_COMPILER_JAR = findJarPah();
|
||||
|
||||
private static String findJarPah() {
|
||||
try {
|
||||
final Class<?> aClass = Class.forName(COMPILER_CLASS_NAME);
|
||||
final String path = PathManager.getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
|
||||
if (path != null) {
|
||||
return path;
|
||||
}
|
||||
}
|
||||
catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
|
||||
File dir = new File(PathManager.getLibPath());
|
||||
File[] jars = dir.listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+190
-187
@@ -1,188 +1,191 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 24-Dec-2008
|
||||
*/
|
||||
package com.intellij.execution.actions;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.RunnerRegistry;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.testframework.*;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Getter;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AbstractRerunFailedTestsAction extends AnAction {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.junit2.ui.actions.RerunFailedTestsAction");
|
||||
private TestFrameworkRunningModel myModel;
|
||||
private Getter<TestFrameworkRunningModel> myModelProvider;
|
||||
protected TestConsoleProperties myConsoleProperties;
|
||||
protected ExecutionEnvironment myEnvironment;
|
||||
|
||||
public void init(final TestConsoleProperties consoleProperties,
|
||||
final ExecutionEnvironment environment) {
|
||||
myEnvironment = environment;
|
||||
myConsoleProperties = consoleProperties;
|
||||
}
|
||||
|
||||
public void setModel(TestFrameworkRunningModel model) {
|
||||
myModel = model;
|
||||
}
|
||||
|
||||
public void setModelProvider(Getter<TestFrameworkRunningModel> modelProvider) {
|
||||
myModelProvider = modelProvider;
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(isActive(e));
|
||||
}
|
||||
|
||||
private boolean isActive(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
if (project == null) return false;
|
||||
TestFrameworkRunningModel model = getModel();
|
||||
if (model == null || model.getRoot() == null) return false;
|
||||
List<AbstractTestProxy> failed = getFailedTests(project);
|
||||
return !failed.isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<AbstractTestProxy> getFailedTests(Project project) {
|
||||
final List<? extends AbstractTestProxy> myAllTests = getModel().getRoot().getAllTests();
|
||||
return Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project)).select(myAllTests);
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final DataContext dataContext = e.getDataContext();
|
||||
boolean isDebug = myConsoleProperties.isDebug();
|
||||
final MyRunProfile profile = getRunProfile();
|
||||
try {
|
||||
final Executor executor = isDebug ? DefaultDebugExecutor.getDebugExecutorInstance() : DefaultRunExecutor.getRunExecutorInstance();
|
||||
final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(executor.getId(), profile);
|
||||
assert runner != null;
|
||||
runner.execute(executor, new ExecutionEnvironment(runner, myEnvironment.getExecutionTarget(),
|
||||
myEnvironment.getRunnerAndConfigurationSettings(),
|
||||
myEnvironment.getProject()));
|
||||
}
|
||||
catch (ExecutionException e1) {
|
||||
LOG.error(e1);
|
||||
}
|
||||
finally {
|
||||
profile.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public MyRunProfile getRunProfile() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TestFrameworkRunningModel getModel() {
|
||||
if (myModel != null) {
|
||||
return myModel;
|
||||
}
|
||||
if (myModelProvider != null) {
|
||||
return myModelProvider.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static abstract class MyRunProfile extends RunConfigurationBase implements ModuleRunProfile{
|
||||
private final RunConfigurationBase myConfiguration;
|
||||
|
||||
public MyRunProfile(RunConfigurationBase configuration) {
|
||||
super(configuration.getProject(), configuration.getFactory(), ActionsBundle.message("action.RerunFailedTests.text"));
|
||||
myConfiguration = configuration;
|
||||
}
|
||||
|
||||
public void clear() { }
|
||||
|
||||
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {}
|
||||
|
||||
///////////////////////////////////Delegates
|
||||
public void readExternal(final Element element) throws InvalidDataException {
|
||||
myConfiguration.readExternal(element);
|
||||
}
|
||||
|
||||
public void writeExternal(final Element element) throws WriteExternalException {
|
||||
myConfiguration.writeExternal(element);
|
||||
}
|
||||
|
||||
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
|
||||
return myConfiguration.getConfigurationEditor();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ConfigurationType getType() {
|
||||
return myConfiguration.getType();
|
||||
}
|
||||
|
||||
public JDOMExternalizable createRunnerSettings(final ConfigurationInfoProvider provider) {
|
||||
return myConfiguration.createRunnerSettings(provider);
|
||||
}
|
||||
|
||||
public SettingsEditor<JDOMExternalizable> getRunnerSettingsEditor(final ProgramRunner runner) {
|
||||
return myConfiguration.getRunnerSettingsEditor(runner);
|
||||
}
|
||||
|
||||
public RunConfiguration clone() {
|
||||
return myConfiguration.clone();
|
||||
}
|
||||
|
||||
public int getUniqueID() {
|
||||
return myConfiguration.getUniqueID();
|
||||
}
|
||||
|
||||
public LogFileOptions getOptionsForPredefinedLogFile(PredefinedLogFile predefinedLogFile) {
|
||||
return myConfiguration.getOptionsForPredefinedLogFile(predefinedLogFile);
|
||||
}
|
||||
|
||||
public ArrayList<PredefinedLogFile> getPredefinedLogFiles() {
|
||||
return myConfiguration.getPredefinedLogFiles();
|
||||
}
|
||||
|
||||
public ArrayList<LogFileOptions> getAllLogFiles() {
|
||||
return myConfiguration.getAllLogFiles();
|
||||
}
|
||||
|
||||
public ArrayList<LogFileOptions> getLogFiles() {
|
||||
return myConfiguration.getLogFiles();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* User: anna
|
||||
* Date: 24-Dec-2008
|
||||
*/
|
||||
package com.intellij.execution.actions;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.RunnerRegistry;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
import com.intellij.execution.testframework.*;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Getter;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AbstractRerunFailedTestsAction extends AnAction {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.junit2.ui.actions.RerunFailedTestsAction");
|
||||
private TestFrameworkRunningModel myModel;
|
||||
private Getter<TestFrameworkRunningModel> myModelProvider;
|
||||
protected TestConsoleProperties myConsoleProperties;
|
||||
protected ExecutionEnvironment myEnvironment;
|
||||
|
||||
public void init(final TestConsoleProperties consoleProperties,
|
||||
final ExecutionEnvironment environment) {
|
||||
myEnvironment = environment;
|
||||
myConsoleProperties = consoleProperties;
|
||||
}
|
||||
|
||||
public void setModel(TestFrameworkRunningModel model) {
|
||||
myModel = model;
|
||||
}
|
||||
|
||||
public void setModelProvider(Getter<TestFrameworkRunningModel> modelProvider) {
|
||||
myModelProvider = modelProvider;
|
||||
}
|
||||
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(isActive(e));
|
||||
}
|
||||
|
||||
private boolean isActive(AnActionEvent e) {
|
||||
DataContext dataContext = e.getDataContext();
|
||||
Project project = PlatformDataKeys.PROJECT.getData(dataContext);
|
||||
if (project == null) return false;
|
||||
TestFrameworkRunningModel model = getModel();
|
||||
if (model == null || model.getRoot() == null) return false;
|
||||
List<AbstractTestProxy> failed = getFailedTests(project);
|
||||
return !failed.isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected List<AbstractTestProxy> getFailedTests(Project project) {
|
||||
final List<? extends AbstractTestProxy> myAllTests = getModel().getRoot().getAllTests();
|
||||
return Filter.FAILED_OR_INTERRUPTED.and(JavaAwareFilter.METHOD(project)).select(myAllTests);
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final DataContext dataContext = e.getDataContext();
|
||||
boolean isDebug = myConsoleProperties.isDebug();
|
||||
final MyRunProfile profile = getRunProfile();
|
||||
try {
|
||||
final Executor executor = isDebug ? DefaultDebugExecutor.getDebugExecutorInstance() : DefaultRunExecutor.getRunExecutorInstance();
|
||||
final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(executor.getId(), profile);
|
||||
assert runner != null;
|
||||
runner.execute(executor, new ExecutionEnvironment(profile,
|
||||
myEnvironment.getExecutionTarget(),
|
||||
profile.getProject(),
|
||||
myEnvironment.getRunnerSettings(),
|
||||
myEnvironment.getConfigurationSettings(),
|
||||
null));
|
||||
}
|
||||
catch (ExecutionException e1) {
|
||||
LOG.error(e1);
|
||||
}
|
||||
finally {
|
||||
profile.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public MyRunProfile getRunProfile() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public TestFrameworkRunningModel getModel() {
|
||||
if (myModel != null) {
|
||||
return myModel;
|
||||
}
|
||||
if (myModelProvider != null) {
|
||||
return myModelProvider.get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static abstract class MyRunProfile extends RunConfigurationBase implements ModuleRunProfile{
|
||||
private final RunConfigurationBase myConfiguration;
|
||||
|
||||
public MyRunProfile(RunConfigurationBase configuration) {
|
||||
super(configuration.getProject(), configuration.getFactory(), ActionsBundle.message("action.RerunFailedTests.text"));
|
||||
myConfiguration = configuration;
|
||||
}
|
||||
|
||||
public void clear() { }
|
||||
|
||||
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {}
|
||||
|
||||
///////////////////////////////////Delegates
|
||||
public void readExternal(final Element element) throws InvalidDataException {
|
||||
myConfiguration.readExternal(element);
|
||||
}
|
||||
|
||||
public void writeExternal(final Element element) throws WriteExternalException {
|
||||
myConfiguration.writeExternal(element);
|
||||
}
|
||||
|
||||
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
|
||||
return myConfiguration.getConfigurationEditor();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ConfigurationType getType() {
|
||||
return myConfiguration.getType();
|
||||
}
|
||||
|
||||
public JDOMExternalizable createRunnerSettings(final ConfigurationInfoProvider provider) {
|
||||
return myConfiguration.createRunnerSettings(provider);
|
||||
}
|
||||
|
||||
public SettingsEditor<JDOMExternalizable> getRunnerSettingsEditor(final ProgramRunner runner) {
|
||||
return myConfiguration.getRunnerSettingsEditor(runner);
|
||||
}
|
||||
|
||||
public RunConfiguration clone() {
|
||||
return myConfiguration.clone();
|
||||
}
|
||||
|
||||
public int getUniqueID() {
|
||||
return myConfiguration.getUniqueID();
|
||||
}
|
||||
|
||||
public LogFileOptions getOptionsForPredefinedLogFile(PredefinedLogFile predefinedLogFile) {
|
||||
return myConfiguration.getOptionsForPredefinedLogFile(predefinedLogFile);
|
||||
}
|
||||
|
||||
public ArrayList<PredefinedLogFile> getPredefinedLogFiles() {
|
||||
return myConfiguration.getPredefinedLogFiles();
|
||||
}
|
||||
|
||||
public ArrayList<LogFileOptions> getAllLogFiles() {
|
||||
return myConfiguration.getAllLogFiles();
|
||||
}
|
||||
|
||||
public ArrayList<LogFileOptions> getLogFiles() {
|
||||
return myConfiguration.getLogFiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,12 +101,7 @@ public class DuplicatesImpl {
|
||||
|
||||
private static boolean replaceMatch(final Project project, final MatchProvider provider, final Match match, @NotNull final Editor editor,
|
||||
final int idx, final int size, Ref<Boolean> showAll, final String confirmDuplicatePrompt) {
|
||||
final ArrayList<RangeHighlighter> highlighters = new ArrayList<RangeHighlighter>();
|
||||
highlightMatch(project, editor, match, highlighters);
|
||||
final TextRange textRange = match.getTextRange();
|
||||
final LogicalPosition logicalPosition = editor.offsetToLogicalPosition(textRange.getStartOffset());
|
||||
expandAllRegionsCoveringRange(project, editor, textRange);
|
||||
editor.getScrollingModel().scrollTo(logicalPosition, ScrollType.MAKE_VISIBLE);
|
||||
final ArrayList<RangeHighlighter> highlighters = previewMatch(project, match, editor);
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
if (size > 1 && (showAll.get() == null || !showAll.get())) {
|
||||
final String prompt = provider.getConfirmDuplicatePrompt(match);
|
||||
@@ -145,6 +140,16 @@ public class DuplicatesImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ArrayList<RangeHighlighter> previewMatch(Project project, Match match, Editor editor) {
|
||||
final ArrayList<RangeHighlighter> highlighters = new ArrayList<RangeHighlighter>();
|
||||
highlightMatch(project, editor, match, highlighters);
|
||||
final TextRange textRange = match.getTextRange();
|
||||
final LogicalPosition logicalPosition = editor.offsetToLogicalPosition(textRange.getStartOffset());
|
||||
expandAllRegionsCoveringRange(project, editor, textRange);
|
||||
editor.getScrollingModel().scrollTo(logicalPosition, ScrollType.MAKE_VISIBLE);
|
||||
return highlighters;
|
||||
}
|
||||
|
||||
private static void expandAllRegionsCoveringRange(final Project project, Editor editor, final TextRange textRange) {
|
||||
final FoldRegion[] foldRegions = CodeFoldingManager.getInstance(project).getFoldRegionsAtOffset(editor, textRange.getStartOffset());
|
||||
boolean anyCollapsed = false;
|
||||
@@ -177,9 +182,13 @@ public class DuplicatesImpl {
|
||||
public static void processDuplicates(@NotNull MatchProvider provider, @NotNull Project project, @NotNull Editor editor) {
|
||||
boolean hasDuplicates = provider.hasDuplicates();
|
||||
if (hasDuplicates) {
|
||||
List<Match> duplicates = provider.getDuplicates();
|
||||
if (duplicates.size() == 1) {
|
||||
previewMatch(project, duplicates.get(0), editor);
|
||||
}
|
||||
final int answer = Messages.showYesNoDialog(project,
|
||||
RefactoringBundle.message("0.has.detected.1.code.fragments.in.this.file.that.can.be.replaced.with.a.call.to.extracted.method",
|
||||
ApplicationNamesInfo.getInstance().getProductName(), provider.getDuplicates().size()),
|
||||
ApplicationNamesInfo.getInstance().getProductName(), duplicates.size()),
|
||||
"Process Duplicates", Messages.getQuestionIcon());
|
||||
if (answer == 0) {
|
||||
invoke(project, editor, provider);
|
||||
|
||||
Reference in New Issue
Block a user