mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Textmate: chooser should use last added bundle path as a starting point
GitOrigin-RevId: fde4a0fd7c4c593f2fa9c8be2ef2e8fd4f2fdc43
This commit is contained in:
committed by
intellij-monorepo-bot
parent
af7464a887
commit
d43e4a66a3
+7
-9
@@ -1,5 +1,6 @@
|
||||
package org.jetbrains.plugins.textmate.configuration;
|
||||
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
@@ -28,6 +29,7 @@ import static org.jetbrains.plugins.textmate.TextMateServiceImpl.INSTALLED_BUNDL
|
||||
import static org.jetbrains.plugins.textmate.TextMateServiceImpl.PREINSTALLED_BUNDLES_PATH;
|
||||
|
||||
public class TextMateBundlesListPanel implements Disposable {
|
||||
private static final String TEXTMATE_LAST_ADDED_BUNDLE = "textmate.last.added.bundle";
|
||||
private final CheckBoxList<BundleConfigBean> myBundlesList;
|
||||
private Collection<TextMateBundlesChangeStateListener> myListeners = new ArrayList<>();
|
||||
|
||||
@@ -77,10 +79,6 @@ public class TextMateBundlesListPanel implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
public void addChangeStateListener(TextMateBundlesChangeStateListener listener) {
|
||||
myListeners.add(listener);
|
||||
}
|
||||
|
||||
public JPanel createMainComponent() {
|
||||
return createDecorator(myBundlesList).setRemoveAction(new AnActionButtonRunnable() {
|
||||
@Override
|
||||
@@ -106,9 +104,9 @@ public class TextMateBundlesListPanel implements Disposable {
|
||||
VirtualFile fileToSelect = null;
|
||||
final int itemsCount = myBundlesList.getItemsCount();
|
||||
if (itemsCount > 0) {
|
||||
BundleConfigBean lastAddedBundle = myBundlesList.getItemAt(itemsCount - 1);
|
||||
if (lastAddedBundle != null) {
|
||||
fileToSelect = LocalFileSystem.getInstance().findFileByPath(lastAddedBundle.getPath());
|
||||
String lastAddedBundle = PropertiesComponent.getInstance().getValue(TEXTMATE_LAST_ADDED_BUNDLE);
|
||||
if (StringUtil.isNotEmpty(lastAddedBundle)) {
|
||||
fileToSelect = LocalFileSystem.getInstance().findFileByPath(lastAddedBundle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,8 +114,8 @@ public class TextMateBundlesListPanel implements Disposable {
|
||||
if (bundleDirectories.length > 0) {
|
||||
StringBuilder errorMessage = new StringBuilder();
|
||||
for (final VirtualFile bundleDirectory : bundleDirectories) {
|
||||
final ThrowableComputable<Bundle, Exception> readBundleProcess =
|
||||
() -> TextMateService.getInstance().createBundle(bundleDirectory);
|
||||
PropertiesComponent.getInstance().setValue(TEXTMATE_LAST_ADDED_BUNDLE, bundleDirectory.getPath());
|
||||
ThrowableComputable<Bundle, Exception> readBundleProcess = () -> TextMateService.getInstance().createBundle(bundleDirectory);
|
||||
Bundle bundle = null;
|
||||
try {
|
||||
bundle = ProgressManager.getInstance().runProcessWithProgressSynchronously(readBundleProcess, "Add Bundle", true, null);
|
||||
|
||||
Reference in New Issue
Block a user