mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-167018 Cannot drag-and-drop in a just opened project until no files are opened in editor
this redoes fix for IDEA-67763/IDEA-133381 (commit d363916), bringing back FileDropHandler for EditorSplitters,
so that now there are instances of FileDropHandler both for EditorSplitters and JBEditorTabs
This commit is contained in:
+23
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 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.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.impl.text.FileDropHandler;
|
||||
import com.intellij.openapi.keymap.KeymapManager;
|
||||
import com.intellij.openapi.keymap.KeymapManagerListener;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
@@ -59,6 +60,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.DataFlavor;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.ContainerEvent;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
@@ -87,6 +90,7 @@ public class EditorsSplitters extends IdePanePanel implements UISettingsListener
|
||||
myManager = manager;
|
||||
myFocusWatcher = new MyFocusWatcher();
|
||||
setFocusTraversalPolicy(new MyFocusTraversalPolicy());
|
||||
setTransferHandler(new MyTransferHandler());
|
||||
clear();
|
||||
|
||||
if (createOwnDockableContainer) {
|
||||
@@ -760,6 +764,24 @@ public class EditorsSplitters extends IdePanePanel implements UISettingsListener
|
||||
}
|
||||
}
|
||||
|
||||
private final class MyTransferHandler extends TransferHandler {
|
||||
private final FileDropHandler myFileDropHandler = new FileDropHandler(null);
|
||||
|
||||
@Override
|
||||
public boolean importData(JComponent comp, Transferable t) {
|
||||
if (myFileDropHandler.canHandleDrop(t.getTransferDataFlavors())) {
|
||||
myFileDropHandler.handleDrop(t, myManager.getProject(), myCurrentWindow);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) {
|
||||
return myFileDropHandler.canHandleDrop(transferFlavors);
|
||||
}
|
||||
}
|
||||
|
||||
private abstract static class ConfigTreeReader<T> {
|
||||
@Nullable
|
||||
public T process(@Nullable Element element, @Nullable T context) {
|
||||
|
||||
Reference in New Issue
Block a user