mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+4
-4
@@ -30,12 +30,12 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class LibraryTreeStructure extends AbstractTreeStructure {
|
||||
class LibraryTreeStructure extends AbstractTreeStructure {
|
||||
private final NodeDescriptor myRootElementDescriptor;
|
||||
private final LibraryRootsComponent myParentEditor;
|
||||
private final LibraryRootsComponentDescriptor myComponentDescriptor;
|
||||
|
||||
public LibraryTreeStructure(LibraryRootsComponent parentElement, LibraryRootsComponentDescriptor componentDescriptor) {
|
||||
LibraryTreeStructure(LibraryRootsComponent parentElement, LibraryRootsComponentDescriptor componentDescriptor) {
|
||||
myParentEditor = parentElement;
|
||||
myComponentDescriptor = componentDescriptor;
|
||||
myRootElementDescriptor = new NodeDescriptor(null, null) {
|
||||
@@ -60,7 +60,7 @@ public class LibraryTreeStructure extends AbstractTreeStructure {
|
||||
public Object[] getChildElements(Object element) {
|
||||
final LibraryEditor libraryEditor = myParentEditor.getLibraryEditor();
|
||||
if (element == myRootElementDescriptor) {
|
||||
ArrayList<LibraryTableTreeContentElement> elements = new ArrayList<>(3);
|
||||
List<LibraryTableTreeContentElement> elements = new ArrayList<>(3);
|
||||
for (OrderRootType type : myComponentDescriptor.getRootTypes()) {
|
||||
final String[] urls = libraryEditor.getUrls(type);
|
||||
if (urls.length > 0) {
|
||||
@@ -77,9 +77,9 @@ public class LibraryTreeStructure extends AbstractTreeStructure {
|
||||
if (element instanceof OrderRootTypeElement) {
|
||||
OrderRootTypeElement rootTypeElement = (OrderRootTypeElement)element;
|
||||
OrderRootType orderRootType = rootTypeElement.getOrderRootType();
|
||||
ArrayList<ItemElement> items = new ArrayList<>();
|
||||
final String[] urls = libraryEditor.getUrls(orderRootType).clone();
|
||||
Arrays.sort(urls, LibraryRootsComponent.ourUrlComparator);
|
||||
List<ItemElement> items = new ArrayList<>(urls.length);
|
||||
for (String url : urls) {
|
||||
items.add(new ItemElement(rootTypeElement, url, orderRootType, libraryEditor.isJarDirectory(url, orderRootType), libraryEditor.isValid(url, orderRootType)));
|
||||
}
|
||||
|
||||
-1
@@ -64,7 +64,6 @@ public abstract class LibraryRootsComponentDescriptor {
|
||||
|
||||
/**
|
||||
* @return descriptor for the file chooser which will be shown when 'Attach Files' button is pressed
|
||||
* @param libraryName
|
||||
*/
|
||||
@NotNull
|
||||
public FileChooserDescriptor createAttachFilesChooserDescriptor(@Nullable String libraryName) {
|
||||
|
||||
+4
-3
@@ -694,7 +694,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone
|
||||
// E.g. "change(a/b/c/x.txt)" and "delete(a/b/c)" are conflicting because "a/b/c/x.txt" is under the "a/b/c" directory from the other event.
|
||||
//
|
||||
// returns index after the last grouped event.
|
||||
private static int groupByPath(@NotNull List<VFileEvent> inEvents, int startIndex, Set<String> files, Set<String> middleDirs) {
|
||||
private static int groupByPath(@NotNull List<VFileEvent> inEvents, int startIndex, @NotNull Set<String> files, @NotNull Set<String> middleDirs) {
|
||||
// store all paths from all events (including all parents)
|
||||
// check the each new event's path against this set and if it's there, this event is conflicting
|
||||
|
||||
@@ -729,7 +729,7 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone
|
||||
return i;
|
||||
}
|
||||
|
||||
private static boolean checkIfConflictingEvent(String path, Set<String> files, Set<String> middleDirs) {
|
||||
private static boolean checkIfConflictingEvent(@NotNull String path, @NotNull Set<String> files, @NotNull Set<String> middleDirs) {
|
||||
if (!files.add(path) || middleDirs.contains(path)) {
|
||||
// conflicting event found for (non-strict) descendant, stop
|
||||
return true;
|
||||
@@ -758,7 +758,8 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone
|
||||
int startIndex,
|
||||
@NotNull List<Runnable> outApplyEvents,
|
||||
@NotNull List<VFileEvent> outValidatedEvents,
|
||||
@NotNull Set<String> files, @NotNull Set<String> middleDirs) {
|
||||
@NotNull Set<String> files,
|
||||
@NotNull Set<String> middleDirs) {
|
||||
int endIndex = groupByPath(events, startIndex, files, middleDirs);
|
||||
// since all events in the group are mutually non-conflicting, we can re-arrange creations/deletions together
|
||||
groupCreations(events, startIndex, endIndex, outValidatedEvents, outApplyEvents);
|
||||
|
||||
Reference in New Issue
Block a user