diff --git a/core.windows/src/org/netbeans/core/windows/view/EditorView.java b/core.windows/src/org/netbeans/core/windows/view/EditorView.java
--- a/core.windows/src/org/netbeans/core/windows/view/EditorView.java
+++ b/core.windows/src/org/netbeans/core/windows/view/EditorView.java
@@ -410,6 +410,11 @@
public boolean supportsKind(TopComponentDraggable transfer) {
return true;
}
+
+ @Override
+ public int getKind() {
+ return Constants.MODE_KIND_EDITOR;
+ }
} // End of EditorAreaComponent class.
diff --git a/core.windows/src/org/netbeans/core/windows/view/dnd/DragAndDropFeedbackVisualizer.java b/core.windows/src/org/netbeans/core/windows/view/dnd/DragAndDropFeedbackVisualizer.java
--- a/core.windows/src/org/netbeans/core/windows/view/dnd/DragAndDropFeedbackVisualizer.java
+++ b/core.windows/src/org/netbeans/core/windows/view/dnd/DragAndDropFeedbackVisualizer.java
@@ -165,9 +165,9 @@
dragWindow = null;
}
- public void setDropFeedback(boolean dropEnabled) {
+ public void setDropFeedback(boolean dropEnabled, boolean mixedTCDragDrop) {
if( null != dragWindow ) {
- dragWindow.setDropFeedback( dropEnabled );
+ dragWindow.setDropFeedback( dropEnabled, mixedTCDragDrop );
}
}
diff --git a/core.windows/src/org/netbeans/core/windows/view/dnd/DragWindow.java b/core.windows/src/org/netbeans/core/windows/view/dnd/DragWindow.java
--- a/core.windows/src/org/netbeans/core/windows/view/dnd/DragWindow.java
+++ b/core.windows/src/org/netbeans/core/windows/view/dnd/DragWindow.java
@@ -78,7 +78,7 @@
private BufferedImage contentImage;
private BufferedImage imageBuffer;
private float contentAlpha = 0.15f;
- private Color contentBackground = Color.white;
+ private Color contentBackground = new Color(255, 90, 0);
private Timer currentEffect;
@@ -93,7 +93,7 @@
contentImage = createContentImage( content, contentSize );
if( useFadeEffects ) {
imageBuffer = createImageBuffer( contentImage );
- currentEffect = createInitialEffect();
+ currentEffect = createEffect();
currentEffect.start();
} else {
contentAlpha = 1.0f;
@@ -170,16 +170,20 @@
}
private boolean dropEnabled = true;
- public void setDropFeedback( boolean dropEnabled ) {
+ private boolean mixedDragDrop = false;
+ public void setDropFeedback( boolean dropEnabled, boolean mixedDragDrop ) {
boolean prevState = this.dropEnabled;
this.dropEnabled = dropEnabled;
- if( prevState != this.dropEnabled ) {
+ boolean prevState2 = this.mixedDragDrop;
+ this.mixedDragDrop = mixedDragDrop;
+ if( prevState != this.dropEnabled || prevState2 != this.mixedDragDrop ) {
if( null != currentEffect ) {
currentEffect.stop();
}
if( useFadeEffects ) {
- contentBackground = Color.black;
- currentEffect = dropEnabled ? createDropEnabledEffect() : createNoDropEffect();
+ contentBackground = dropEnabled ?
+ (mixedDragDrop ? new Color(90, 255, 0) : new Color(255, 90, 0)) : Color.black;
+ currentEffect = createEffect();
currentEffect.start();
repaint();
} else {
@@ -189,33 +193,10 @@
}
}
- private Timer createInitialEffect() {
- final Timer timer = new Timer(100, null);
- timer.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- if( contentAlpha < 1.0f ) {
- contentAlpha += ALPHA_INCREMENT;
- } else {
- timer.stop();
- }
- if( contentAlpha > 1.0f )
- contentAlpha = 1.0f;
- repaintImageBuffer();
- repaint();
- }
- });
- timer.setInitialDelay(0);
- return timer;
- }
-
- private Timer createDropEnabledEffect() {
- return createInitialEffect();
- }
-
private static final float NO_DROP_ALPHA = 0.5f;
private static final float ALPHA_INCREMENT = 0.085f;
- private Timer createNoDropEffect() {
+ private Timer createEffect() {
final Timer timer = new Timer(100, null);
timer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
diff --git a/core.windows/src/org/netbeans/core/windows/view/dnd/DropTargetGlassPane.java b/core.windows/src/org/netbeans/core/windows/view/dnd/DropTargetGlassPane.java
--- a/core.windows/src/org/netbeans/core/windows/view/dnd/DropTargetGlassPane.java
+++ b/core.windows/src/org/netbeans/core/windows/view/dnd/DropTargetGlassPane.java
@@ -274,13 +274,20 @@
}
private TexturePaint texturePaint;
+ private int modeKind = -1;
private TexturePaint getIndicationPaint() {
- if( null == texturePaint ) {
+ if (droppable != null && droppable.getKind() != modeKind) {
BufferedImage image = new BufferedImage(2,2,BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
Color c = UIManager.getColor("Panel.dropTargetGlassPane");
if (c == null) {
c = new Color(255, 90, 0);
+ if ((droppable.getKind() == Constants.MODE_KIND_EDITOR
+ && windowDragAndDrop.getStartingTransfer().getKind() != Constants.MODE_KIND_EDITOR) ||
+ (droppable.getKind() != Constants.MODE_KIND_EDITOR
+ && windowDragAndDrop.getStartingTransfer().getKind() == Constants.MODE_KIND_EDITOR)) {
+ c = new Color(90, 255, 0);
+ }
}
g2.setColor(c);
g2.fillRect(0,0,1,1);
@@ -290,6 +297,7 @@
g2.fillRect(1,0,1,1);
g2.fillRect(0,1,1,1);
texturePaint = new TexturePaint(image, new Rectangle(0,0,2,2));
+ modeKind = droppable.getKind();
}
return texturePaint;
}
diff --git a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java b/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java
--- a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java
+++ b/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDragSupport.java
@@ -678,8 +678,9 @@
* It plays its role. Sets the cursor from 'no-drop' state
* to its 'drop' state sibling.
* @param freeArea true when mouse pointer in free screen area
+ * @param mixedDragDrop true when document and non-document top components are about to be mixed
* @see #dragEnter */
- void setSuccessCursor (boolean freeArea) {
+ void setSuccessCursor (boolean freeArea, boolean mixedDragDrop) {
int dropAction = hackUserDropAction;
DragSourceContext ctx = dragContextWRef.get();
@@ -688,7 +689,7 @@
}
if( null != visualizer )
- visualizer.setDropFeedback( true );
+ visualizer.setDropFeedback( true, mixedDragDrop );
dropFailed = false;
@@ -720,8 +721,9 @@
/** Hacks problems with dragExit
wrong method calls.
* It plays its role. Sets the cursor from 'drop' state
* to its 'no-drop' state sibling.
+ * @param mixedDragDrop true when document and non-document top components are about to be mixed
* @see #dragExit */
- void setUnsuccessCursor() {
+ void setUnsuccessCursor(boolean mixedDragDrop) {
DragSourceContext ctx = dragContextWRef.get();
if(ctx == null) {
@@ -729,7 +731,7 @@
}
if( null != visualizer )
- visualizer.setDropFeedback( false );
+ visualizer.setDropFeedback( false, mixedDragDrop );
String name = ctx.getCursor().getName();
diff --git a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDroppable.java b/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDroppable.java
--- a/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDroppable.java
+++ b/core.windows/src/org/netbeans/core/windows/view/dnd/TopComponentDroppable.java
@@ -90,4 +90,10 @@
/** Checks whether this droppable supports kind of winsys transfer.
* Either Constants.MODE_KIND_EDITOR
or Constants.MODE_KIND_VIEW or both. */
public boolean supportsKind(TopComponentDraggable transfer);
+
+ /**
+ * @return Mode kind of the originating mode when just a single TopComponent
+ * is being dragged or the kind of the mode that is being dragged.
+ */
+ public int getKind();
}
diff --git a/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java b/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java
--- a/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java
+++ b/core.windows/src/org/netbeans/core/windows/view/dnd/WindowDnDManager.java
@@ -695,6 +695,21 @@
return false;
}
+ /** Indicates whether document and non-document top components are about to be mixed
+ * when transfer drops into droppable.
+ */
+ static boolean isMixedTCDragDrop(TopComponentDraggable transfer, TopComponentDroppable droppable) {
+ if (transfer != null && droppable != null) {
+ if ((droppable.getKind() == Constants.MODE_KIND_EDITOR
+ && transfer.getKind() != Constants.MODE_KIND_EDITOR)
+ || (droppable.getKind() != Constants.MODE_KIND_EDITOR
+ && transfer.getKind() == Constants.MODE_KIND_EDITOR)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/** Indicates whether the cursor is around the editor area of the main window.
* In that case is needed also to provide a drop. */
static boolean isNearEditorEdge(Point location, ViewAccessor viewAccessor, int kind) {
@@ -1018,7 +1033,8 @@
&& windowDnDManager.startingTransfer.isUndockingEnabled();
boolean isAroundCenterPanel
= isAroundCenterPanel(location);
-
+ boolean isMixedTCDragDrop = isMixedTCDragDrop(windowDnDManager.startingTransfer, windowDnDManager.findDroppableFromScreen(windowDnDManager.getFloatingFrames(), location, windowDnDManager.startingTransfer));
+
if(isInMainDroppable || isInFrameDroppable || isAroundCenterPanel) {
TopComponentDroppable droppable
= windowDnDManager.findDroppableFromScreen(windowDnDManager.getFloatingFrames(), location, windowDnDManager.startingTransfer);
@@ -1027,9 +1043,9 @@
if (droppable instanceof FreeAreaDroppable) {
if(WindowManagerImpl.getInstance().getEditorAreaState() == Constants.EDITOR_AREA_SEPARATED
&& droppable.canDrop(windowDnDManager.startingTransfer, location)) {
- topComponentDragSupport.setSuccessCursor(true);
+ topComponentDragSupport.setSuccessCursor(true, isMixedTCDragDrop);
} else {
- topComponentDragSupport.setUnsuccessCursor();
+ topComponentDragSupport.setUnsuccessCursor(isMixedTCDragDrop);
}
// for the status bar it's null somehow, workarounding by checking for null.. should go away..
} else if (droppable != null) {
@@ -1043,22 +1059,22 @@
Point p = new Point(location);
SwingUtilities.convertPointFromScreen(p, droppable.getDropComponent());
if(droppable.canDrop(windowDnDManager.startingTransfer, p)) {
- topComponentDragSupport.setSuccessCursor(false);
+ topComponentDragSupport.setSuccessCursor(false, isMixedTCDragDrop);
} else {
- topComponentDragSupport.setUnsuccessCursor();
+ topComponentDragSupport.setUnsuccessCursor(isMixedTCDragDrop);
}
dragOverDropTarget(location, droppable);
}
} else if(!isInMainWindow(location)
&& windowDnDManager.isInFloatingFrame(location)) {
// Simulates success drop in free area.
- topComponentDragSupport.setSuccessCursor(false);
+ topComponentDragSupport.setSuccessCursor(false, isMixedTCDragDrop);
} else if(isInFreeArea(location, fakeWindow)
&& getFreeAreaDroppable(location).canDrop(windowDnDManager.startingTransfer, location)
&& windowDnDManager.startingTransfer.isUndockingEnabled()) {
- topComponentDragSupport.setSuccessCursor(true);
+ topComponentDragSupport.setSuccessCursor(true, isMixedTCDragDrop);
} else {
- topComponentDragSupport.setUnsuccessCursor();
+ topComponentDragSupport.setUnsuccessCursor(isMixedTCDragDrop);
}
if(!isInMainDroppable && !isInFrameDroppable && !isAroundCenterPanel) {
@@ -1193,6 +1209,10 @@
return transfer.getKind() == Constants.MODE_KIND_VIEW || transfer.getKind() == Constants.MODE_KIND_SLIDING;
}
+ @Override
+ public int getKind() {
+ return Constants.MODE_KIND_VIEW;
+ }
} // End of class CenterPanelDroppable.
@@ -1276,6 +1296,10 @@
return transfer.getKind() == Constants.MODE_KIND_EDITOR;
}
+ @Override
+ public int getKind() {
+ return Constants.MODE_KIND_EDITOR;
+ }
} // End of class EditorAreaDroppable.
@@ -1337,6 +1361,11 @@
return true;
}
+ @Override
+ public int getKind() {
+ return Constants.MODE_KIND_VIEW;
+ }
+
} // End of class FreeAreaDroppable.
/**
@@ -1533,6 +1562,11 @@
}
return rect;
}
+
+ @Override
+ public int getKind() {
+ return Constants.MODE_KIND_SLIDING;
+ }
}
}