Java 类com.intellij.uiDesigner.componentTree.ComponentTree 实例源码

项目:intellij-ce-playground    文件:ComponentRenderer.java   
private void renderComponent(@Nullable final RadComponent target, boolean selected) {
  clear();
  final SimpleTextAttributes baseAttributes =
    selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES;
  if (target == null) {
    append(UIDesignerBundle.message("component.none"), baseAttributes);
    return;
  }
  setIcon(ComponentTree.getComponentIcon(target));
  String binding = target.getBinding();
  if (binding != null) {
    append(binding, baseAttributes);
  }
  else {
    final String componentTitle = target.getComponentTitle();
    if (componentTitle != null && componentTitle.length() > "\"\"".length()) {
      append(componentTitle, baseAttributes);
    }
    else {
      append(target.getComponentClass().getSimpleName(),
             selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }
  }
}
项目:intellij-ce-playground    文件:DesignDropTargetListener.java   
public void dragExit(DropTargetEvent dte) {
  try {
    ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
    if (componentTree != null) {
      componentTree.setDropTargetComponent(null);
    }
    myUseDragDelta = false;
    if (myDraggedComponentList != null) {
      cancelDrag();
      setDraggingState(myDraggedComponentList, false);
      myEditor.getActiveDecorationLayer().removeFeedback();
      myDraggedComponentList = null;
      myEditor.setDesignTimeInsets(2);
    }
    myDraggedComponentsCopy = null;
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
项目:tools-idea    文件:UIDesignerToolWindowManager.java   
private void initToolWindow() {
  myToolWindowPanel = new MyToolWindowPanel();
  myComponentTree = new ComponentTree(myProject);
  for (TreeSelectionListener listener : myPendingListeners) {
    myComponentTree.addTreeSelectionListener(listener);
  }
  myPendingListeners.clear();
  final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myComponentTree);
  scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  scrollPane.setPreferredSize(new Dimension(250, -1));
  myComponentTree.initQuickFixManager(scrollPane.getViewport());
  myPropertyInspector= new PropertyInspector(myProject, myComponentTree);
  myToolWindowPanel.setFirstComponent(scrollPane);
  myToolWindowPanel.setSecondComponent(myPropertyInspector);
  myToolWindow = ToolWindowManager.getInstance(myProject).registerToolWindow(UIDesignerBundle.message("toolwindow.ui.designer"),
                                                                             myToolWindowPanel,
                                                                             ToolWindowAnchor.LEFT, myProject, true);
  myToolWindow.setIcon(UIDesignerIcons.ToolWindowUIDesigner);
  myToolWindow.setAvailable(false, null);
}
项目:tools-idea    文件:ComponentRenderer.java   
private void renderComponent(@Nullable final RadComponent target, boolean selected) {
  clear();
  final SimpleTextAttributes baseAttributes =
    selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES;
  if (target == null) {
    append(UIDesignerBundle.message("component.none"), baseAttributes);
    return;
  }
  setIcon(ComponentTree.getComponentIcon(target));
  String binding = target.getBinding();
  if (binding != null) {
    append(binding, baseAttributes);
  }
  else {
    final String componentTitle = target.getComponentTitle();
    if (componentTitle != null && componentTitle.length() > "\"\"".length()) {
      append(componentTitle, baseAttributes);
    }
    else {
      append(target.getComponentClass().getSimpleName(),
             selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }
  }
}
项目:consulo-ui-designer    文件:ComponentRenderer.java   
private void renderComponent(@Nullable final RadComponent target, boolean selected) {
  clear();
  final SimpleTextAttributes baseAttributes =
    selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.SIMPLE_CELL_ATTRIBUTES;
  if (target == null) {
    append(UIDesignerBundle.message("component.none"), baseAttributes);
    return;
  }
  setIcon(ComponentTree.getComponentIcon(target));
  String binding = target.getBinding();
  if (binding != null) {
    append(binding, baseAttributes);
  }
  else {
    final String componentTitle = target.getComponentTitle();
    if (componentTitle != null && componentTitle.length() > "\"\"".length()) {
      append(componentTitle, baseAttributes);
    }
    else {
      append(target.getComponentClass().getSimpleName(),
             selected ? SimpleTextAttributes.SELECTED_SIMPLE_CELL_ATTRIBUTES : SimpleTextAttributes.GRAYED_ATTRIBUTES);
    }
  }
}
项目:consulo-ui-designer    文件:DesignDropTargetListener.java   
public void dragExit(DropTargetEvent dte)
{
    try
    {
        ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
        if(componentTree != null)
        {
            componentTree.setDropTargetComponent(null);
        }
        myUseDragDelta = false;
        if(myDraggedComponentList != null)
        {
            cancelDrag();
            setDraggingState(myDraggedComponentList, false);
            myEditor.getActiveDecorationLayer().removeFeedback();
            myDraggedComponentList = null;
            myEditor.setDesignTimeInsets(2);
        }
        myDraggedComponentsCopy = null;
    }
    catch(Exception e)
    {
        LOG.error(e);
    }
}
项目:intellij-ce-playground    文件:DesignerToolWindow.java   
public DesignerToolWindow(Project project) {
  myComponentTree = new ComponentTree(project);

  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myComponentTree);
  scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  scrollPane.setPreferredSize(new Dimension(250, -1));
  myComponentTree.initQuickFixManager(scrollPane.getViewport());

  myPropertyInspector = new PropertyInspector(project, myComponentTree);

  myToolWindowPanel.setFirstComponent(scrollPane);
  myToolWindowPanel.setSecondComponent(myPropertyInspector);
}
项目:intellij-ce-playground    文件:SurroundPopupAction.java   
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
  final ListPopup groupPopup = JBPopupFactory.getInstance()
    .createActionGroupPopup(UIDesignerBundle.message("surround.with.popup.title"), myActionGroup, e.getDataContext(),
                            JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true);

  final JComponent component = (JComponent)e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (component instanceof ComponentTree) {
    groupPopup.show(JBPopupFactory.getInstance().guessBestPopupLocation(component));
  }
  else {
    RadComponent selComponent = selection.get(0);
    FormEditingUtil.showPopupUnderComponent(groupPopup, selComponent);
  }
}
项目:intellij-ce-playground    文件:GlassLayer.java   
/**
 * Provides {@link PlatformDataKeys#NAVIGATABLE} to navigate to
 * binding of currently selected component (if any)
 */
public Object getData(final String dataId) {
  if(CommonDataKeys.NAVIGATABLE.is(dataId)) {
    final ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
    if (componentTree != null) {
      return componentTree.getData(dataId);
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:DesignDropTargetListener.java   
public void dragOver(DropTargetDragEvent dtde) {
  try {
    if (myComponentDragObject == null) {
      dtde.rejectDrag();
      return;
    }
    final int dx = dtde.getLocation().x - myLastPoint.x;
    final int dy = dtde.getLocation().y - myLastPoint.y;

    if (myDraggedComponentsCopy != null && myDraggedComponentList != null) {
      for (RadComponent aMySelection : myDraggedComponentsCopy) {
        aMySelection.shift(dx, dy);
      }
    }

    myLastPoint = dtde.getLocation();
    myEditor.getDragLayer().repaint();

    ComponentDropLocation location = myGridInsertProcessor.processDragEvent(dtde.getLocation(), myComponentDragObject);
    ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();

    if (!location.canDrop(myComponentDragObject) ||
        (myDraggedComponentList != null && FormEditingUtil.isDropOnChild(myDraggedComponentList, location))) {
      if (componentTree != null) {
        componentTree.setDropTargetComponent(null);
      }
      dtde.rejectDrag();
    }
    else {
      if (componentTree != null) {
        componentTree.setDropTargetComponent(location.getContainer());
      }
      dtde.acceptDrag(dtde.getDropAction());
    }
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
项目:intellij-ce-playground    文件:GuiEditor.java   
private void refreshProperties() {
  final Ref<Boolean> anythingModified = new Ref<Boolean>();
  FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor() {
    public boolean visit(final IComponent component) {
      final RadComponent radComponent = (RadComponent)component;
      boolean componentModified = false;
      for (IProperty prop : component.getModifiedProperties()) {
        if (prop instanceof IntroStringProperty) {
          IntroStringProperty strProp = (IntroStringProperty)prop;
          componentModified = strProp.refreshValue(radComponent) || componentModified;
        }
      }

      if (component instanceof RadContainer) {
        componentModified = ((RadContainer)component).updateBorder() || componentModified;
      }

      if (component.getParentContainer() instanceof RadTabbedPane) {
        componentModified = ((RadTabbedPane)component.getParentContainer()).refreshChildTitle(radComponent) || componentModified;
      }
      if (componentModified) {
        anythingModified.set(Boolean.TRUE);
      }

      return true;
    }
  });
  if (!anythingModified.isNull()) {
    refresh();
    DesignerToolWindow designerToolWindow = DesignerToolWindowManager.getInstance(this);
    ComponentTree tree = designerToolWindow.getComponentTree();
    if (tree != null) tree.repaint();
    PropertyInspector inspector = designerToolWindow.getPropertyInspector();
    if (inspector != null) inspector.synchWithTree(true);
  }
}
项目:tools-idea    文件:SurroundPopupAction.java   
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
  final ListPopup groupPopup = JBPopupFactory.getInstance()
    .createActionGroupPopup(UIDesignerBundle.message("surround.with.popup.title"), myActionGroup, e.getDataContext(),
                            JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true);

  final JComponent component = (JComponent)e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (component instanceof ComponentTree) {
    groupPopup.show(JBPopupFactory.getInstance().guessBestPopupLocation(component));
  }
  else {
    RadComponent selComponent = selection.get(0);
    FormEditingUtil.showPopupUnderComponent(groupPopup, selComponent);
  }
}
项目:tools-idea    文件:GlassLayer.java   
/**
 * Provides {@link PlatformDataKeys#NAVIGATABLE} to navigate to
 * binding of currently selected component (if any)
 */
public Object getData(final String dataId) {
  if(PlatformDataKeys.NAVIGATABLE.is(dataId)) {
    final ComponentTree componentTree = UIDesignerToolWindowManager.getInstance(myEditor.getProject()).getComponentTree();
    if (componentTree != null) {
      return componentTree.getData(dataId);
    }
  }
  return null;
}
项目:consulo-ui-designer    文件:DesignerToolWindow.java   
public DesignerToolWindow(Project project)
{
    myComponentTree = new ComponentTree(project);

    JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myComponentTree);
    scrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
    scrollPane.setPreferredSize(new Dimension(250, -1));
    myComponentTree.initQuickFixManager(scrollPane.getViewport());

    myPropertyInspector = new PropertyInspector(project, myComponentTree);

    myToolWindowPanel.setFirstComponent(scrollPane);
    myToolWindowPanel.setSecondComponent(myPropertyInspector);
}
项目:consulo-ui-designer    文件:SurroundPopupAction.java   
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
  final ListPopup groupPopup = JBPopupFactory.getInstance()
    .createActionGroupPopup(UIDesignerBundle.message("surround.with.popup.title"), myActionGroup, e.getDataContext(),
                            JBPopupFactory.ActionSelectionAid.ALPHA_NUMBERING, true);

  final JComponent component = (JComponent)e.getData(PlatformDataKeys.CONTEXT_COMPONENT);
  if (component instanceof ComponentTree) {
    groupPopup.show(JBPopupFactory.getInstance().guessBestPopupLocation(component));
  }
  else {
    RadComponent selComponent = selection.get(0);
    FormEditingUtil.showPopupUnderComponent(groupPopup, selComponent);
  }
}
项目:consulo-ui-designer    文件:GlassLayer.java   
/**
 * Provides {@link PlatformDataKeys#NAVIGATABLE} to navigate to
 * binding of currently selected component (if any)
 */
@Override
public Object getData(@NotNull Key<?> dataId)
{
    if(CommonDataKeys.NAVIGATABLE == dataId)
    {
        final ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
        if(componentTree != null)
        {
            return componentTree.getData(dataId);
        }
    }
    return null;
}
项目:intellij-ce-playground    文件:PropertyInspector.java   
public PropertyInspector(Project project, @NotNull final ComponentTree componentTree) {
  super(new CardLayout());

  myInspectorTable = new PropertyInspectorTable(project, componentTree);
  myComponentTree = componentTree;

  // Card with property inspector
  final JPanel inspectorCard = new JPanel(new GridBagLayout());
  final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
  inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  inspectorCard.add(inspectorScrollPane,
    new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
  );
  final JCheckBox chkShowExpertProperties = new JCheckBox(UIDesignerBundle.message("chk.show.expert.properties"));
  inspectorCard.add(
    chkShowExpertProperties,
    new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)
  );
  chkShowExpertProperties.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myInspectorTable.setShowExpertProperties(chkShowExpertProperties.isSelected());
      }
    }
  );
  add(inspectorCard, INSPECTOR_CARD);

  // Empty card
  final MultiLineLabel label = new MultiLineLabel(UIDesignerBundle.message("label.select.single.component.to.edit.its.properties")){
    public void updateUI() {
      super.updateUI();
      setBackground(myInspectorTable.getBackground());
    }
  };
  label.setOpaque(true);
  label.setHorizontalAlignment(SwingConstants.CENTER);
  add(label, EMPTY_CARD);
  add(myCustomPropertiesScrollPane, CUSTOM_CARD);

  myComponentSelectionListener = new MyComponentSelectionListener();
  synchWithTree(false);

  // Install light bulb
  myQuickFixManager = new QuickFixManagerImpl(null, myInspectorTable, inspectorScrollPane.getViewport());

  myCustomPropertiesChangeListener = new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
      if (myPropertiesPanelContainer != null) {
        myPropertiesPanelContainer.revalidate();
      }
      if (myEditor.ensureEditable()) {
        myEditor.refreshAndSave(true);
      }
    }
  };
}
项目:intellij-ce-playground    文件:DesignerToolWindow.java   
public ComponentTree getComponentTree() {
  return myComponentTree;
}
项目:intellij-ce-playground    文件:DesignDropTargetListener.java   
public void drop(final DropTargetDropEvent dtde) {
  try {
    ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
    if (componentTree != null) {
      componentTree.setDropTargetComponent(null);
    }


    final DraggedComponentList dcl = DraggedComponentList.fromTransferable(dtde.getTransferable());
    if (dcl != null) {
      CommandProcessor.getInstance().executeCommand(myEditor.getProject(),
                                                    new Runnable() {
                                                      public void run() {
                                                        if (processDrop(dcl, dtde.getLocation(), dtde.getDropAction())) {
                                                          myEditor.refreshAndSave(true);
                                                        }
                                                      }
                                                    }, UIDesignerBundle.message("command.drop.components"), null);
    }
    else {
      ComponentItem componentItem = SimpleTransferable.getData(dtde.getTransferable(), ComponentItem.class);
      if (componentItem != null) {
        myEditor.getMainProcessor().setInsertFeedbackEnabled(false);
        new InsertComponentProcessor(myEditor).processComponentInsert(dtde.getLocation(), componentItem);
        ApplicationManager.getApplication().invokeLater(new Runnable() {
          public void run() {
            PaletteToolWindowManager.getInstance(myEditor).clearActiveItem();
            myEditor.getActiveDecorationLayer().removeFeedback();
            myEditor.getLayeredPane().setCursor(null);
            myEditor.getGlassLayer().requestFocus();
            myEditor.getMainProcessor().setInsertFeedbackEnabled(true);
          }
        });
      }
    }
    myDraggedComponentsCopy = null;
    myEditor.repaintLayeredPane();
  }
  catch (Exception e) {
    LOG.error(e);
  }
}
项目:tools-idea    文件:PropertyInspector.java   
public PropertyInspector(Project project, @NotNull final ComponentTree componentTree) {
  super(new CardLayout());

  myInspectorTable = new PropertyInspectorTable(project, componentTree);
  myComponentTree = componentTree;

  // Card with property inspector
  final JPanel inspectorCard = new JPanel(new GridBagLayout());
  final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
  inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  inspectorCard.add(inspectorScrollPane,
    new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
  );
  final JCheckBox chkShowExpertProperties = new JCheckBox(UIDesignerBundle.message("chk.show.expert.properties"));
  inspectorCard.add(
    chkShowExpertProperties,
    new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)
  );
  chkShowExpertProperties.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myInspectorTable.setShowExpertProperties(chkShowExpertProperties.isSelected());
      }
    }
  );
  add(inspectorCard, INSPECTOR_CARD);

  // Empty card
  final MultiLineLabel label = new MultiLineLabel(UIDesignerBundle.message("label.select.single.component.to.edit.its.properties")){
    public void updateUI() {
      super.updateUI();
      setBackground(myInspectorTable.getBackground());
    }
  };
  label.setOpaque(true);
  label.setHorizontalAlignment(SwingConstants.CENTER);
  add(label, EMPTY_CARD);
  add(myCustomPropertiesScrollPane, CUSTOM_CARD);

  myComponentSelectionListener = new MyComponentSelectionListener();
  synchWithTree(false);

  // Install light bulb
  myQuickFixManager = new QuickFixManagerImpl(null, myInspectorTable, inspectorScrollPane.getViewport());

  myCustomPropertiesChangeListener = new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
      if (myPropertiesPanelContainer != null) {
        myPropertiesPanelContainer.revalidate();
      }
      if (myEditor.ensureEditable()) {
        myEditor.refreshAndSave(true);
      }
    }
  };
}
项目:tools-idea    文件:UIDesignerToolWindowManager.java   
public ComponentTree getComponentTree() {
  checkInitToolWindow();
  return myComponentTree;
}
项目:consulo-ui-designer    文件:PropertyInspector.java   
public PropertyInspector(Project project, @NotNull final ComponentTree componentTree) {
  super(new CardLayout());

  myInspectorTable = new PropertyInspectorTable(project, componentTree);
  myComponentTree = componentTree;

  // Card with property inspector
  final JPanel inspectorCard = new JPanel(new GridBagLayout());
  final JScrollPane inspectorScrollPane = ScrollPaneFactory.createScrollPane(myInspectorTable);
  inspectorScrollPane.setBorder(IdeBorderFactory.createBorder(SideBorder.BOTTOM));
  inspectorCard.add(inspectorScrollPane,
    new GridBagConstraints(0, 0, 0, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)
  );
  final JCheckBox chkShowExpertProperties = new JCheckBox(UIDesignerBundle.message("chk.show.expert.properties"));
  inspectorCard.add(
    chkShowExpertProperties,
    new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)
  );
  chkShowExpertProperties.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        myInspectorTable.setShowExpertProperties(chkShowExpertProperties.isSelected());
      }
    }
  );
  add(inspectorCard, INSPECTOR_CARD);

  // Empty card
  final MultiLineLabel label = new MultiLineLabel(UIDesignerBundle.message("label.select.single.component.to.edit.its.properties")){
    public void updateUI() {
      super.updateUI();
      setBackground(myInspectorTable.getBackground());
    }
  };
  label.setOpaque(true);
  label.setHorizontalAlignment(SwingConstants.CENTER);
  add(label, EMPTY_CARD);
  add(myCustomPropertiesScrollPane, CUSTOM_CARD);

  myComponentSelectionListener = new MyComponentSelectionListener();
  synchWithTree(false);

  // Install light bulb
  myQuickFixManager = new QuickFixManagerImpl(null, myInspectorTable, inspectorScrollPane.getViewport());

  myCustomPropertiesChangeListener = new ChangeListener() {
    public void stateChanged(ChangeEvent e) {
      if (myPropertiesPanelContainer != null) {
        myPropertiesPanelContainer.revalidate();
      }
      if (myEditor.ensureEditable()) {
        myEditor.refreshAndSave(true);
      }
    }
  };
}
项目:consulo-ui-designer    文件:DesignerToolWindow.java   
public ComponentTree getComponentTree()
{
    return myComponentTree;
}
项目:consulo-ui-designer    文件:DesignDropTargetListener.java   
public void dragOver(DropTargetDragEvent dtde)
{
    try
    {
        if(myComponentDragObject == null)
        {
            dtde.rejectDrag();
            return;
        }
        final int dx = dtde.getLocation().x - myLastPoint.x;
        final int dy = dtde.getLocation().y - myLastPoint.y;

        if(myDraggedComponentsCopy != null && myDraggedComponentList != null)
        {
            for(RadComponent aMySelection : myDraggedComponentsCopy)
            {
                aMySelection.shift(dx, dy);
            }
        }

        myLastPoint = dtde.getLocation();
        myEditor.getDragLayer().repaint();

        ComponentDropLocation location = myGridInsertProcessor.processDragEvent(dtde.getLocation(), myComponentDragObject);
        ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();

        if(!location.canDrop(myComponentDragObject) || (myDraggedComponentList != null && FormEditingUtil.isDropOnChild(myDraggedComponentList,
                location)))
        {
            if(componentTree != null)
            {
                componentTree.setDropTargetComponent(null);
            }
            dtde.rejectDrag();
        }
        else
        {
            if(componentTree != null)
            {
                componentTree.setDropTargetComponent(location.getContainer());
            }
            dtde.acceptDrag(dtde.getDropAction());
        }
    }
    catch(Exception e)
    {
        LOG.error(e);
    }
}
项目:consulo-ui-designer    文件:DesignDropTargetListener.java   
public void drop(final DropTargetDropEvent dtde)
{
    try
    {
        ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
        if(componentTree != null)
        {
            componentTree.setDropTargetComponent(null);
        }


        final DraggedComponentList dcl = DraggedComponentList.fromTransferable(dtde.getTransferable());
        if(dcl != null)
        {
            CommandProcessor.getInstance().executeCommand(myEditor.getProject(), new Runnable()
            {
                public void run()
                {
                    if(processDrop(dcl, dtde.getLocation(), dtde.getDropAction()))
                    {
                        myEditor.refreshAndSave(true);
                    }
                }
            }, UIDesignerBundle.message("command.drop.components"), null);
        }
        else
        {
            ComponentItem componentItem = SimpleTransferable.getData(dtde.getTransferable(), ComponentItem.class);
            if(componentItem != null)
            {
                myEditor.getMainProcessor().setInsertFeedbackEnabled(false);
                new InsertComponentProcessor(myEditor).processComponentInsert(dtde.getLocation(), componentItem);
                ApplicationManager.getApplication().invokeLater(new Runnable()
                {
                    public void run()
                    {
                        PaletteToolWindowManager.getInstance(myEditor).clearActiveItem();
                        myEditor.getActiveDecorationLayer().removeFeedback();
                        myEditor.getLayeredPane().setCursor(null);
                        myEditor.getGlassLayer().requestFocus();
                        myEditor.getMainProcessor().setInsertFeedbackEnabled(true);
                    }
                });
            }
        }
        myDraggedComponentsCopy = null;
        myEditor.repaintLayeredPane();
    }
    catch(Exception e)
    {
        LOG.error(e);
    }
}
项目:consulo-ui-designer    文件:GuiEditor.java   
private void refreshProperties()
{
    final Ref<Boolean> anythingModified = new Ref<Boolean>();
    FormEditingUtil.iterate(myRootContainer, new FormEditingUtil.ComponentVisitor()
    {
        @Override
        public boolean visit(final IComponent component)
        {
            final RadComponent radComponent = (RadComponent) component;
            boolean componentModified = false;
            for(IProperty prop : component.getModifiedProperties())
            {
                if(prop instanceof IntroStringProperty)
                {
                    IntroStringProperty strProp = (IntroStringProperty) prop;
                    componentModified = strProp.refreshValue(radComponent) || componentModified;
                }
            }

            if(component instanceof RadContainer)
            {
                componentModified = ((RadContainer) component).updateBorder() || componentModified;
            }

            if(component.getParentContainer() instanceof RadTabbedPane)
            {
                componentModified = ((RadTabbedPane) component.getParentContainer()).refreshChildTitle(radComponent) || componentModified;
            }
            if(componentModified)
            {
                anythingModified.set(Boolean.TRUE);
            }

            return true;
        }
    });
    if(!anythingModified.isNull())
    {
        refresh();
        DesignerToolWindow designerToolWindow = DesignerToolWindowManager.getInstance(this);
        ComponentTree tree = designerToolWindow.getComponentTree();
        if(tree != null)
        {
            tree.repaint();
        }
        PropertyInspector inspector = designerToolWindow.getPropertyInspector();
        if(inspector != null)
        {
            inspector.synchWithTree(true);
        }
    }
}