Mercurial > projects > dwt-addons
comparison dwtx/jface/text/AbstractInformationControlManager.d @ 138:b6bad70d540a
Regex instanceof changes
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 24 Aug 2008 02:26:23 +0200 |
parents | 25170b5a8951 |
children | 93a6ec48fd28 |
comparison
equal
deleted
inserted
replaced
137:25170b5a8951 | 138:b6bad70d540a |
---|---|
858 * @return the computed size constraints in points | 858 * @return the computed size constraints in points |
859 */ | 859 */ |
860 protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl) { | 860 protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl) { |
861 | 861 |
862 if (fSizeConstraints is null) { | 862 if (fSizeConstraints is null) { |
863 if (informationControl instanceof IInformationControlExtension5) { | 863 if ( cast(IInformationControlExtension5)informationControl ) { |
864 IInformationControlExtension5 iControl5= cast(IInformationControlExtension5) informationControl; | 864 IInformationControlExtension5 iControl5= cast(IInformationControlExtension5) informationControl; |
865 fSizeConstraints= iControl5.computeSizeConstraints(fWidthConstraint, fHeightConstraint); | 865 fSizeConstraints= iControl5.computeSizeConstraints(fWidthConstraint, fHeightConstraint); |
866 if (fSizeConstraints !is null) | 866 if (fSizeConstraints !is null) |
867 return Geometry.copy(fSizeConstraints); | 867 return Geometry.copy(fSizeConstraints); |
868 } | 868 } |
900 */ | 900 */ |
901 protected void handleInformationControlDisposed() { | 901 protected void handleInformationControlDisposed() { |
902 | 902 |
903 storeInformationControlBounds(); | 903 storeInformationControlBounds(); |
904 | 904 |
905 if (fInformationControl instanceof IInformationControlExtension5) | 905 if ( cast(IInformationControlExtension5)fInformationControl ) |
906 fSizeConstraints= null; | 906 fSizeConstraints= null; |
907 fInformationControl= null; | 907 fInformationControl= null; |
908 if (fInformationControlCloser !is null) { | 908 if (fInformationControlCloser !is null) { |
909 fInformationControlCloser.setInformationControl(null); //XXX: null is against the spec | 909 fInformationControlCloser.setInformationControl(null); //XXX: null is against the spec |
910 fInformationControlCloser.stop(); | 910 fInformationControlCloser.stop(); |
925 IInformationControlCreator creator= null; | 925 IInformationControlCreator creator= null; |
926 | 926 |
927 if (fCustomInformationControlCreator is null) { | 927 if (fCustomInformationControlCreator is null) { |
928 creator= fInformationControlCreator; | 928 creator= fInformationControlCreator; |
929 if (fIsCustomInformationControl && fInformationControl !is null) { | 929 if (fIsCustomInformationControl && fInformationControl !is null) { |
930 if (fInformationControl instanceof IInformationControlExtension5) | 930 if ( cast(IInformationControlExtension5)fInformationControl ) |
931 fSizeConstraints= null; | 931 fSizeConstraints= null; |
932 fInformationControl.dispose(); | 932 fInformationControl.dispose(); |
933 fInformationControl= null; | 933 fInformationControl= null; |
934 } | 934 } |
935 fIsCustomInformationControl= false; | 935 fIsCustomInformationControl= false; |
936 | 936 |
937 } else { | 937 } else { |
938 | 938 |
939 creator= fCustomInformationControlCreator; | 939 creator= fCustomInformationControlCreator; |
940 if (creator instanceof IInformationControlCreatorExtension) { | 940 if ( cast(IInformationControlCreatorExtension)creator ) { |
941 IInformationControlCreatorExtension extension= cast(IInformationControlCreatorExtension) creator; | 941 IInformationControlCreatorExtension extension= cast(IInformationControlCreatorExtension) creator; |
942 if (fInformationControl !is null && extension.canReuse(fInformationControl)) | 942 if (fInformationControl !is null && extension.canReuse(fInformationControl)) |
943 return fInformationControl; | 943 return fInformationControl; |
944 } | 944 } |
945 if (fInformationControl !is null) { | 945 if (fInformationControl !is null) { |
946 if (fInformationControl instanceof IInformationControlExtension5) | 946 if ( cast(IInformationControlExtension5)fInformationControl ) |
947 fSizeConstraints= null; | 947 fSizeConstraints= null; |
948 fInformationControl.dispose(); | 948 fInformationControl.dispose(); |
949 fInformationControl= null; | 949 fInformationControl= null; |
950 } | 950 } |
951 fIsCustomInformationControl= true; | 951 fIsCustomInformationControl= true; |
1272 * control if no information should be presented. The information has previously | 1272 * control if no information should be presented. The information has previously |
1273 * been set using <code>setInformation</code>. | 1273 * been set using <code>setInformation</code>. |
1274 */ | 1274 */ |
1275 protected void presentInformation() { | 1275 protected void presentInformation() { |
1276 bool hasContents= false; | 1276 bool hasContents= false; |
1277 if (fInformation instanceof String) | 1277 if ( cast(String)fInformation ) |
1278 hasContents= (cast(String)fInformation).trim().length() > 0; | 1278 hasContents= (cast(String)fInformation).trim().length() > 0; |
1279 else | 1279 else |
1280 hasContents= (fInformation !is null); | 1280 hasContents= (fInformation !is null); |
1281 | 1281 |
1282 if (fSubjectArea !is null && hasContents) | 1282 if (fSubjectArea !is null && hasContents) |
1291 * | 1291 * |
1292 * @param subjectArea the information area | 1292 * @param subjectArea the information area |
1293 * @param information the information | 1293 * @param information the information |
1294 */ | 1294 */ |
1295 private void internalShowInformationControl(Rectangle subjectArea, Object information) { | 1295 private void internalShowInformationControl(Rectangle subjectArea, Object information) { |
1296 if (this instanceof InformationControlReplacer) { | 1296 if ( cast(InformationControlReplacer)this ) { |
1297 (cast(InformationControlReplacer) this).showInformationControl(subjectArea, information); | 1297 (cast(InformationControlReplacer) this).showInformationControl(subjectArea, information); |
1298 return; | 1298 return; |
1299 } | 1299 } |
1300 | 1300 |
1301 IInformationControl informationControl= getInformationControl(); | 1301 IInformationControl informationControl= getInformationControl(); |
1302 if (informationControl !is null) { | 1302 if (informationControl !is null) { |
1303 | 1303 |
1304 Point sizeConstraints= computeSizeConstraints(fSubjectControl, fSubjectArea, informationControl); | 1304 Point sizeConstraints= computeSizeConstraints(fSubjectControl, fSubjectArea, informationControl); |
1305 if (informationControl instanceof IInformationControlExtension3) { | 1305 if ( cast(IInformationControlExtension3)informationControl ) { |
1306 IInformationControlExtension3 iControl3= cast(IInformationControlExtension3) informationControl; | 1306 IInformationControlExtension3 iControl3= cast(IInformationControlExtension3) informationControl; |
1307 Rectangle trim= iControl3.computeTrim(); | 1307 Rectangle trim= iControl3.computeTrim(); |
1308 sizeConstraints.x += trim.width; | 1308 sizeConstraints.x += trim.width; |
1309 sizeConstraints.y += trim.height; | 1309 sizeConstraints.y += trim.height; |
1310 } | 1310 } |
1311 informationControl.setSizeConstraints(sizeConstraints.x, sizeConstraints.y); | 1311 informationControl.setSizeConstraints(sizeConstraints.x, sizeConstraints.y); |
1312 | 1312 |
1313 if (informationControl instanceof IInformationControlExtension2) | 1313 if ( cast(IInformationControlExtension2)informationControl ) |
1314 (cast(IInformationControlExtension2)informationControl).setInput(information); | 1314 (cast(IInformationControlExtension2)informationControl).setInput(information); |
1315 else | 1315 else |
1316 informationControl.setInformation(information.toString()); | 1316 informationControl.setInformation(information.toString()); |
1317 | 1317 |
1318 if (informationControl instanceof IInformationControlExtension) { | 1318 if ( cast(IInformationControlExtension)informationControl ) { |
1319 IInformationControlExtension extension= cast(IInformationControlExtension)informationControl; | 1319 IInformationControlExtension extension= cast(IInformationControlExtension)informationControl; |
1320 if (!extension.hasContents()) | 1320 if (!extension.hasContents()) |
1321 return; | 1321 return; |
1322 } | 1322 } |
1323 | 1323 |
1463 */ | 1463 */ |
1464 protected void storeInformationControlBounds() { | 1464 protected void storeInformationControlBounds() { |
1465 if (fDialogSettings is null || fInformationControl is null || !(fIsRestoringLocation || fIsRestoringSize)) | 1465 if (fDialogSettings is null || fInformationControl is null || !(fIsRestoringLocation || fIsRestoringSize)) |
1466 return; | 1466 return; |
1467 | 1467 |
1468 if (!(fInformationControl instanceof IInformationControlExtension3)) | 1468 if (!( cast(IInformationControlExtension3)fInformationControl )) |
1469 throw new UnsupportedOperationException(); | 1469 throw new UnsupportedOperationException(); |
1470 | 1470 |
1471 bool controlRestoresSize= (cast(IInformationControlExtension3)fInformationControl).restoresSize(); | 1471 bool controlRestoresSize= (cast(IInformationControlExtension3)fInformationControl).restoresSize(); |
1472 bool controlRestoresLocation= (cast(IInformationControlExtension3)fInformationControl).restoresLocation(); | 1472 bool controlRestoresLocation= (cast(IInformationControlExtension3)fInformationControl).restoresLocation(); |
1473 | 1473 |
1492 */ | 1492 */ |
1493 protected Rectangle restoreInformationControlBounds() { | 1493 protected Rectangle restoreInformationControlBounds() { |
1494 if (fDialogSettings is null || !(fIsRestoringLocation || fIsRestoringSize)) | 1494 if (fDialogSettings is null || !(fIsRestoringLocation || fIsRestoringSize)) |
1495 return null; | 1495 return null; |
1496 | 1496 |
1497 if (!(fInformationControl instanceof IInformationControlExtension3)) | 1497 if (!( cast(IInformationControlExtension3)fInformationControl )) |
1498 throw new UnsupportedOperationException(); | 1498 throw new UnsupportedOperationException(); |
1499 | 1499 |
1500 bool controlRestoresSize= (cast(IInformationControlExtension3)fInformationControl).restoresSize(); | 1500 bool controlRestoresSize= (cast(IInformationControlExtension3)fInformationControl).restoresSize(); |
1501 bool controlRestoresLocation= (cast(IInformationControlExtension3)fInformationControl).restoresLocation(); | 1501 bool controlRestoresLocation= (cast(IInformationControlExtension3)fInformationControl).restoresLocation(); |
1502 | 1502 |