mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
KTNB-1022: Remove tracing
GitOrigin-RevId: d9295a7c955858a9e7f2b95c33c264c719b217e5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
718a027e55
commit
21cf49432a
@@ -8,7 +8,6 @@ import com.intellij.openapi.actionSystem.ActionToolbar
|
||||
import com.intellij.openapi.actionSystem.AnAction
|
||||
import com.intellij.openapi.actionSystem.Presentation
|
||||
import com.intellij.openapi.actionSystem.impl.ActionButtonWithText
|
||||
import com.intellij.openapi.diagnostic.logger
|
||||
import com.intellij.openapi.roots.ui.configuration.actions.AlignedIconWithTextAction
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.util.ui.JBInsets
|
||||
@@ -33,24 +32,11 @@ fun createCustomComponentForResultViewToolbar(
|
||||
}
|
||||
|
||||
fun setPageSizeAndReload(pageSize: Int, grid: DataGrid) {
|
||||
trace {
|
||||
"Setting page size of grid $grid to $pageSize"
|
||||
}
|
||||
val pageModel = grid.getDataHookup().getPageModel()
|
||||
pageModel.setPageSize(pageSize)
|
||||
trace {
|
||||
"Page size of grid $grid was set to $pageSize (page model: $pageModel)"
|
||||
}
|
||||
|
||||
val loader = grid.getDataHookup().getLoader()
|
||||
val source = GridRequestSource(DataGridRequestPlace(grid))
|
||||
if (GridUtilCore.isPageSizeUnlimited(pageSize)) loader.load(source, 0)
|
||||
else loader.reloadCurrentPage(source)
|
||||
}
|
||||
|
||||
private fun trace(messageFactory: () -> String) {
|
||||
val logger = logger<ChangePageSizeAction>()
|
||||
if (logger.isTraceEnabled) {
|
||||
logger.trace(messageFactory())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,9 @@ import com.intellij.database.run.ui.FloatingPagingManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.ActionUpdateThread;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static com.intellij.database.datagrid.GridUtil.hidePageActions;
|
||||
|
||||
/**
|
||||
@@ -77,25 +74,10 @@ public abstract class PageAction extends DumbAwareAction implements GridAction {
|
||||
}
|
||||
|
||||
public static abstract class NavigationAction extends PageAction {
|
||||
private static final Logger LOG = Logger.getInstance(NavigationAction.class);
|
||||
|
||||
private static void traceIfEnabled(Supplier<String> messageSupplier) {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(messageSupplier.get());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
traceIfEnabled(
|
||||
() -> "Updating " + this.getClass().getSimpleName() + ": " +
|
||||
"visible: " + e.getPresentation().isVisible() + ", " +
|
||||
"enabled: " + e.getPresentation().isEnabled() + ", ");
|
||||
super.update(e);
|
||||
traceIfEnabled(
|
||||
() -> "Updated " + this.getClass().getSimpleName() + " (super called): " +
|
||||
"visible: " + e.getPresentation().isVisible() + ", " +
|
||||
"enabled: " + e.getPresentation().isEnabled() + ", ");
|
||||
additionalUpdateVisibilityCheck(e);
|
||||
FloatingPagingManager.adjustAction(e);
|
||||
}
|
||||
@@ -106,15 +88,12 @@ public abstract class PageAction extends DumbAwareAction implements GridAction {
|
||||
GridPagingModel<GridRow, GridColumn> pageModel = dataGrid.getDataHookup().getPageModel();
|
||||
|
||||
final int pageSize = pageModel.getPageSize();
|
||||
traceIfEnabled(() -> "Page size: " + pageSize);
|
||||
|
||||
if (pageSize == GridPagingModel.UNLIMITED_PAGE_SIZE) {
|
||||
e.getPresentation().setEnabledAndVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
final long totalRowCount = pageModel.getTotalRowCount();
|
||||
traceIfEnabled(() -> "Total rows: " + totalRowCount);
|
||||
if ((long)pageSize >= totalRowCount) {
|
||||
e.getPresentation().setEnabledAndVisible(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user