Skip to content

Commit 1120d8d

Browse files
committed
[SAFRAN-1227] Stabilization
1 parent c732ec1 commit 1120d8d

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

models/database/plugins/org.obeonetwork.dsl.typeslibrary.edit/src/org/obeonetwork/dsl/typeslibrary/provider/TypeInstanceItemProvider.java

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,7 @@ public String getText(Object object) {
278278
String precision = "";
279279
if (nativeType != null) {
280280
TypesLibrary typesLibrary = (TypesLibrary) nativeType.eContainer();
281-
boolean hasLength = !TypesLibraryUtil.isPostgresMPD(typesLibrary);
282-
boolean hasPrecision = !TypesLibraryUtil.isPostgresMPD(typesLibrary);
281+
boolean isPostgres = TypesLibraryUtil.isPostgresMPD(typesLibrary);
283282
label = nativeType.getName();
284283
if (label == null || label.length() == 0) {
285284
label = "<undefined>";
@@ -288,9 +287,8 @@ public String getText(Object object) {
288287
case LENGTH :
289288
if (typeInstance.getLength() != null) {
290289
length = String.valueOf(typeInstance.getLength());
291-
hasLength = true;
292290
}
293-
if (!label.contains("%n") && hasLength) {
291+
if (!label.contains("%n") && (typeInstance.getLength() != null || !isPostgres)) {
294292
label = label + "(%n)";
295293
}
296294
label = replacePlaceholders(label,
@@ -300,17 +298,23 @@ public String getText(Object object) {
300298
case LENGTH_AND_PRECISION :
301299
if (typeInstance.getLength() != null) {
302300
length = String.valueOf(typeInstance.getLength());
303-
hasLength = true;
304301
}
305302
if (typeInstance.getPrecision() != null) {
306303
precision = String.valueOf(typeInstance.getPrecision());
307-
hasPrecision = true;
308304
}
309-
if (!label.contains("%n") && hasLength && !label.contains("%p") && hasPrecision) {
310-
label = label + "(%n, %p)";
311-
} else if (!label.contains("%n") && hasLength) {
305+
if (!label.contains("%n") && !label.contains("%p")) {
306+
if(!isPostgres) {
307+
label = label + "(%n, %p)";
308+
} else {
309+
if(typeInstance.getLength() != null && typeInstance.getPrecision() == null) {
310+
label = label + "(%n)";
311+
} else if(typeInstance.getPrecision() != null) {
312+
label = label + "(%n, %p)";
313+
}
314+
}
315+
} else if (!label.contains("%n") && (typeInstance.getLength() != null || !isPostgres)) {
312316
label = label + "(%n)";
313-
} else if (!label.contains("%p") && hasPrecision) {
317+
} else if (!label.contains("%p") && (typeInstance.getPrecision() != null || !isPostgres)) {
314318
label = label + "(%p)";
315319
}
316320
label = replacePlaceholders(label,

0 commit comments

Comments
 (0)