コード例 #1
0
  public ViewFilesPanel(
      FileTypeManager fileTypeManager, ActionManager actionManager, IDEFacade facade) {
    super(new BorderLayout(2, 2));
    setOpaque(false);

    myFileTypeManager = fileTypeManager;
    myIdeFacade = facade;
    myShowReadOnly = Pico.getOptions().isSet(SHOW_READ_ONLY_KEY, true);

    myTree =
        new KirTree() {
          protected void onEnter() {
            super.onEnter();
            if (myOpenFileAction.isEnabled()) {
              myOpenFileAction.actionPerformed(null);
            }
          }
        };
    IDEAFacade.installIdeaTreeActions(myTree);
    add(ScrollPaneFactory.createScrollPane(myTree));
    add(createActionsToolbar(actionManager), BorderLayout.NORTH);

    IDEAFacade.installPopupMenu(createActionGroup(), myTree, actionManager);

    myTree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode()));
    setMinimumSize(new Dimension(200, 0));
  }
コード例 #2
0
 public void showReadOnly(boolean showReadOnlyFiles) {
   if (myShowReadOnly != showReadOnlyFiles) {
     myShowReadOnly = showReadOnlyFiles;
     Pico.getOptions().setOption(SHOW_READ_ONLY_KEY, showReadOnlyFiles);
     if (myProjectsData != null) {
       refreshData(myUser, myProjectsData);
     }
   }
 }
コード例 #3
0
  @Override
  protected void tearDown() throws Exception {
    if (myTransport != null) {
      myTransport.dispose();
      Pico.getInstance().unregisterComponentByInstance(myTransport);
    }

    StringUtil.setMyUsername(null);
    super.tearDown();
  }
コード例 #4
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    myUserModel = new UserModelImpl(getBroadcaster());
    disposeOnTearDown(myUserModel);
    myIdeFacade = new MockIDEFacade(getClass());
    myIdeFacade.setReturnedProjects(new String[] {PROJECT_NAME});

    myDispatcher = new AsyncMessageDispatcherImpl(getBroadcaster(), myIdeFacade);
    disposeOnTearDown(myDispatcher);
    myTransport =
        new P2PTransport(myDispatcher, myUserModel, WAIT_USER_RESPONSES_TIMEOUT) {
          @Override
          protected void sendUserAddedCallback(User user) {
            super.sendUserAddedCallback(user);
            myLog += "sendUserAddedCallback" + user;
          }
        };
    Pico.getInstance().registerComponentInstance(myTransport);

    myLog = "";
    myProjectLevelContainer = Pico.getInstance().makeChildContainer();
  }
コード例 #5
0
    @Override
    public void processPacket(Packet packet) {
      final Presence presence = ((Presence) packet);
      if (presence.getType() != Presence.Type.subscribe) return;
      LOG.info("Subscribe request from " + presence.getFrom());

      if (myIgnoreList.isIgnored(presence.getFrom())) {
        LOG.info(presence.getFrom() + " in ignore list");
        return;
      }

      if (isUserInMyContactListAndActive(presence.getFrom()) || Pico.isUnitTest()) {
        acceptSubscription(presence, true);
        return;
      }

      UIUtil.invokeLater(
          () -> acceptSubscription(presence, myUI.shouldAcceptSubscriptionRequest(presence)));
    }
コード例 #6
0
  private DefaultActionGroup createActionGroup() {
    DefaultActionGroup actionGroup = new DefaultActionGroup();
    if (ApplicationManager.getApplication() == null || Pico.isUnitTest()) return actionGroup;

    addRefreshAction(actionGroup);
    myOpenFileAction = new OpenFileAction(myTree, myIdeFacade);
    myOpenFileAction.registerCustomShortcutSet(
        new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0)), myTree);

    AnAction diffAction =
        new DiffAction(myTree) {
          protected User getUser() {
            return myUser;
          }
        };

    diffAction.registerCustomShortcutSet(CommonShortcuts.getDiff(), myTree);

    actionGroup.add(myOpenFileAction);
    actionGroup.add(diffAction);

    addToggleReadOnlyAction(actionGroup);
    return actionGroup;
  }
コード例 #7
0
 public static JabberTransport getInstance() {
   return (JabberTransport) Pico.getInstance().getComponentInstanceOfType(JabberTransport.class);
 }