com.intellij.util.ui.StatusText Java Examples

The following examples show how to use com.intellij.util.ui.StatusText. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UsagePreviewPanel.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void updateLayoutLater(@Nullable final List<? extends UsageInfo> infos) {
  String cannotPreviewMessage = cannotPreviewMessage(infos);
  if (cannotPreviewMessage != null) {
    releaseEditor();
    removeAll();
    int newLineIndex = cannotPreviewMessage.indexOf("\n");
    if (newLineIndex == -1) {
      getEmptyText().setText(cannotPreviewMessage);
    }
    else {
      getEmptyText().setText(cannotPreviewMessage.substring(0, newLineIndex)).appendSecondaryText(cannotPreviewMessage.substring(newLineIndex + 1), StatusText.DEFAULT_ATTRIBUTES, null);
    }
    revalidate();
  }
  else {
    resetEditor(infos);
  }
}
 
Example #2
Source File: UpdateInfoTree.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void setChangeLists(final List<CommittedChangeList> receivedChanges) {
  final boolean hasEmptyCaches = CommittedChangesCache.getInstance(myProject).hasEmptyCaches();

  ApplicationManager.getApplication().invokeLater(() -> {
    if (myLoadingChangeListsLabel != null) {
      remove(myLoadingChangeListsLabel);
      myLoadingChangeListsLabel = null;
    }
    myCommittedChangeLists = receivedChanges;
    myTreeBrowser.setItems(myCommittedChangeLists, CommittedChangesBrowserUseCase.UPDATE);
    if (hasEmptyCaches) {
      final StatusText statusText = myTreeBrowser.getEmptyText();
      statusText.clear();
      statusText.appendText("Click ").appendText("Refresh", SimpleTextAttributes.LINK_ATTRIBUTES, new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
          RefreshIncomingChangesAction.doRefresh(myProject);
        }
      }).appendText(" to initialize repository changes cache");
    }
  }, myProject.getDisposed());
}
 
Example #3
Source File: Switcher.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onSearchFieldUpdated(String pattern) {
  if (myComponent.project.isDisposed()) {
    myComponent.myPopup.cancel();
    return;
  }
  ((NameFilteringListModel)myComponent.files.getModel()).refilter();
  ((NameFilteringListModel)myComponent.toolWindows.getModel()).refilter();
  if (myComponent.files.getModel().getSize() + myComponent.toolWindows.getModel().getSize() == 0) {
    myComponent.toolWindows.getEmptyText().setText("");
    myComponent.files.getEmptyText().setText("Press 'Enter' to search in Project");
  }
  else {
    myComponent.files.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
    myComponent.toolWindows.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
  }
  refreshSelection();
}
 
Example #4
Source File: InstalledPackagesPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void onUpdateFinished() {
  myPackagesTable.setPaintBusy(false);
  myPackagesTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
  updateUninstallUpgrade();
  // Action button presentations won't be updated if no events occur (e.g. mouse isn't moving, keys aren't being pressed).
  // In that case emulating activity will help:
  ActivityTracker.getInstance().inc();
}
 
Example #5
Source File: DetailsPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public DetailsPanel(@Nonnull Project project) {
  myProject = project;
  myStatusText = new StatusText() {
    @Override
    protected boolean isStatusVisible() {
      return StringUtil.isEmpty(myText);
    }
  };
  myStatusText.setText("Commit message");
  myStatusText.attachTo(this);

  setPreferredSize(new Dimension(150, 100));
}
 
Example #6
Source File: FileHistoryPanelImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void adjustEmptyText() {
  VirtualFile virtualFile = myFilePath.getVirtualFile();
  if ((virtualFile == null || !virtualFile.isValid()) && !myFilePath.getIOFile().exists()) {
    setEmptyText("File " + myFilePath.getName() + " not found");
  }
  else if (myInRefresh) {
    setEmptyText(CommonBundle.getLoadingTreeNodeText());
  }
  else {
    setEmptyText(StatusText.DEFAULT_EMPTY_TEXT);
  }
}
 
Example #7
Source File: DirDiffTableModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void reloadModel(final boolean userForcedRefresh) {
  myUpdating.set(true);
  myTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT);
  final JBLoadingPanel loadingPanel = getLoadingPanel();
  loadingPanel.startLoading();

  final ModalityState modalityState = ModalityState.current();

  ApplicationManager.getApplication().executeOnPooledThread(() -> {
    EmptyProgressIndicator indicator = new EmptyProgressIndicator(modalityState);
    ProgressManager.getInstance().executeProcessUnderProgress(() -> {
      try {
        if (myDisposed) return;
        myUpdater = new Updater(loadingPanel, 100);
        myUpdater.start();
        text.set("Loading...");
        myTree = new DTree(null, "", true);
        mySrc.refresh(userForcedRefresh);
        myTrg.refresh(userForcedRefresh);
        scan(mySrc, myTree, true);
        scan(myTrg, myTree, false);
      }
      catch (final IOException e) {
        LOG.warn(e);
        reportException(VcsBundle.message("refresh.failed.message", StringUtil.decapitalize(e.getLocalizedMessage())));
      }
      finally {
        if (myTree != null) {
          myTree.setSource(mySrc);
          myTree.setTarget(myTrg);
          myTree.update(mySettings);
          applySettings();
        }
      }
    }, indicator);
  });
}
 
Example #8
Source File: WorkspaceMappingsTableEditor.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@NotNull
@Override
public StatusText getEmptyText() {
    return new StatusText() {
        @Override
        protected boolean isStatusVisible() {
            return true;
        }
    };
}
 
Example #9
Source File: JBTextField.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myEmptyText;
}
 
Example #10
Source File: CommittedChangesTreeBrowser.java    From consulo with Apache License 2.0 4 votes vote down vote up
public StatusText getEmptyText() {
  return myChangesTree.getEmptyText();
}
 
Example #11
Source File: AttachToProcessActionBase.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setEmptyText(@Nonnull StatusText emptyText) {
  emptyText.setText(XDebuggerBundle.message("xdebugger.attach.popup.emptyText"));
}
 
Example #12
Source File: ActionPopupStep.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setEmptyText(@Nonnull StatusText emptyText) {
}
 
Example #13
Source File: DetailsPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
DetailsPanel(@Nonnull VcsLogData logData,
             @Nonnull VcsLogColorManager colorManager,
             @Nonnull Disposable parent) {
  myLogData = logData;
  myColorManager = colorManager;

  myScrollPane = new JBScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  myMainContentPanel = new ScrollablePanel() {
    @Override
    public boolean getScrollableTracksViewportWidth() {
      boolean expanded = false;
      for (Component c : getComponents()) {
        if (c instanceof CommitPanel && ((CommitPanel)c).isExpanded()) {
          expanded = true;
          break;
        }
      }
      return !expanded;
    }

    @Override
    public Dimension getPreferredSize() {
      Dimension preferredSize = super.getPreferredSize();
      int height = Math.max(preferredSize.height, myScrollPane.getViewport().getHeight());
      JBScrollPane scrollPane = UIUtil.getParentOfType(JBScrollPane.class, this);
      if (scrollPane == null || getScrollableTracksViewportWidth()) {
        return new Dimension(preferredSize.width, height);
      }
      else {
        return new Dimension(Math.max(preferredSize.width, scrollPane.getViewport().getWidth()), height);
      }
    }

    @Override
    public Color getBackground() {
      return CommitPanel.getCommitDetailsBackground();
    }

    @Override
    protected void paintChildren(Graphics g) {
      if (StringUtil.isNotEmpty(myEmptyText.getText())) {
        myEmptyText.paint(this, g);
      }
      else {
        super.paintChildren(g);
      }
    }
  };
  myEmptyText = new StatusText(myMainContentPanel) {
    @Override
    protected boolean isStatusVisible() {
      return StringUtil.isNotEmpty(getText());
    }
  };
  myMainContentPanel.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));

  myMainContentPanel.setOpaque(false);
  myScrollPane.setViewportView(myMainContentPanel);
  myScrollPane.setBorder(IdeBorderFactory.createEmptyBorder());
  myScrollPane.setViewportBorder(IdeBorderFactory.createEmptyBorder());

  myLoadingPanel = new JBLoadingPanel(new BorderLayout(), parent, ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS) {
    @Override
    public Color getBackground() {
      return CommitPanel.getCommitDetailsBackground();
    }
  };
  myLoadingPanel.add(myScrollPane);

  setLayout(new BorderLayout());
  add(myLoadingPanel, BorderLayout.CENTER);

  myEmptyText.setText("Commit details");
}
 
Example #14
Source File: JBPanelWithEmptyText.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myEmptyText;
}
 
Example #15
Source File: JBTextArea.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myEmptyText;
}
 
Example #16
Source File: AddDeleteListPanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myList.getEmptyText();
}
 
Example #17
Source File: AddEditRemovePanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myTable.getEmptyText();
}
 
Example #18
Source File: PathsChooserComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myList.getEmptyText();
}
 
Example #19
Source File: OptionalChooserComponent.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public StatusText getEmptyText() {
  return myList.getEmptyText();
}
 
Example #20
Source File: PantsProjectSettingsControl.java    From intellij-pants-plugin with Apache License 2.0 4 votes vote down vote up
public void onProjectPathChanged(@NotNull final String projectPath) {
  // NB: onProjectPathChanged is called twice for each path. This guard ensures we only run it
  //     once per set of calls.
  if (lastPath.equals(projectPath)) {
    return;
  }
  lastPath = projectPath;
  myTargetSpecsBox.clear();
  errors.clear();
  final VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(VfsUtil.pathToUrl(projectPath));
  String buildRoot = PantsUtil.findBuildRoot(file).map(VirtualFile::getName).orElse("");

  ProjectPathFileType pathFileType = determinePathKind(file);
  switch (pathFileType) {
    case isNonExistent:
    case isNonPantsFile:
      myTargetSpecsBox.setEnabled(true);
      errors.add(String.format("Pants project not found given project path: %s", projectPath));
      break;

    case isRecursiveDirectory:
      myTargetSpecsBox.setEnabled(false);
      Optional<String> relativeProjectPath = PantsUtil.getRelativeProjectPath(file.getPath());

      if (relativeProjectPath.isPresent()) {
        String relativePath = relativeProjectPath.get();
        if (relativePath.equals(".")) {
          setGeneratedName(buildRoot);
        }
        else {
          setGeneratedName(buildRoot + File.separator + relativePath);
        }

        String spec = relativePath + "/::";
        myTargetSpecsBox.setEmptyText(spec);
        myTargetSpecsBox.addItem(spec, spec, true);

        myLibsWithSourcesCheckBox.setEnabled(true);
      } else {
        clearGeneratedName();
        errors.add(String.format("Fail to find relative path from %s to build root.", file.getPath()));
        return;
      }
      break;

    case executableScript:
      String path = PantsUtil.getRelativeProjectPath(file.getPath()).orElse(file.getName());
      if (path.equals(".")) {
        setGeneratedName(buildRoot + File.separator + file.getName());
      }
      else {
        setGeneratedName(buildRoot + File.separator + path);
      }

      myTargetSpecsBox.setEnabled(false);
      myTargetSpecsBox.setEmptyText(path);

      myLibsWithSourcesCheckBox.setSelected(false);
      myLibsWithSourcesCheckBox.setEnabled(false);
      break;

    case isBUILDFile:
      String name = PantsUtil.getRelativeProjectPath(file.getPath())
        .orElse(file.getParent().getName());

      if(name.equals(".")) {
        setGeneratedName(buildRoot);
      }else {
        setGeneratedName(buildRoot + File.separator + name);
      }
      myTargetSpecsBox.setEnabled(true);
      myTargetSpecsBox.setEmptyText(StatusText.DEFAULT_EMPTY_TEXT);
      myLibsWithSourcesCheckBox.setEnabled(true);

      ProgressManager.getInstance().run(new Task.Modal(getProject(),
          PantsBundle.message("pants.getting.target.list"), false) {
        @Override
        public void run(@NotNull ProgressIndicator indicator) {
          try {
            final Collection<String> targets = PantsUtil.listAllTargets(projectPath);
            PantsUtil.invokeLaterIfNeeded(() -> {
              targets.forEach(s -> myTargetSpecsBox.addItem(s, s, false));
            });
          }
          catch (RuntimeException e) {
            PantsUtil.invokeLaterIfNeeded(() -> {
              Messages.showErrorDialog(getProject(), e.getMessage(), "Pants Failure");
              Messages.createMessageDialogRemover(getProject()).run();
            });
          }
        }
      });
      break;
    default:
      clearGeneratedName();
      PantsUtil.invokeLaterIfNeeded(() -> {
        Messages.showErrorDialog(getProject(), "Unexpected project file state: " + pathFileType, "Pants Failure");
        Messages.createMessageDialogRemover(getProject()).run();
      });
  }
}
 
Example #21
Source File: PatternFilterEditor.java    From KodeBeagle with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public final StatusText getEmptyText() {
    return myTable.getEmptyText();
}
 
Example #22
Source File: GoalEditor.java    From MavenHelper with Apache License 2.0 2 votes vote down vote up
@Override
public void setEmptyText(@NotNull StatusText statusText) {

}
 
Example #23
Source File: ListPopupStepEx.java    From consulo with Apache License 2.0 votes vote down vote up
void setEmptyText(@Nonnull StatusText emptyText);