Java 类com.intellij.util.ui.update.Activatable 实例源码

项目:intellij-ce-playground    文件:TipManager.java   
public TipManager(final JComponent component, TipFactory factory) {
  myTipFactory = factory;
  myComponent = component;

  new UiNotifyConnector.Once(component, new Activatable() {
    @Override
    public void showNotify() {
      installListeners();
    }

    @Override
    public void hideNotify() {
    }
  });

  final HideTooltipAction hide = new HideTooltipAction();
  hide.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myComponent);
  Disposer.register(this, new Disposable() {
    @Override
    public void dispose() {
      hide.unregisterCustomShortcutSet(myComponent);
    }
  });
}
项目:intellij-ce-playground    文件:IdeGlassPaneUtil.java   
public static void installPainter(final JComponent target, final Painter painter, final Disposable parent) {
  final UiNotifyConnector connector = new UiNotifyConnector(target, new Activatable() {

    IdeGlassPane myPane;

    public void showNotify() {
      IdeGlassPane pane = find(target);
      if (myPane != null && myPane != pane) {
        myPane.removePainter(painter);
      }
      myPane = pane;
      myPane.addPainter(target, painter, parent);
    }

    public void hideNotify() {
      if (myPane != null) {
        myPane.removePainter(painter);
      }
    }
  });
  Disposer.register(parent, connector);
}
项目:intellij-ce-playground    文件:MouseDragHelper.java   
public void start() {
  if (myGlassPane != null) return;

  new UiNotifyConnector(myDragComponent, new Activatable() {
    public void showNotify() {
      attach();
    }

    public void hideNotify() {
      detach(true);
    }
  });

  Disposer.register(myParentDisposable, new Disposable() {
    public void dispose() {
      stop();
    }
  });
}
项目:intellij-ce-playground    文件:Alarm.java   
public Alarm setActivationComponent(@NotNull final JComponent component) {
  myActivationComponent = component;
  new UiNotifyConnector(component, new Activatable() {
    @Override
    public void showNotify() {
      flushPending();
    }

    @Override
    public void hideNotify() {
    }
  });


  return this;
}
项目:intellij-ce-playground    文件:ActionToolbarImpl.java   
private static void updateWhenFirstShown(JComponent targetComponent, final ToolbarReference ref) {
  Activatable activatable = new Activatable.Adapter() {
    public void showNotify() {
      ActionToolbarImpl toolbar = ref.get();
      if (toolbar != null) {
        toolbar.myUpdater.updateActions(false, false);
      }
    }
  };

  ref.myDisposable = new UiNotifyConnector(targetComponent, activatable) {
    @Override
    protected void showNotify() {
      super.showNotify();
      ref.disposeReference();
    }
  };
}
项目:intellij-ce-playground    文件:ShowSettingsUtilImpl.java   
public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
  ConfigurableGroup[] group = getConfigurableGroups(project, true);

  group = filterEmptyGroups(group);
  final Configurable configurable2Select = id2Select == null ? null : new ConfigurableVisitor.ByID(id2Select).find(group);

  if (Registry.is("ide.new.settings.view")) {
    new SettingsDialog(getProject(project), group, configurable2Select, filter).show();
    return;
  }
  final DialogWrapper dialog = getDialog(project, group, configurable2Select);

  new UiNotifyConnector.Once(dialog.getContentPane(), new Activatable.Adapter() {
    @Override
    public void showNotify() {
      final OptionsEditor editor = (OptionsEditor)((DataProvider)dialog).getData(OptionsEditor.KEY.getName());
      LOG.assertTrue(editor != null);
      editor.select(configurable2Select, filter);
    }
  });
  dialog.show();
}
项目:intellij-ce-playground    文件:LibrariesDownloadUiUtil.java   
public static void initAsyncComboBoxModel(@NotNull final JComboBox jComboBox,
                                          @NotNull final String groupId,
                                          final URL... localUrls) {
  final List<Object> items = new ArrayList<Object>();

  new UiNotifyConnector.Once(jComboBox, new Activatable() {
    @Override
    public void showNotify() {
      loadItems(jComboBox, items, groupId, localUrls);
    }

    @Override
    public void hideNotify() {
    }
  });

  items.add("loading...");
  jComboBox.setModel(new CollectionComboBoxModel(items, items.get(0)));
  jComboBox.setEnabled(false);
}
项目:tools-idea    文件:TipManager.java   
public TipManager(final JComponent component, TipFactory factory) {
  myTipFactory = factory;
  myComponent = component;

  new UiNotifyConnector.Once(component, new Activatable() {
    public void showNotify() {
      installListeners();
    }

    public void hideNotify() {
    }
  });

  final HideTooltipAction hide = new HideTooltipAction();
  hide.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), myComponent);
  Disposer.register(this, new Disposable() {
    public void dispose() {
      hide.unregisterCustomShortcutSet(myComponent);
    }
  });
}
项目:tools-idea    文件:IdeGlassPaneUtil.java   
public static void installPainter(final JComponent target, final Painter painter, final Disposable parent) {
  final UiNotifyConnector connector = new UiNotifyConnector(target, new Activatable() {

    IdeGlassPane myPane;

    public void showNotify() {
      IdeGlassPane pane = find(target);
      if (myPane != null && myPane != pane) {
        myPane.removePainter(painter);
      }
      myPane = pane;
      myPane.addPainter(target, painter, parent);
    }

    public void hideNotify() {
      if (myPane != null) {
        myPane.removePainter(painter);
      }
    }
  });
  Disposer.register(parent, connector);
}
项目:tools-idea    文件:MouseDragHelper.java   
public void start() {
  if (myGlassPane != null) return;

  new UiNotifyConnector(myDragComponent, new Activatable() {
    public void showNotify() {
      attach();
    }

    public void hideNotify() {
      detach(true);
    }
  });

  Disposer.register(myParentDisposable, new Disposable() {
    public void dispose() {
      stop();
    }
  });
}
项目:tools-idea    文件:Alarm.java   
public Alarm setActivationComponent(@NotNull final JComponent component) {
  myActivationComponent = component;
  new UiNotifyConnector(component, new Activatable() {
    @Override
    public void showNotify() {
      flushPending();
    }

    @Override
    public void hideNotify() {
    }
  });


  return this;
}
项目:tools-idea    文件:LibrariesDownloadUiUtil.java   
public static void initAsyncComboBoxModel(@NotNull final JComboBox jComboBox,
                                          @NotNull final String groupId,
                                          final URL... localUrls) {
  final List<Object> items = new ArrayList<Object>();

  new UiNotifyConnector.Once(jComboBox, new Activatable() {
    @Override
    public void showNotify() {
      loadItems(jComboBox, items, groupId, localUrls);
    }

    @Override
    public void hideNotify() {
    }
  });

  items.add("loading...");
  jComboBox.setModel(new CollectionComboBoxModel(items, items.get(0)));
  jComboBox.setEnabled(false);
}
项目:consulo    文件:IdeGlassPaneUtil.java   
public static void installPainter(final JComponent target, final Painter painter, final Disposable parent) {
  final UiNotifyConnector connector = new UiNotifyConnector(target, new Activatable() {

    IdeGlassPane myPane;

    public void showNotify() {
      IdeGlassPane pane = find(target);
      if (myPane != null && myPane != pane) {
        myPane.removePainter(painter);
      }
      myPane = pane;
      myPane.addPainter(target, painter, parent);
    }

    public void hideNotify() {
      if (myPane != null) {
        myPane.removePainter(painter);
      }
    }
  });
  Disposer.register(parent, connector);
}
项目:consulo    文件:MouseDragHelper.java   
public void start() {
  if (myGlassPane != null) return;

  new UiNotifyConnector(myDragComponent, new Activatable() {
    public void showNotify() {
      attach();
    }

    public void hideNotify() {
      detach(true);
    }
  });

  Disposer.register(myParentDisposable, new Disposable() {
    public void dispose() {
      stop();
    }
  });
}
项目:consulo    文件:Alarm.java   
@Nonnull
public Alarm setActivationComponent(@Nonnull final JComponent component) {
  myActivationComponent = component;
  //noinspection ResultOfObjectAllocationIgnored
  new UiNotifyConnector(component, new Activatable() {
    @Override
    public void showNotify() {
      flushPending();
    }

    @Override
    public void hideNotify() {
    }
  });


  return this;
}
项目:consulo    文件:ActionToolbarImpl.java   
private static void updateWhenFirstShown(JComponent targetComponent, final ToolbarReference ref) {
  Activatable activatable = new Activatable.Adapter() {
    public void showNotify() {
      ActionToolbarImpl toolbar = ref.get();
      if (toolbar != null) {
        toolbar.myUpdater.updateActions(false, false);
      }
    }
  };

  ref.myDisposable = new UiNotifyConnector(targetComponent, activatable) {
    @Override
    protected void showNotify() {
      super.showNotify();
      ref.disposeReference();
    }
  };
}
项目:consulo    文件:DesktopToolWindowImpl.java   
@RequiredUIAccess
@Override
protected void init(boolean canCloseContent, @Nullable Object component) {
  final ContentFactory contentFactory = ContentFactory.getInstance();
  myContentUI = new DesktopToolWindowContentUi(this);
  ContentManager contentManager = myContentManager = contentFactory.createContentManager(myContentUI, canCloseContent, myToolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createContent((JComponent)component, "", false);
    contentManager.addContent(content);
    contentManager.setSelectedContent(content, false);
  }

  myComponent = contentManager.getComponent();

  installToolwindowFocusPolicy();

  UiNotifyConnector notifyConnector = new UiNotifyConnector(myComponent, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      myShowing.onReady();
    }
  });
  Disposer.register(contentManager, notifyConnector);
}
项目:intellij-ce-playground    文件:ArtifactErrorPanel.java   
public ArtifactErrorPanel(final ArtifactEditorImpl artifactEditor) {
  myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning);
  new UiNotifyConnector(myMainPanel, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      if (myErrorText != null) {
        myErrorLabel.setText(myErrorText);
        myErrorText = null;
      }
    }
  });
  myFixButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (!myCurrentQuickFixes.isEmpty()) {
        if (myCurrentQuickFixes.size() == 1) {
          performFix(ContainerUtil.getFirstItem(myCurrentQuickFixes, null), artifactEditor);
        }
        else {
          JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<ConfigurationErrorQuickFix>(null, myCurrentQuickFixes) {
            @NotNull
            @Override
            public String getTextFor(ConfigurationErrorQuickFix value) {
              return value.getActionName();
            }

            @Override
            public PopupStep onChosen(ConfigurationErrorQuickFix selectedValue, boolean finalChoice) {
              performFix(selectedValue, artifactEditor);
              return FINAL_CHOICE;
            }
          }).showUnderneathOf(myFixButton);
        }
      }
    }
  });
  clearError();
}
项目:intellij-ce-playground    文件:ThreeComponentsSplitter.java   
public Divider(boolean isFirst, boolean isOnePixel) {
  super(new GridBagLayout());
  myIsOnePixel = isOnePixel;
  setFocusable(false);
  enableEvents(MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK);
  myIsFirst = isFirst;
  setOrientation(myVerticalSplit);

  new UiNotifyConnector.Once(this, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      init();
    }
  });
}
项目:intellij-ce-playground    文件:ShadowAction.java   
public ShadowAction(AnAction action, AnAction copyFromAction, JComponent component) {
  myAction = action;

  myCopyFromAction = copyFromAction;
  myComponent = component;
  myActionId = ActionManager.getInstance().getId(myCopyFromAction);

  myAction.getTemplatePresentation().copyFrom(copyFromAction.getTemplatePresentation());

  myKeymapListener = new Keymap.Listener() {
    @Override
    public void onShortcutChanged(final String actionId) {
      if (myActionId == null || actionId.equals(myActionId)) {
        rebound();
      }
    }
  };

  myKeymapManagerListener = new KeymapManagerListener() {
    @Override
    public void activeKeymapChanged(final Keymap keymap) {
      rebound();
    }
  };

  myUiNotify = new UiNotifyConnector(myComponent, new Activatable() {
    @Override
    public void showNotify() {
      _connect();
    }

    @Override
    public void hideNotify() {
      disconnect();
    }
  });
}
项目:intellij-ce-playground    文件:MemoryUsagePanel.java   
public MemoryUsagePanel() {
  setOpaque(false);
  setFocusable(false);

  addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      System.gc();
      updateState();
    }
  });

  setBorder(StatusBarWidget.WidgetBorder.INSTANCE);
  updateUI();

  new UiNotifyConnector(this, new Activatable() {
    private ScheduledFuture<?> myFuture;

    @Override
    public void showNotify() {
      myFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
        public void run() {
          if (isDisplayable()) {
            updateState();
          }
        }
      }, 1, 5, TimeUnit.SECONDS);
    }

    @Override
    public void hideNotify() {
      if (myFuture != null) {
        myFuture.cancel(true);
        myFuture = null;
      }
    }
  });

}
项目:intellij-ce-playground    文件:ToolWindowImpl.java   
ToolWindowImpl(final ToolWindowManagerImpl toolWindowManager, final String id, boolean canCloseContent, @Nullable final JComponent component) {
  myToolWindowManager = toolWindowManager;
  myChangeSupport = new PropertyChangeSupport(this);
  myId = id;
  myAvailable = true;

  final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
  myContentUI = new ToolWindowContentUi(this);
  myContentManager =
    contentFactory.createContentManager(myContentUI, canCloseContent, toolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createContent(component, "", false);
    myContentManager.addContent(content);
    myContentManager.setSelectedContent(content, false);
  }

  myComponent = myContentManager.getComponent();

  UiNotifyConnector notifyConnector = new UiNotifyConnector(myComponent, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      myShowing.onReady();
    }
  });
  Disposer.register(myContentManager, notifyConnector);
}
项目:intellij-ce-playground    文件:TextLayoutCache.java   
TextLayoutCache(EditorView view) {
  myView = view;
  myDocument = view.getEditor().getDocument();
  myDocument.addDocumentListener(this, this);
  myBidiNotRequiredMarker = new LineLayout(view, "", Font.PLAIN);
  Disposer.register(this, new UiNotifyConnector(view.getEditor().getContentComponent(), new Activatable.Adapter() {
    @Override
    public void hideNotify() {
      trimChunkCache();
    }
  }));
}
项目:intellij-ce-playground    文件:ShowSettingsUtilImpl.java   
private static boolean editConfigurable(@Nullable Component parent,
                                        @Nullable Project project,
                                        @NotNull Configurable configurable,
                                        String dimensionKey,
                                        @Nullable final Runnable advancedInitialization,
                                        boolean showApplyButton) {
  final DialogWrapper editor;
  if (parent == null) {
    editor = Registry.is("ide.new.settings.view")
             ? new SettingsDialog(project, dimensionKey, configurable, showApplyButton, false)
             : new SingleConfigurableEditor(project, configurable, dimensionKey, showApplyButton);
  }
  else {
    editor = Registry.is("ide.new.settings.view")
             ? new SettingsDialog(parent, dimensionKey, configurable, showApplyButton, false)
             : new SingleConfigurableEditor(parent, configurable, dimensionKey, showApplyButton);
  }
  if (advancedInitialization != null) {
    new UiNotifyConnector.Once(editor.getContentPane(), new Activatable.Adapter() {
      @Override
      public void showNotify() {
        advancedInitialization.run();
      }
    });
  }
  return editor.showAndGet();
}
项目:tools-idea    文件:ArtifactErrorPanel.java   
public ArtifactErrorPanel(final ArtifactEditorImpl artifactEditor) {
  myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning);
  new UiNotifyConnector(myMainPanel, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      if (myErrorText != null) {
        myErrorLabel.setText(myErrorText);
        myErrorText = null;
      }
    }
  });
  myFixButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (!myCurrentQuickFixes.isEmpty()) {
        if (myCurrentQuickFixes.size() == 1) {
          performFix(ContainerUtil.getFirstItem(myCurrentQuickFixes, null), artifactEditor);
        }
        else {
          JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<ConfigurationErrorQuickFix>(null, myCurrentQuickFixes) {
            @NotNull
            @Override
            public String getTextFor(ConfigurationErrorQuickFix value) {
              return value.getActionName();
            }

            @Override
            public PopupStep onChosen(ConfigurationErrorQuickFix selectedValue, boolean finalChoice) {
              performFix(selectedValue, artifactEditor);
              return FINAL_CHOICE;
            }
          }).showUnderneathOf(myFixButton);
        }
      }
    }
  });
  clearError();
}
项目:tools-idea    文件:ThreeComponentsSplitter.java   
public Divider(boolean isFirst) {
  super(new GridBagLayout());
  setFocusable(false);
  enableEvents(MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK);
  myIsFirst = isFirst;
  setOrientation(myVerticalSplit);

  new UiNotifyConnector.Once(this, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      init();
    }
  });
}
项目:tools-idea    文件:ShadowAction.java   
public ShadowAction(AnAction action, AnAction copyFromAction, JComponent component) {
  myAction = action;

  myCopyFromAction = copyFromAction;
  myComponent = component;
  myActionId = ActionManager.getInstance().getId(myCopyFromAction);

  myAction.getTemplatePresentation().copyFrom(copyFromAction.getTemplatePresentation());

  myKeymapListener = new Keymap.Listener() {
    @Override
    public void onShortcutChanged(final String actionId) {
      if (myActionId == null || actionId.equals(myActionId)) {
        rebound();
      }
    }
  };

  myKeymapManagerListener = new KeymapManagerListener() {
    @Override
    public void activeKeymapChanged(final Keymap keymap) {
      rebound();
    }
  };

  myUiNotify = new UiNotifyConnector(myComponent, new Activatable() {
    @Override
    public void showNotify() {
      _connect();
    }

    @Override
    public void hideNotify() {
      disconnect();
    }
  });
}
项目:tools-idea    文件:ToolWindowImpl.java   
ToolWindowImpl(final ToolWindowManagerImpl toolWindowManager, final String id, boolean canCloseContent, @Nullable final JComponent component) {
  myToolWindowManager = toolWindowManager;
  myChangeSupport = new PropertyChangeSupport(this);
  myId = id;
  myAvailable = true;

  final ContentFactory contentFactory = ServiceManager.getService(ContentFactory.class);
  myContentUI = new ToolWindowContentUi(this);
  myContentManager =
    contentFactory.createContentManager(myContentUI, canCloseContent, toolWindowManager.getProject());

  if (component != null) {
    final Content content = contentFactory.createContent(component, "", false);
    myContentManager.addContent(content);
    myContentManager.setSelectedContent(content, false);
  }

  myComponent = myContentManager.getComponent();

  UiNotifyConnector notifyConnector = new UiNotifyConnector(myComponent, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      myShowing.onReady();
    }
  });
  Disposer.register(myContentManager, notifyConnector);
}
项目:consulo    文件:ThreeComponentsSplitter.java   
public Divider(boolean isFirst, boolean isOnePixel) {
  super(new GridBagLayout());
  myIsOnePixel = isOnePixel;
  setFocusable(false);
  enableEvents(MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK);
  myIsFirst = isFirst;
  setOrientation(myVerticalSplit);

  new UiNotifyConnector.Once(this, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      init();
    }
  });
}
项目:consulo    文件:ShadowAction.java   
public ShadowAction(AnAction action, AnAction copyFromAction, JComponent component) {
  myAction = action;

  myCopyFromAction = copyFromAction;
  myComponent = component;
  myActionId = ActionManager.getInstance().getId(myCopyFromAction);

  myAction.getTemplatePresentation().copyFrom(copyFromAction.getTemplatePresentation());

  myKeymapListener = new Keymap.Listener() {
    @Override
    public void onShortcutChanged(final String actionId) {
      if (myActionId == null || actionId.equals(myActionId)) {
        rebound();
      }
    }
  };

  myKeymapManagerListener = new KeymapManagerListener() {
    @Override
    public void activeKeymapChanged(final Keymap keymap) {
      rebound();
    }
  };

  myUiNotify = new UiNotifyConnector(myComponent, new Activatable() {
    @Override
    public void showNotify() {
      _connect();
    }

    @Override
    public void hideNotify() {
      disconnect();
    }
  });
}
项目:consulo    文件:MemoryUsagePanel.java   
public MemoryUsagePanel() {
  setOpaque(false);
  setFocusable(false);

  addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      System.gc();
      updateState();
    }
  });

  setBorder(StatusBarWidget.WidgetBorder.INSTANCE);
  updateUI();

  new UiNotifyConnector(this, new Activatable() {
    private ScheduledFuture<?> myFuture;

    @Override
    public void showNotify() {
      myFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
        @Override
        public void run() {
          if (isDisplayable()) {
            updateState();
          }
        }
      }, 1, 5, TimeUnit.SECONDS);
    }

    @Override
    public void hideNotify() {
      if (myFuture != null) {
        myFuture.cancel(true);
        myFuture = null;
      }
    }
  });

}
项目:consulo    文件:TextLayoutCache.java   
TextLayoutCache(EditorView view) {
  myView = view;
  myDocument = view.getEditor().getDocument();
  myDocument.addDocumentListener(this, this);
  myBidiNotRequiredMarker = LineLayout.create(view, "", Font.PLAIN);
  Disposer.register(this, new UiNotifyConnector(view.getEditor().getContentComponent(), new Activatable.Adapter() {
    @Override
    public void hideNotify() {
      trimChunkCache();
    }
  }));
}
项目:consulo    文件:ProjectStructureDialog.java   
public static boolean show(@Nonnull Project project, final Consumer<ProjectStructureConfigurable> configurableConsumer) {
  final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
  ProjectStructureDialog dialog =
          new ProjectStructureDialog(project, configurable, OptionsEditorDialog.DIMENSION_KEY, true, IdeModalityType.PROJECT, configurable);
  if (configurableConsumer != null) {
    new UiNotifyConnector.Once(dialog.getContentPane(), new Activatable() {
      @Override
      public void showNotify() {
        configurableConsumer.consume(configurable);
      }
    });
  }
  return dialog.showAndGet();
}
项目:consulo    文件:ArtifactErrorPanel.java   
public ArtifactErrorPanel(final ArtifactEditorImpl artifactEditor) {
  myErrorLabel.setIcon(AllIcons.RunConfigurations.ConfigurationWarning);
  new UiNotifyConnector(myMainPanel, new Activatable.Adapter() {
    @Override
    public void showNotify() {
      if (myErrorText != null) {
        myErrorLabel.setText(myErrorText);
        myErrorText = null;
      }
    }
  });
  myFixButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (!myCurrentQuickFixes.isEmpty()) {
        if (myCurrentQuickFixes.size() == 1) {
          performFix(ContainerUtil.getFirstItem(myCurrentQuickFixes, null), artifactEditor);
        }
        else {
          JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<ConfigurationErrorQuickFix>(null, myCurrentQuickFixes) {
            @Nonnull
            @Override
            public String getTextFor(ConfigurationErrorQuickFix value) {
              return value.getActionName();
            }

            @Override
            public PopupStep onChosen(ConfigurationErrorQuickFix selectedValue, boolean finalChoice) {
              performFix(selectedValue, artifactEditor);
              return FINAL_CHOICE;
            }
          }).showUnderneathOf(myFixButton);
        }
      }
    }
  });
  clearError();
}
项目:consulo-java    文件:TipManager.java   
public TipManager(final JComponent component, TipFactory factory)
{
    myTipFactory = factory;
    myComponent = component;

    new UiNotifyConnector.Once(component, new Activatable()
    {
        @Override
        public void showNotify()
        {
            installListeners();
        }

        @Override
        public void hideNotify()
        {
        }
    });

    final HideTooltipAction hide = new HideTooltipAction();
    hide.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)), myComponent);
    Disposer.register(this, new Disposable()
    {
        @Override
        public void dispose()
        {
            hide.unregisterCustomShortcutSet(myComponent);
        }
    });
}
项目:intellij-ce-playground    文件:IntroduceFieldDialog.java   
protected JComponent createNorthPanel() {

    JPanel panel = new JPanel(new GridBagLayout());
    GridBagConstraints gbConstraints = new GridBagConstraints();

    gbConstraints.insets = new Insets(4, 4, 4, 0);
    gbConstraints.anchor = GridBagConstraints.EAST;
    gbConstraints.fill = GridBagConstraints.BOTH;

    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 1;
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 0;

    final JLabel type = new JLabel(getTypeLabel());

    panel.add(type, gbConstraints);

    gbConstraints.gridx++;
    gbConstraints.insets = new Insets(4, 0, 4, 4);
    gbConstraints.weightx = 0;
    myTypeSelector = myTypeSelectorManager.getTypeSelector();
    panel.add(myTypeSelector.getComponent(), gbConstraints);

    gbConstraints.insets = new Insets(4, 4, 4, 0);
    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 0;
    gbConstraints.weighty = 1;
    gbConstraints.gridx = 0;
    gbConstraints.gridy = 1;
    final JLabel namePrompt = new JLabel(RefactoringBundle.message("name.prompt"));
    panel.add(namePrompt, gbConstraints);

    gbConstraints.insets = new Insets(4, 0, 4, 4);
    gbConstraints.gridwidth = 1;
    gbConstraints.weightx = 1;
    gbConstraints.gridx = 1;
    gbConstraints.gridy = 1;
    myNameField = new NameSuggestionsField(myProject);
    panel.add(myNameField.getComponent(), gbConstraints);
    myNameField.addDataChangedListener(new NameSuggestionsField.DataChanged() {
      public void dataChanged() {
        updateButtons();
      }
    });
    namePrompt.setLabelFor(myNameField.getFocusableComponent());

    // We delay initialization of name field till dialog is shown, so that it will be executed in a different command and won't 
    // be tied to any document changes performed in current command (and won't prevent undo for them later)
    new UiNotifyConnector.Once(panel, new Activatable.Adapter() {
      @Override
      public void showNotify() {
        myNameSuggestionsManager = new NameSuggestionsManager(myTypeSelector, myNameField,
                                                              createGenerator(myWillBeDeclaredStatic, myLocalVariable, 
                                                                              myInitializerExpression, myIsInvokedOnDeclaration, 
                                                                              myEnteredName, myParentClass, myProject));
        myNameSuggestionsManager.setLabelsFor(type, namePrompt);

        Editor editor = myNameField.getEditor();
        if (editor != null) {
          editor.getSelectionModel().setSelection(0, editor.getDocument().getTextLength());
        }
      }
    });


    return panel;
  }
项目:intellij-ce-playground    文件:AbstractTreeUi.java   
protected void init(@NotNull AbstractTreeBuilder builder,
                    @NotNull JTree tree,
                    @NotNull DefaultTreeModel treeModel,
                    AbstractTreeStructure treeStructure,
                    @Nullable Comparator<NodeDescriptor> comparator,
                    boolean updateIfInactive) {
  myBuilder = builder;
  myTree = tree;
  myTreeModel = treeModel;
  myActivityMonitor = UiActivityMonitor.getInstance();
  myActivityId = new UiActivity.AsyncBgOperation("TreeUi" + this);
  addModelListenerToDianoseAccessOutsideEdt();
  TREE_NODE_WRAPPER = builder.createSearchingTreeNodeWrapper();
  myTree.setModel(myTreeModel);
  setRootNode((DefaultMutableTreeNode)treeModel.getRoot());
  myTreeStructure = treeStructure;
  myNodeDescriptorComparator = comparator;
  myUpdateIfInactive = updateIfInactive;

  UIUtil.invokeLaterIfNeeded(new TreeRunnable("AbstractTreeUi.init") {
    @Override
    public void perform() {
      if (!wasRootNodeInitialized()) {
        if (myRootNode.getChildCount() == 0) {
          insertLoadingNode(myRootNode, true);
        }
      }
    }
  });

  myExpansionListener = new MyExpansionListener();
  myTree.addTreeExpansionListener(myExpansionListener);

  mySelectionListener = new MySelectionListener();
  myTree.addTreeSelectionListener(mySelectionListener);

  setUpdater(getBuilder().createUpdater());
  myProgress = getBuilder().createProgressIndicator();
  Disposer.register(getBuilder(), getUpdater());
  if (myProgress != null) {
    Disposer.register(getBuilder(), new Disposable() {
      @Override
      public void dispose() {
        myProgress.cancel();
      }
    });
  }

  final UiNotifyConnector uiNotify = new UiNotifyConnector(tree, new Activatable() {
    @Override
    public void showNotify() {
      myShowing = true;
      myWasEverShown = true;
      if (canInitiateNewActivity()) {
        activate(true);
      }
    }

    @Override
    public void hideNotify() {
      myShowing = false;
      if (canInitiateNewActivity()) {
        deactivate();
      }
    }
  });
  Disposer.register(getBuilder(), uiNotify);

  myTree.addFocusListener(myFocusListener);
}
项目:tools-idea    文件:AbstractTreeUi.java   
protected void init(@NotNull AbstractTreeBuilder builder,
                    @NotNull JTree tree,
                    @NotNull DefaultTreeModel treeModel,
                    AbstractTreeStructure treeStructure,
                    @Nullable Comparator<NodeDescriptor> comparator,
                    boolean updateIfInactive) {
  myBuilder = builder;
  myTree = tree;
  myTreeModel = treeModel;
  myActivityMonitor = UiActivityMonitor.getInstance();
  myActivityId = new UiActivity.AsyncBgOperation("TreeUi" + this);
  addModelListenerToDianoseAccessOutsideEdt();
  TREE_NODE_WRAPPER = builder.createSearchingTreeNodeWrapper();
  myTree.setModel(myTreeModel);
  setRootNode((DefaultMutableTreeNode)treeModel.getRoot());
  myTreeStructure = treeStructure;
  myNodeDescriptorComparator = comparator;
  myUpdateIfInactive = updateIfInactive;

  UIUtil.invokeLaterIfNeeded(new Runnable() {
    @Override
    public void run() {
      if (!wasRootNodeInitialized()) {
        if (myRootNode.getChildCount() == 0) {
          insertLoadingNode(myRootNode, true);
        }
      }
    }
  });

  myExpansionListener = new MyExpansionListener();
  myTree.addTreeExpansionListener(myExpansionListener);

  mySelectionListener = new MySelectionListener();
  myTree.addTreeSelectionListener(mySelectionListener);

  setUpdater(getBuilder().createUpdater());
  myProgress = getBuilder().createProgressIndicator();
  Disposer.register(getBuilder(), getUpdater());

  final UiNotifyConnector uiNotify = new UiNotifyConnector(tree, new Activatable() {
    @Override
    public void showNotify() {
      myShowing = true;
      myWasEverShown = true;
      if (canInitiateNewActivity()) {
        activate(true);
      }
    }

    @Override
    public void hideNotify() {
      myShowing = false;
      if (canInitiateNewActivity()) {
        deactivate();
      }
    }
  });
  Disposer.register(getBuilder(), uiNotify);

  myTree.addFocusListener(myFocusListener);
}
项目:consulo    文件:AbstractTreeUi.java   
protected void init(@Nonnull AbstractTreeBuilder builder,
                    @Nonnull JTree tree,
                    @Nonnull DefaultTreeModel treeModel,
                    AbstractTreeStructure treeStructure,
                    @Nullable Comparator<NodeDescriptor> comparator,
                    boolean updateIfInactive) {
  myBuilder = builder;
  myTree = tree;
  myTreeModel = treeModel;
  myActivityMonitor = UiActivityMonitor.getInstance();
  myActivityId = new UiActivity.AsyncBgOperation("TreeUi" + this);
  addModelListenerToDianoseAccessOutsideEdt();
  TREE_NODE_WRAPPER = builder.createSearchingTreeNodeWrapper();
  myTree.setModel(myTreeModel);
  setRootNode((DefaultMutableTreeNode)treeModel.getRoot());
  myTreeStructure = treeStructure;
  myNodeDescriptorComparator = comparator;
  myUpdateIfInactive = updateIfInactive;

  UIUtil.invokeLaterIfNeeded(new TreeRunnable("AbstractTreeUi.init") {
    @Override
    public void perform() {
      if (!wasRootNodeInitialized()) {
        if (myRootNode.getChildCount() == 0) {
          insertLoadingNode(myRootNode, true);
        }
      }
    }
  });

  myExpansionListener = new MyExpansionListener();
  myTree.addTreeExpansionListener(myExpansionListener);

  mySelectionListener = new MySelectionListener();
  myTree.addTreeSelectionListener(mySelectionListener);

  setUpdater(getBuilder().createUpdater());
  myProgress = getBuilder().createProgressIndicator();
  Disposer.register(getBuilder(), getUpdater());
  if (myProgress != null) {
    Disposer.register(getBuilder(), () -> myProgress.cancel());
  }

  final UiNotifyConnector uiNotify = new UiNotifyConnector(tree, new Activatable() {
    @Override
    public void showNotify() {
      myShowing = true;
      myWasEverShown = true;
      if (canInitiateNewActivity()) {
        activate(true);
      }
    }

    @Override
    public void hideNotify() {
      myShowing = false;
      if (canInitiateNewActivity()) {
        deactivate();
      }
    }
  });
  Disposer.register(getBuilder(), uiNotify);

  myTree.addFocusListener(myFocusListener);
}