• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DnDEvent类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.intellij.ide.dnd.DnDEvent的典型用法代码示例。如果您正苦于以下问题:Java DnDEvent类的具体用法?Java DnDEvent怎么用?Java DnDEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DnDEvent类属于com.intellij.ide.dnd包,在下文中一共展示了DnDEvent类的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: update

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent aEvent) {
  aEvent.setDropPossible(false);
  aEvent.hideHighlighter();
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final DefaultMutableTreeNode parent = findParentCompositeElementNode(aEvent.getRelativePoint().getPoint(myTree));
    if (parent != null) {
      final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
      final PackagingElementNode node = getNode(parent);
      if (node != null && draggingObject.canDropInto(node)) {
        final PackagingElement element = node.getFirstElement();
        if (element instanceof CompositePackagingElement) {
          draggingObject.setTargetNode(node);
          draggingObject.setTargetElement((CompositePackagingElement<?>)element);
          final Rectangle bounds = myTree.getPathBounds(TreeUtil.getPathFromRoot(parent));
          aEvent.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
          aEvent.setDropPossible(true);
        }
      }
    }
  }
  return false;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:25,
代码来源:LayoutTreeComponent.java

示例2: drop

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent aEvent) {
  Object object = aEvent.getAttachedObject();
  if (object instanceof XValueNodeImpl[]) {
    final XValueNodeImpl[] nodes = (XValueNodeImpl[])object;
    for (XValueNodeImpl node : nodes) {
      node.getValueContainer().calculateEvaluationExpression().done(new Consumer<XExpression>() {
        @Override
        public void consume(XExpression expression) {
          if (expression != null) {
            //noinspection ConstantConditions
            addWatchExpression(expression, -1, false);
          }
        }
      });
    }
  }
  else if (object instanceof EventInfo) {
    String text = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor);
    if (text != null) {
      //noinspection ConstantConditions
      addWatchExpression(XExpressionImpl.fromText(text), -1, false);
    }
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:26,
代码来源:XWatchesViewImpl.java

示例3: drop

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent event) {
  final Object attached = event.getAttachedObject();
  final TreeNode[] sourceNodes = getSourceNodes(attached);
  final TreeNode targetNode = getTargetNode(event.getPoint());
  assert targetNode != null;
  final int dropAction = event.getAction().getActionId();
  if (sourceNodes == null) {
    if (FileCopyPasteUtil.isFileListFlavorAvailable(event)) {
      List<File> fileList = FileCopyPasteUtil.getFileListFromAttachedObject(attached);
      if (!fileList.isEmpty()) {
        getDropHandler(dropAction).doDropFiles(fileList, targetNode);
      }
    }
  }
  else {
    doDrop(sourceNodes, targetNode, dropAction);
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:20,
代码来源:ProjectViewDropTarget.java

示例4: drop

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
public void drop(final DnDEvent aEvent) {
  Object object = aEvent.getAttachedObject();
  if (object instanceof XValueNodeImpl[]) {
    final XValueNodeImpl[] nodes = (XValueNodeImpl[])object;
    for (XValueNodeImpl node : nodes) {
      String expression = node.getValueContainer().getEvaluationExpression();
      if (expression != null) {
        addWatchExpression(expression, -1, false);
      }
    }
  }
  else if (object instanceof EventInfo) {
    String text = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor);
    if (text != null) {
      addWatchExpression(text, -1, false);
    }
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:19,
代码来源:XWatchesView.java

示例5: drop

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent event) {
  final Object attached = event.getAttachedObject();
  final TreeNode[] sourceNodes = getSourceNodes(attached);
  final TreeNode targetNode = getTargetNode(event.getPoint());
  assert targetNode != null;
  final int dropAction = event.getAction().getActionId();
  if (sourceNodes == null) {
    if (FileCopyPasteUtil.isFileListFlavorSupported(event)) {
      List<File> fileList = FileCopyPasteUtil.getFileListFromAttachedObject(attached);
      if (!fileList.isEmpty()) {
        getDropHandler(dropAction).doDropFiles(fileList, targetNode);
      }
    }
  }
  else {
    doDrop(sourceNodes, targetNode, dropAction);
  }
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:20,
代码来源:ProjectViewDropTarget.java

示例6: drop

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
public void drop(DnDEvent aEvent)
{
	if(!(aEvent.getAttachedObject() instanceof MyDragBean))
	{
		return;
	}
	MyDragBean dragBean = (MyDragBean) aEvent.getAttachedObject();
	int targetCell = getDropGridLine(aEvent);
	if(targetCell < 0)
	{
		return;
	}
	mySelectedContainer.getGridLayoutManager().processCellsMoved(mySelectedContainer, myIsRow, dragBean.cells, targetCell);
	mySelectionModel.clearSelection();
	mySelectedContainer.revalidate();
	myEditor.refreshAndSave(true);
	cleanUpOnLeave();
}
 

开发者ID:consulo,
项目名称:consulo-ui-designer,
代码行数:19,
代码来源:GridCaptionPanel.java

示例7: update

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent aEvent)
{
	setHoverIndex(-1);
	if(aEvent.getAttachedObject() instanceof PaletteItem)
	{
		setDropTargetIndex(locationToTargetIndex(aEvent.getPoint()));
		aEvent.setDropPossible(true);
	}
	else
	{
		setDropTargetIndex(-1);
		aEvent.setDropPossible(false);
	}
	return false;
}
 

开发者ID:consulo,
项目名称:consulo-ui-designer,
代码行数:17,
代码来源:PaletteComponentList.java

示例8: update

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(final DnDEvent aEvent) {
  Object object = aEvent.getAttachedObject();
  boolean possible = false;
  if (object instanceof XValueNodeImpl[]) {
    possible = true;
    // do not add new watch if node is dragged to itself
    if (((XValueNodeImpl[])object).length == 1) {
      Point point = aEvent.getPoint();
      XDebuggerTree tree = getTree();
      TreePath path = tree.getClosestPathForLocation(point.x, point.y);
      if (path != null && path.getLastPathComponent() == ((XValueNodeImpl[])object)[0]) {
        // the same item is under pointer, filter out place below the tree
        Rectangle pathBounds = tree.getPathBounds(path);
        possible = pathBounds != null && pathBounds.y + pathBounds.height < point.y;
      }
    }
  }
  else if (object instanceof EventInfo) {
    possible = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor) != null;
  }

  aEvent.setDropPossible(possible, XDebuggerBundle.message("xdebugger.drop.text.add.to.watches"));

  return true;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:27,
代码来源:XWatchesViewImpl.java

示例9: drop

点赞 3

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent aEvent) {
  Object object = aEvent.getAttachedObject();
  if (object instanceof XValueNodeImpl[]) {
    final XValueNodeImpl[] nodes = (XValueNodeImpl[])object;
    for (XValueNodeImpl node : nodes) {
      node.getValueContainer().calculateEvaluationExpression().doWhenDone(expression -> {
        if (expression != null) {
          //noinspection ConstantConditions
          addWatchExpression(expression, -1, false);
        }
      });
    }
  }
  else if (object instanceof EventInfo) {
    String text = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor);
    if (text != null) {
      //noinspection ConstantConditions
      addWatchExpression(XExpressionImpl.fromText(text), -1, false);
    }
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:23,
代码来源:XWatchesViewImpl.java

示例10: drop

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent aEvent) {
  final Object object = aEvent.getAttachedObject();
  if (object instanceof PackagingElementDraggingObject) {
    final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject)object;
    final PackagingElementNode<?> targetNode = draggingObject.getTargetNode();
    final CompositePackagingElement<?> targetElement = draggingObject.getTargetElement();
    if (targetElement == null || targetNode == null || !draggingObject.checkCanDrop()) return;
    if (!checkCanAdd(targetElement, targetNode)) {
      return;
    }
    final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
    editLayout(new Runnable() {
      @Override
      public void run() {
        draggingObject.beforeDrop();
        final CompositePackagingElement<?> parent = getOrCreateModifiableParent(targetElement, targetNode);
        for (PackagingElement<?> element : draggingObject.createPackagingElements(myContext)) {
          toSelect.add(element);
          parent.addOrFindChild(element);
        }
      }
    });
    updateAndSelect(targetNode, toSelect);
    myArtifactsEditor.getSourceItemsTree().rebuildTree();
  }
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:28,
代码来源:LayoutTreeComponent.java

示例11: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(final DnDEvent aEvent) {
  Object object = aEvent.getAttachedObject();
  boolean possible = false;
  if (object instanceof XValueNodeImpl[]) {
    possible = true;
  }
  else if (object instanceof EventInfo) {
    possible = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor) != null;
  }

  aEvent.setDropPossible(possible, XDebuggerBundle.message("xdebugger.drop.text.add.to.watches"));

  return true;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:16,
代码来源:XWatchesViewImpl.java

示例12: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent anEvent) {
  applicableDropCount = 0;
  dropOrPrepareToDrop(anEvent, false);
  anEvent.setDropPossible(applicableDropCount > 0);
  return false;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:8,
代码来源:NavigationView.java

示例13: JBTabbedTerminalWidget

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
public JBTabbedTerminalWidget(@NotNull Project project,
                              @NotNull JBTerminalSystemSettingsProvider settingsProvider,
                              final @NotNull Predicate<Pair<TerminalWidget, String>> createNewSessionAction, @NotNull Disposable parent) {
  super(settingsProvider, new Predicate<TerminalWidget>() {
    @Override
    public boolean apply(TerminalWidget input) {
      return createNewSessionAction.apply(Pair.<TerminalWidget, String>create(input, null));
    }
  });
  myProject = project;

  mySettingsProvider = settingsProvider;
  myParent = parent;

  convertActions(this, getActions());

  Disposer.register(parent, this);
  Disposer.register(this, settingsProvider);

  DnDSupport.createBuilder(this).setDropHandler(new DnDDropHandler() {
    @Override
    public void drop(DnDEvent event) {
      if (event.getAttachedObject() instanceof TransferableWrapper) {
        TransferableWrapper ao = (TransferableWrapper)event.getAttachedObject();
        if (ao != null &&
            ao.getPsiElements() != null &&
            ao.getPsiElements().length == 1 &&
            ao.getPsiElements()[0] instanceof PsiFileSystemItem) {
          PsiFileSystemItem element = (PsiFileSystemItem)ao.getPsiElements()[0];
          PsiDirectory dir = element instanceof PsiFile ? ((PsiFile)element).getContainingDirectory() : (PsiDirectory)element;

          createNewSessionAction.apply(Pair.<TerminalWidget, String>create(JBTabbedTerminalWidget.this, dir.getVirtualFile().getPath()));
        }
      }
    }
  }

  ).install();
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:40,
代码来源:JBTabbedTerminalWidget.java

示例14: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
public boolean update(final DnDEvent aEvent) {
  Object object = aEvent.getAttachedObject();
  boolean possible = false;
  if (object instanceof XValueNodeImpl[]) {
    possible = true;
  }
  else if (object instanceof EventInfo) {
    possible = ((EventInfo)object).getTextForFlavor(DataFlavor.stringFlavor) != null;
  }

  aEvent.setDropPossible(possible, XDebuggerBundle.message("xdebugger.drop.text.add.to.watches"));

  return true;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:15,
代码来源:XWatchesView.java

示例15: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent anEvent) {
    applicableDropCount = 0;
    dropOrPrepareToDrop(anEvent, false);
    anEvent.setDropPossible(applicableDropCount > 0);
    return false;
}
 

开发者ID:chrimm,
项目名称:cordovastudio,
代码行数:8,
代码来源:StoryboardView.java

示例16: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
public boolean update(DnDEvent aEvent)
{
	aEvent.setDropPossible(false);
	if(mySelectedContainer == null)
	{
		return false;
	}
	if(!(aEvent.getAttachedObject() instanceof MyDragBean))
	{
		return false;
	}
	MyDragBean bean = (MyDragBean) aEvent.getAttachedObject();
	if(bean.isRow != myIsRow || bean.cells.length == 0)
	{
		return false;
	}
	int gridLine = getDropGridLine(aEvent);
	setDropInsertLine(gridLine);
	aEvent.setDropPossible(gridLine >= 0);
	if(gridLine >= 0)
	{
		FeedbackPainter painter = myIsRow ? HorzInsertFeedbackPainter.INSTANCE : VertInsertFeedbackPainter.INSTANCE;
		Rectangle rcFeedback = new Rectangle(mySelectedContainer.getDelegee().getSize());
		Rectangle cellRect = new Rectangle(gridLine, gridLine, 1, 1);
		rcFeedback = GridInsertLocation.getInsertFeedbackPosition(myIsRow ? GridInsertMode.RowBefore : GridInsertMode.ColumnBefore,
				mySelectedContainer, cellRect, rcFeedback);
		myEditor.getActiveDecorationLayer().putFeedback(mySelectedContainer.getDelegee(), rcFeedback, painter, null);
	}
	else
	{
		myEditor.getActiveDecorationLayer().removeFeedback();
	}
	return false;
}
 

开发者ID:consulo,
项目名称:consulo-ui-designer,
代码行数:35,
代码来源:GridCaptionPanel.java

示例17: drop

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent aEvent)
{
	setDropTargetIndex(-1);
	if(aEvent.getAttachedObject() instanceof PaletteItem)
	{
		int index = locationToTargetIndex(aEvent.getPoint());
		if(index >= 0)
		{
			myGroup.handleDrop(myProject, (PaletteItem) aEvent.getAttachedObject(), index);
		}
	}
}
 

开发者ID:consulo,
项目名称:consulo-ui-designer,
代码行数:14,
代码来源:PaletteComponentList.java

示例18: drop

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent event) {
  Object attachedObject = event.getAttachedObject();
  if (attachedObject instanceof ShelvedChangeListDragBean) {
    FileDocumentManager.getInstance().saveAllDocuments();
    ShelvedChangeListDragBean shelvedBean = (ShelvedChangeListDragBean)attachedObject;
    ShelveChangesManager.getInstance(myProject)
            .unshelveSilentlyAsynchronously(myProject, shelvedBean.getShelvedChangelists(), shelvedBean.getChanges(), shelvedBean.getBinaryFiles(), null);
  }
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:11,
代码来源:ChangesViewManager.java

示例19: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent event) {
  Object attachedObject = event.getAttachedObject();
  if (attachedObject instanceof ShelvedChangeListDragBean) {
    ShelvedChangeListDragBean shelveBean = (ShelvedChangeListDragBean)attachedObject;
    event.setDropPossible(!shelveBean.getShelvedChangelists().isEmpty());
    return false;
  }
  return true;
}
 

开发者ID:consulo,
项目名称:consulo,
代码行数:11,
代码来源:ChangesViewManager.java

示例20: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent event) {
  event.setDropPossible(false, "");

  final Object attached = event.getAttachedObject();
  final int dropAction = event.getAction().getActionId();
  final DropHandler dropHandler = getDropHandler(dropAction);
  final TreeNode[] sourceNodes = getSourceNodes(attached);
  final Point point = event.getPoint();
  final TreeNode targetNode = getTargetNode(point);

  if (targetNode == null ||
      (dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0 ||
      sourceNodes == null && !FileCopyPasteUtil.isFileListFlavorAvailable(event) ||
      sourceNodes != null && ArrayUtilRt.find(sourceNodes, targetNode) != -1 ||
      sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) {
    return false;
  }

  if (sourceNodes != null) {
    boolean redundant = true;
    for (TreeNode sourceNode : sourceNodes) {
      if (!dropHandler.isDropRedundant(sourceNode, targetNode)) {
        redundant = false;
        break;
      }
    }
    if (redundant) return false;
  }
  else {
    // it seems like it's not possible to obtain dragged items _before_ accepting _drop_ on Macs, so just skip this check
    if (!SystemInfo.isMac) {
      final PsiFileSystemItem[] psiFiles = getPsiFiles(FileCopyPasteUtil.getFileListFromAttachedObject(attached));
      if (psiFiles == null || psiFiles.length == 0) return false;
      if (!MoveHandler.isValidTarget(getPsiElement(targetNode), psiFiles)) return false;
    }
  }

  final Rectangle pathBounds = myTree.getPathBounds(myTree.getClosestPathForLocation(point.x, point.y));
  if (pathBounds != null && pathBounds.y + pathBounds.height < point.y) return false;
  event.setHighlighting(new RelativeRectangle(myTree, pathBounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  event.setDropPossible(true);
  return false;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:45,
代码来源:ProjectViewDropTarget.java

示例21: drop

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent anEvent) {
  dropOrPrepareToDrop(anEvent, true);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:5,
代码来源:NavigationView.java

示例22: update

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public boolean update(DnDEvent event) {
  event.setDropPossible(false, "");

  final Object attached = event.getAttachedObject();
  final int dropAction = event.getAction().getActionId();
  final DropHandler dropHandler = getDropHandler(dropAction);
  final TreeNode[] sourceNodes = getSourceNodes(attached);
  final Point point = event.getPoint();
  final TreeNode targetNode = getTargetNode(point);

  if (targetNode == null || (dropAction & DnDConstants.ACTION_COPY_OR_MOVE) == 0) {
    return false;
  }
  else if (sourceNodes == null && !FileCopyPasteUtil.isFileListFlavorSupported(event)) {
    return false;
  }
  else if (sourceNodes != null && ArrayUtilRt.find(sourceNodes, targetNode) != -1) {
    return false;
  }
  else if (sourceNodes != null && !dropHandler.isValidSource(sourceNodes, targetNode)) {
    return false;
  }

  if (sourceNodes != null) {
    boolean redundant = true;
    for (TreeNode sourceNode : sourceNodes) {
      if (!dropHandler.isDropRedundant(sourceNode, targetNode)) {
        redundant = false;
        break;
      }
    }
    if (redundant) return false;
  }
  else {
    // it seems like it's not possible to obtain dragged items _before_ accepting _drop_ on Macs, so just skip this check
    if (!SystemInfo.isMac) {
      final PsiFileSystemItem[] psiFiles = getPsiFiles(FileCopyPasteUtil.getFileListFromAttachedObject(attached));
      if (psiFiles == null || psiFiles.length == 0) return false;
      if (!MoveHandler.isValidTarget(getPsiElement(targetNode), psiFiles)) return false;
    }
  }

  final Rectangle pathBounds = myTree.getPathBounds(myTree.getClosestPathForLocation(point.x, point.y));
  event.setHighlighting(new RelativeRectangle(myTree, pathBounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
  event.setDropPossible(true);
  return false;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:49,
代码来源:ProjectViewDropTarget.java

示例23: dropOrPrepareToDrop

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
private void dropOrPrepareToDrop(DnDEvent anEvent, boolean execute) {
    //TODO: reimplement?
}
 

开发者ID:chrimm,
项目名称:cordovastudio,
代码行数:4,
代码来源:StoryboardView.java

示例24: drop

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
@Override
public void drop(DnDEvent anEvent) {
    dropOrPrepareToDrop(anEvent, true);
}
 

开发者ID:chrimm,
项目名称:cordovastudio,
代码行数:5,
代码来源:StoryboardView.java

示例25: JBTabbedTerminalWidget

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
public JBTabbedTerminalWidget(@NotNull Project project,
		@NotNull JBTerminalSystemSettingsProvider settingsProvider,
		final @NotNull Predicate<Pair<TerminalWidget, String>> createNewSessionAction,
		@NotNull Disposable parent)
{
	super(settingsProvider, new Predicate<TerminalWidget>()
	{
		@Override
		public boolean apply(TerminalWidget input)
		{
			return createNewSessionAction.apply(Pair.<TerminalWidget, String>create(input, null));
		}
	});
	myProject = project;

	mySettingsProvider = settingsProvider;
	myParent = parent;

	convertActions(this, getActions());

	Disposer.register(parent, this);
	Disposer.register(this, settingsProvider);

	DnDSupport.createBuilder(this).setDropHandler(new DnDDropHandler()
	{
		@Override
		public void drop(DnDEvent event)
		{
			if(event.getAttachedObject() instanceof TransferableWrapper)
			{
				TransferableWrapper ao = (TransferableWrapper) event.getAttachedObject();
				if(ao != null &&
						ao.getPsiElements() != null &&
						ao.getPsiElements().length == 1 &&
						ao.getPsiElements()[0] instanceof PsiFileSystemItem)
				{
					PsiFileSystemItem element = (PsiFileSystemItem) ao.getPsiElements()[0];
					PsiDirectory dir = element instanceof PsiFile ? ((PsiFile) element).getContainingDirectory() :
							(PsiDirectory) element;

					createNewSessionAction.apply(Pair.<TerminalWidget, String>create(JBTabbedTerminalWidget.this,
							dir.getVirtualFile().getPath()));
				}
			}
		}
	}

	).install();
}
 

开发者ID:consulo,
项目名称:consulo-terminal,
代码行数:50,
代码来源:JBTabbedTerminalWidget.java

示例26: getDropGridLine

点赞 2

import com.intellij.ide.dnd.DnDEvent; //导入依赖的package包/类
private int getDropGridLine(final DnDEvent aEvent)
{
	final Point point = aEvent.getPointOn(mySelectedContainer.getDelegee());
	return mySelectedContainer.getGridLayoutManager().getGridLineNear(mySelectedContainer, myIsRow, point, 20);
}
 

开发者ID:consulo,
项目名称:consulo-ui-designer,
代码行数:6,
代码来源:GridCaptionPanel.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)