mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -66,10 +66,7 @@ import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.usages.impl.UsagePreviewPanel;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -1511,12 +1508,22 @@ public class FindDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
private void navigateToSelectedUsage(JBTable source) {
|
||||
int row = source.getSelectedRow();
|
||||
Object valueAt = source.getModel().getValueAt(row, 0);
|
||||
if (valueAt instanceof Usage) {
|
||||
int[] rows = source.getSelectedRows();
|
||||
List<Usage> navigations = null;
|
||||
for(int row:rows) {
|
||||
Object valueAt = source.getModel().getValueAt(row, 0);
|
||||
if (valueAt instanceof Usage) {
|
||||
if (navigations == null) navigations = new SmartList<Usage>();
|
||||
Usage at = (Usage)valueAt;
|
||||
navigations.add(at);
|
||||
}
|
||||
}
|
||||
|
||||
if (navigations != null) {
|
||||
applyTo(FindManager.getInstance(myProject).getFindInProjectModel(), false);
|
||||
doCancelAction();
|
||||
((Usage)valueAt).navigate(true);
|
||||
navigations.get(0).navigate(true);
|
||||
for(int i = 1; i < navigations.size(); ++i) navigations.get(i).highlightInEditor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,17 +38,14 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.io.FileUtilRt;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.io.ZipUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -146,19 +143,33 @@ public class ImportSettingsAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<ExportableComponent> getComponentsStored(@NotNull File zipFile,
|
||||
private static List<ExportableComponent> getComponentsStored(@NotNull File settings,
|
||||
@NotNull Collection<? extends ExportableComponent> registeredComponents) throws IOException {
|
||||
THashSet<String> zipEntries = new THashSet<String>();
|
||||
ZipFile zip = new ZipFile(settings);
|
||||
try {
|
||||
Enumeration enumeration = zip.entries();
|
||||
while (enumeration.hasMoreElements()) {
|
||||
ZipEntry zipEntry = (ZipEntry)enumeration.nextElement();
|
||||
zipEntries.add(zipEntry.getName());
|
||||
}
|
||||
}
|
||||
finally {
|
||||
zip.close();
|
||||
}
|
||||
|
||||
File configPath = new File(PathManager.getConfigPath());
|
||||
List<ExportableComponent> components = new ArrayList<ExportableComponent>();
|
||||
|
||||
for (ExportableComponent component : registeredComponents) {
|
||||
for (File exportFile : component.getExportFiles()) {
|
||||
String rPath = FileUtilRt.getRelativePath(configPath, exportFile);
|
||||
assert rPath != null;
|
||||
String relativePath = FileUtilRt.toSystemIndependentName(rPath);
|
||||
if (exportFile.isDirectory()) {
|
||||
String relativePath = FileUtilRt.getRelativePath(configPath, exportFile);
|
||||
assert relativePath != null;
|
||||
relativePath = FileUtilRt.toSystemIndependentName(relativePath);
|
||||
if (exportFile.getName().indexOf('.') == -1 && !exportFile.isFile()) {
|
||||
relativePath += '/';
|
||||
}
|
||||
if (ZipUtil.isZipContainsEntry(zipFile, relativePath)) {
|
||||
if (zipEntries.contains(relativePath)) {
|
||||
components.add(component);
|
||||
break;
|
||||
}
|
||||
|
||||
+12
-8
@@ -103,16 +103,21 @@ public abstract class ComponentStoreImpl implements IComponentStore.Reloadable {
|
||||
}
|
||||
}
|
||||
|
||||
List<Throwable> errors = null;
|
||||
for (SettingsSavingComponent settingsSavingComponent : mySettingsSavingComponents) {
|
||||
try {
|
||||
settingsSavingComponent.save();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
if (errors == null) {
|
||||
errors = new SmartList<Throwable>();
|
||||
}
|
||||
errors.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
doSave(externalizationSession == null ? null : externalizationSession.createSaveSessions(), readonlyFiles);
|
||||
errors = doSave(externalizationSession == null ? null : externalizationSession.createSaveSessions(), readonlyFiles, errors);
|
||||
CompoundRuntimeException.doThrow(errors);
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@@ -143,7 +148,7 @@ public abstract class ComponentStoreImpl implements IComponentStore.Reloadable {
|
||||
AccessToken token = WriteAction.start();
|
||||
try {
|
||||
VfsRootAccess.allowRootAccess(file.getAbsolutePath());
|
||||
doSave(sessions, Collections.<Pair<SaveSession, VirtualFile>>emptyList());
|
||||
CompoundRuntimeException.doThrow(doSave(sessions, Collections.<Pair<SaveSession, VirtualFile>>emptyList(), null));
|
||||
}
|
||||
finally {
|
||||
try {
|
||||
@@ -173,16 +178,15 @@ public abstract class ComponentStoreImpl implements IComponentStore.Reloadable {
|
||||
}
|
||||
}
|
||||
|
||||
protected void doSave(@Nullable List<SaveSession> saveSessions, @NotNull List<Pair<SaveSession, VirtualFile>> readonlyFiles) {
|
||||
@Nullable
|
||||
protected List<Throwable> doSave(@Nullable List<SaveSession> saveSessions, @NotNull List<Pair<SaveSession, VirtualFile>> readonlyFiles, @Nullable List<Throwable> errors) {
|
||||
if (saveSessions != null) {
|
||||
List<Throwable> errors = null;
|
||||
for (SaveSession session : saveSessions) {
|
||||
errors = executeSave(session, readonlyFiles, errors);
|
||||
}
|
||||
if (errors != null) {
|
||||
throw new CompoundRuntimeException(errors);
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+5
-4
@@ -445,7 +445,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void doSave(@Nullable List<SaveSession> saveSessions, @NotNull List<Pair<SaveSession, VirtualFile>> readonlyFiles) {
|
||||
protected final List<Throwable> doSave(@Nullable List<SaveSession> saveSessions, @NotNull List<Pair<SaveSession, VirtualFile>> readonlyFiles, @Nullable List<Throwable> errors) {
|
||||
ProjectImpl.UnableToSaveProjectNotification[] notifications =
|
||||
NotificationsManager.getNotificationsManager().getNotificationsOfType(ProjectImpl.UnableToSaveProjectNotification.class, myProject);
|
||||
if (notifications.length > 0) {
|
||||
@@ -454,7 +454,7 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
|
||||
beforeSave(readonlyFiles);
|
||||
|
||||
super.doSave(saveSessions, readonlyFiles);
|
||||
super.doSave(saveSessions, readonlyFiles, errors);
|
||||
|
||||
if (!readonlyFiles.isEmpty()) {
|
||||
ReadonlyStatusHandler.OperationStatus status;
|
||||
@@ -473,13 +473,12 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
else {
|
||||
List<Pair<SaveSession, VirtualFile>> oldList = new ArrayList<Pair<SaveSession, VirtualFile>>(readonlyFiles);
|
||||
readonlyFiles.clear();
|
||||
List<Throwable> errors = null;
|
||||
for (Pair<SaveSession, VirtualFile> entry : oldList) {
|
||||
errors = executeSave(entry.first, readonlyFiles, errors);
|
||||
}
|
||||
|
||||
if (errors != null) {
|
||||
throw new CompoundRuntimeException(errors);
|
||||
CompoundRuntimeException.doThrow(errors);
|
||||
}
|
||||
|
||||
if (!readonlyFiles.isEmpty()) {
|
||||
@@ -488,6 +487,8 @@ class ProjectStoreImpl extends BaseFileConfigurableStoreImpl implements IProject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
protected void beforeSave(@NotNull List<Pair<SaveSession, VirtualFile>> readonlyFiles) {
|
||||
|
||||
+10
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -22,7 +22,9 @@ import com.intellij.openapi.components.SettingsSavingComponent;
|
||||
import com.intellij.openapi.components.impl.stores.StateStorageManager;
|
||||
import com.intellij.openapi.components.impl.stores.StreamProvider;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.lang.CompoundRuntimeException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -60,13 +62,19 @@ final class SchemesManagerFactoryImpl extends SchemesManagerFactory implements S
|
||||
|
||||
@Override
|
||||
public void save() {
|
||||
List<Throwable> errors = null;
|
||||
for (SchemesManager registeredManager : myRegisteredManagers) {
|
||||
try {
|
||||
registeredManager.save();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error("Cannot save settings for " + registeredManager.getClass().getName(), e);
|
||||
if (errors == null) {
|
||||
errors = new SmartList<Throwable>();
|
||||
}
|
||||
errors.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
CompoundRuntimeException.doThrow(errors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package com.intellij.openapi.options;
|
||||
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.DecodeDefaultsUtil;
|
||||
import com.intellij.openapi.components.RoamingType;
|
||||
@@ -46,6 +45,7 @@ import com.intellij.util.SmartList;
|
||||
import com.intellij.util.ThrowableConvertor;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import com.intellij.util.io.URLUtil;
|
||||
import com.intellij.util.lang.CompoundRuntimeException;
|
||||
import com.intellij.util.text.UniqueNameGenerator;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jdom.Document;
|
||||
@@ -517,27 +517,22 @@ public class SchemesManagerImpl<T extends Scheme, E extends ExternalizableScheme
|
||||
return;
|
||||
}
|
||||
|
||||
for (final E scheme : schemesToSave) {
|
||||
List<Throwable> errors = null;
|
||||
for (E scheme : schemesToSave) {
|
||||
try {
|
||||
saveScheme(scheme, nameGenerator);
|
||||
}
|
||||
catch (final Exception e) {
|
||||
Application app = ApplicationManager.getApplication();
|
||||
if (app.isUnitTestMode() || app.isCommandLine()) {
|
||||
LOG.error("Cannot write scheme " + scheme.getName() + " in '" + myFileSpec + "': " + e.getLocalizedMessage(), e);
|
||||
}
|
||||
else {
|
||||
app.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Messages.showErrorDialog("Cannot save scheme '" + scheme.getName() + ": " + e.getMessage(), "Save Settings");
|
||||
}
|
||||
});
|
||||
catch (Throwable e) {
|
||||
if (errors == null) {
|
||||
errors = new SmartList<Throwable>();
|
||||
}
|
||||
errors.add(e);
|
||||
}
|
||||
}
|
||||
|
||||
deleteFiles(dir);
|
||||
|
||||
CompoundRuntimeException.doThrow(errors);
|
||||
}
|
||||
|
||||
private void saveScheme(@NotNull E scheme, @NotNull UniqueNameGenerator nameGenerator) throws WriteExternalException, IOException {
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package com.intellij.util.lang;
|
||||
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
@@ -34,7 +36,6 @@ public class CompoundRuntimeException extends RuntimeException {
|
||||
myThrowables = throwables;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void printStackTrace(PrintStream s) {
|
||||
for (Throwable throwable : myThrowables) {
|
||||
@@ -50,17 +51,25 @@ public class CompoundRuntimeException extends RuntimeException {
|
||||
}
|
||||
}
|
||||
|
||||
public static void doThrow(@NotNull List<Throwable> throwables) {
|
||||
public static void doThrow(@Nullable List<Throwable> throwables) {
|
||||
if (ContainerUtil.isEmpty(throwables)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (throwables.size() == 1) {
|
||||
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
|
||||
Throwable throwable = throwables.get(0);
|
||||
if (throwable instanceof RuntimeException) {
|
||||
throw (RuntimeException)throwable;
|
||||
}
|
||||
if (throwable instanceof Error) {
|
||||
throw (Error)throwable;
|
||||
}
|
||||
else if (throwable instanceof RuntimeException) {
|
||||
throw (RuntimeException)throwable;
|
||||
}
|
||||
else {
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new CompoundRuntimeException(throwables);
|
||||
}
|
||||
throw new CompoundRuntimeException(throwables);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<id>com.intellij.commander</id>
|
||||
<name>Commander</name>
|
||||
<description>Provides a two-panel view for navigating and working with the project structure</description>
|
||||
<version>1.0.0</version>
|
||||
<version>999.999</version>
|
||||
<idea-version since-build="142.1" until-build="143.0"/>
|
||||
<vendor url="https://www.jetbrains.com">JetBrains</vendor>
|
||||
<resource-bundle>com.intellij.ide.commander.CommanderBundle</resource-bundle>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user