Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ TableOverviewPart_EmptyListText=<keine>
TableOverviewPart_OpenAllWithErrors=Alle öffnen
TableOverviewPart_CalculateMissingTask=Überprüfe Tabellen...
TableOverviewPart_DebugModeHint=Debug-Mode: Tabellen können immer wieder neu überprüft werden
TableOverviewPart_NonTransformableTable=Nicht generierbar:

TableErrorTableColumns_Index=Lfd. Nr.
TableErrorTableColumns_LeadingObject=Führendes Objekt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,8 @@ private String getRowReferenceObjectGuid(final int rowPosition) {
private void subcribeTriggerResortEvent() {
final Comparator<RowGroup> comparator = tableService
.getRowGroupComparator(getTableShortcut());
if (comparator instanceof final TableRowGroupComparator rowGroupComparator) {
if (table != null
&& comparator instanceof final TableRowGroupComparator rowGroupComparator) {
// This is new instance of Comparator, therefore need call sort here
// to determine the waiting on another service criterion
ECollections.sort(table.getTablecontent().getRowgroups(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ protected void updateTreeElements(final Set<String> areaIds) {
getDialogService().showProgress(getToolboxShell(), monitor -> {
logger.debug("Start update tree elements"); //$NON-NLS-1$
final Map<TableInfo, Table> pt1Tables = tableService
.transformTables(monitor, getModelSession(),
avaibleTables, tableType, areaIds);
.transformTables(monitor, avaibleTables, tableType,
areaIds);
Display.getDefault().asyncExec(() -> {
pt1Tables.forEach((tableInfo, table) -> {
CheckBoxTreeElement element = treeDataModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
EventHandler.class }, property = {
"service.context.key:String=org.eclipse.set.services.table.TableService",
EventConstants.EVENT_TOPIC + "=" + Events.MODEL_CHANGED,
EventConstants.EVENT_TOPIC + "="
+ Events.COMPARE_MODEL_LOADED })
EventConstants.EVENT_TOPIC + "=" + Events.COMPARE_MODEL_LOADED,
EventConstants.EVENT_TOPIC + "=" + Events.CLOSE_SESSION })
public class TableServiceContextFunction extends ContextFunction
implements EventHandler {

Expand Down Expand Up @@ -208,6 +208,7 @@ public void handleEvent(final Event event) {
.getLoadedSession(closeSession);
EdgeToPointsCacheProxy.clearCacheInstance(
loadedSession.getPlanProSchnittstelle());
tableService.clearInstance();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand All @@ -25,6 +26,7 @@
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -129,6 +131,7 @@ public final class TableServiceImpl implements TableService {

private final Map<TableCompareType, TableDiffService> diffServiceMap = new ConcurrentHashMap<>();
private static final Queue<Pair<BasePart, Runnable>> transformTableThreads = new LinkedList<>();
private static final Set<TableInfo> nonTransformableTables = new HashSet<>();

private static final String EMPTY = "empty"; //$NON-NLS-1$
private static final String IGNORED_PLANNING_AREA_CACHE_KEY = "ignoredPlanningArea";//$NON-NLS-1$
Expand Down Expand Up @@ -243,7 +246,11 @@ public TableNameInfo getTableNameInfo(final String shortcut) {

@Override
public Collection<TableInfo> getAvailableTables() {
return new ArrayList<>(modelServiceMap.keySet());
return modelServiceMap.keySet()
.stream()
.filter(tableInfo -> !nonTransformableTables
.contains(tableInfo))
.toList();
}

@Override
Expand Down Expand Up @@ -656,30 +663,29 @@ private IRunnableWithProgress createProgressMonitor() {

@Override
public Map<TableInfo, Table> transformTables(final IProgressMonitor monitor,
final IModelSession modelSession,
final Set<TableInfo> tablesToTransfrom, final TableType tableType,
final Set<String> controlAreaIds) {
final Map<TableInfo, Table> result = new HashMap<>();
monitor.beginTask(messages.TableOverviewPart_CalculateMissingTask,
tablesToTransfrom.size());

for (final TableInfo tableInfo : tablesToTransfrom) {
final String shortcut = tableInfo.shortcut();
final TableNameInfo nameInfo = getTableNameInfo(shortcut);
monitor.subTask(nameInfo.getFullDisplayName());
final Table table = transformToTable(shortcut, tableType,
modelSession, controlAreaIds);
while (!TableService.isTransformComplete(
nameInfo.getShortName().toLowerCase(), null)) {
try {
try {
final String shortcut = tableInfo.shortcut();
final TableNameInfo nameInfo = getTableNameInfo(shortcut);
monitor.subTask(nameInfo.getFullDisplayName());
final Table table = createDiffTable(shortcut, tableType,
controlAreaIds);
while (!TableService.isTransformComplete(
nameInfo.getShortName().toLowerCase(), null)) {
Thread.sleep(2000);
} catch (final InterruptedException e) {
Thread.interrupted();
}
result.put(tableInfo, table);
monitor.worked(1);
} catch (final Exception e) {
Thread.interrupted();
}

result.put(tableInfo, table);
monitor.worked(1);
}
monitor.done();
return result;
Expand All @@ -688,32 +694,53 @@ public Map<TableInfo, Table> transformTables(final IProgressMonitor monitor,
@Override
public Table createDiffTable(final String elementId,
final TableType tableType, final Set<String> controlAreaIds) {
final Table mainSessionTable = transformToTable(elementId, tableType,
sessionService.getLoadedSession(ToolboxFileRole.SESSION),
controlAreaIds);
final IModelSession compareSession = sessionService
.getLoadedSession(ToolboxFileRole.COMPARE_PLANNING);
if (compareSession == null) {
return mainSessionTable;
}
try {
final Table mainSessionTable = transformToTable(elementId,
tableType,
sessionService.getLoadedSession(ToolboxFileRole.SESSION),
controlAreaIds);
final IModelSession compareSession = sessionService
.getLoadedSession(ToolboxFileRole.COMPARE_PLANNING);
if (compareSession == null) {
return mainSessionTable;
}

final Table compareSessionTable = transformToTable(elementId, tableType,
compareSession, controlAreaIds);
final Table compareSessionTable = transformToTable(elementId,
tableType, compareSession, controlAreaIds);

// Waiting table compare transform, then create compare table between to
// plan
while (!TableService.isTransformComplete(extractShortcut(elementId),
null)) {
try {
Thread.sleep(2000);
} catch (final InterruptedException e) {
Thread.interrupted();
// Waiting table compare transform, then create compare table
// between to
// plan
while (!TableService.isTransformComplete(extractShortcut(elementId),
null)) {
try {
Thread.sleep(2000);
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
}
}
final Table compareTable = diffServiceMap
.get(TableCompareType.PROJECT)
.createDiffTable(mainSessionTable, compareSessionTable);
sortTable(compareTable, TableType.DIFF, elementId);
return compareTable;

} catch (final Exception e) {
logger.error("Transformation Error: {} : {}", //$NON-NLS-1$
elementId, e.getMessage());
final TableInfo tableInfo = modelServiceMap.keySet()
.stream()
.filter(info -> info.shortcut()
.equals(extractShortcut(elementId)))
.findFirst()
.orElse(null);
if (tableInfo != null) {
nonTransformableTables.add(tableInfo);
broker.post(Events.TABLEERROR_CHANGED, null);
}
Comment on lines +731 to +740
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to find tableInfo after #2078

throw new RuntimeException(e);
}
final Table compareTable = diffServiceMap.get(TableCompareType.PROJECT)
.createDiffTable(mainSessionTable, compareSessionTable);
sortTable(compareTable, TableType.DIFF, elementId);
return compareTable;

}

@Override
Expand All @@ -734,4 +761,18 @@ public TableRowGroupComparator getRowGroupComparator(
}
return null;
}

@Override
public Set<TableInfo> getNonTransformableTables(
final Pt1TableCategory tableCategory) {
return nonTransformableTables.stream()
.filter(info -> info.category().equals(tableCategory))
.collect(Collectors.toSet());
}

@SuppressWarnings("static-method")
void clearInstance() {
transformTableThreads.clear();
nonTransformableTables.clear();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,9 @@ public class Messages {
*/
public String TableExportPart_ExportPlanningRecordsDescriptionService_ViewName;

/**
* Nicht generierbar:
*/
public String TableOverviewPart_NonTransformableTable;

}
Loading
Loading