Skip to content

Commit

Permalink
Fix ReadAction exceptions, remove deprecated APIs, add junit4
Browse files Browse the repository at this point in the history
  • Loading branch information
vlascik committed Nov 19, 2024
1 parent 882b2db commit 7f7d2c6
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 10 deletions.
5 changes: 3 additions & 2 deletions META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<description><![CDATA[
<h1 id="tabdir-redux">Tabdir Redux</h1>
<p>This plugin will allow you to have directory names added to tab labels, and use various ways to shorten them, including regex.</p>
<p>This is an updated and extended fork of IntelliJ plugin <strong>Tabdir</strong>, originally found on Github
<p>This is an updated and extended fork of IntelliJ plugin <strong>Tabdir</strong>, originally found on GitHub
at <a href="https://github.com/crazyproger/Tabdir">crazyproger/Tabdir</a> and IntelliJ Plugin
Marketplace <a href="https://plugins.intellij.net/plugin/?idea&amp;id=5045">here</a>.</p>
<p>You can install this fork of the plugin from the IntelliJ Marketplace <a href="https://plugins.jetbrains.com/plugin/24528-tabdir-redux">here</a>. You
Expand Down Expand Up @@ -49,11 +49,12 @@ Apply buttons). After this you will find &#39;Tabdir Project Settings&#39; confi
]]>
</description>

<version>2.0.3</version>
<version>2.0.4</version>
<vendor>Vladimir Rudev, V. Lascik</vendor>
<idea-version since-build="233.13135.103"/>
<change-notes><![CDATA[
<ul>
<li>2.0.4 Fix ReadableAction exceptions, remove deprecated APIs</li>
<li>2.0.3 Remove until-build from plugin definition</li>
<li>2.0.2 Fix more exceptions</li>
<li>2.0.1 Fix exceptions</li>
Expand Down
10 changes: 10 additions & 0 deletions Tabdir Redux.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@
<orderEntry type="library" scope="TEST" name="test" level="project" />
<orderEntry type="library" scope="RUNTIME" name="lib" level="project" />
<orderEntry type="library" name="apache.commons.text" level="project" />
<orderEntry type="module-library" scope="TEST">
<library name="JUnit4">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/junit-4.13.1.jar!/" />
<root url="jar://$MODULE_DIR$/lib/hamcrest-core-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
<component name="org.twodividedbyzero.idea.findbugs">
<option name="_basePreferences">
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<dirname property="basedir" file="${ant.file}"/>

<property file="build.properties"/>
<property name="version" value="2.0.3"/>
<property name="version" value="2.0.4"/>

<!-- If the Idea and JDK on your system are not located at the paths below,
you can specify your paths in build.properties (example in build.properties.example).
Expand Down
Binary file added lib/hamcrest-core-1.3-javadoc.jar
Binary file not shown.
Binary file added lib/hamcrest-core-1.3.jar
Binary file not shown.
Binary file added lib/junit-4.13.1-javadoc.jar
Binary file not shown.
Binary file added lib/junit-4.13.1.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package ru.crazycoder.plugins.tabdir;

import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.impl.EditorTabTitleProvider;
import com.intellij.openapi.project.Project;
Expand Down Expand Up @@ -121,7 +122,7 @@ private String getEmptyPrefix(final FolderConfiguration folderConfig) {
}

private String titleWithDiffs(final Project project, final VirtualFile file, final FolderConfiguration configuration) {
Collection<VirtualFile> similarFiles = FilenameIndex.getVirtualFilesByName(file.getName(), ProjectScope.getProjectScope(project));
Collection<VirtualFile> similarFiles = ReadAction.compute(() -> FilenameIndex.getVirtualFilesByName(file.getName(), ProjectScope.getProjectScope(project)));

if (similarFiles.size() < 2) {
return file.getPresentableName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@ public MappingEditor(final Project project, final String directory, final Map<St
relativeToTF.getChildComponent().setText(folderConfiguration.getRelativeTo());
sharedSettingsComp.setData(folderConfiguration);
configurationDirectoryTF.addActionListener(new BrowseFolderListener(project));
relativeToTF.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<>("Select Directory",
"Select directory relative to which you want see path in tab", relativeToTF, project,
new FileChooserDescriptor(false, true, false, false, false, false), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT));

relativeToTF.addActionListener(new ComponentWithBrowseButton.BrowseFolderActionListener<>(
relativeToTF,
project,
new FileChooserDescriptor(false, true, false, false, false, false).withTitle("Select Directory").withDescription("Select directory relative to which you want see path in tab"),
TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT)
);

setTitle("Folder Tabdir Configuration");
init();
}
Expand Down Expand Up @@ -84,8 +89,8 @@ private class BrowseFolderListener
private final Project project;

public BrowseFolderListener(Project project) {
super("Select Directory", "Select directory to which you want set config", configurationDirectoryTF, project,
new FileChooserDescriptor(false, true, false, false, false, false), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
super(configurationDirectoryTF, project,
new FileChooserDescriptor(false, true, false, false, false, false).withTitle("Select Directory").withDescription("Select directory to which you want set config"), TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
this.project = project;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public SharedSettingsPanel() {
dirsToShowSpinner.setModel(dirsToShowModel);
charsInNameSpinner.setModel(charsInNameModel);
//noinspection unchecked
useSwitchCB.setModel(new DefaultComboBoxModel(FolderConfiguration.UseExtensionsEnum.values()));
useSwitchCB.setModel(new DefaultComboBoxModel<>(FolderConfiguration.UseExtensionsEnum.values()));
dirSeparatorTF.getDocument().addDocumentListener(new ExampleUpdaterDocumentListener());
titleFormatTF.getDocument().addDocumentListener(new ExampleUpdaterDocumentListener());
dirsToShowSpinner.addChangeListener(new ExampleUpdaterChangeListener());
Expand Down

0 comments on commit 7f7d2c6

Please sign in to comment.