@@ -72,11 +72,17 @@ Clazz.prepareCallback = function (objThis, args) {
7272 var className = Clazz . getClassName ( classThisObj , true ) ;
7373 //if (obs[className] == null) { /* == null make no sense! */
7474 //obs[className] = classThisObj;
75+ /*
76+ * TODO: the following line is SWT-specific! Try to move it out!
77+ */
7578 obs [ className . replace ( / o r g \. e c l i p s e \. s w t \. / , "$wt." ) ] = classThisObj ;
7679 var clazz = Clazz . getClass ( classThisObj ) ;
7780 while ( clazz . superClazz != null ) {
7881 clazz = clazz . superClazz ;
7982 //obs[Clazz.getClassName (clazz)] = classThisObj;
83+ /*
84+ * TODO: the following line is SWT-specific! Try to move it out!
85+ */
8086 obs [ Clazz . getClassName ( clazz , true )
8187 . replace ( / o r g \. e c l i p s e \. s w t \. / , "$wt." ) ] = classThisObj ;
8288 }
@@ -792,100 +798,3 @@ Clazz.forName = function (clazzName) {
792798 }
793799} ;
794800
795- /* protected */
796- Clazz . cssAlreadyAggregated = false ;
797- Clazz . cssForcedUsingFile = false ;
798-
799- /**
800- * Register css for the given class. If the given css text is null, it will
801- * try to find relative *.css file instead loading css text directly.
802- * @param clazzName Qualified name of a class
803- * @param cssText Optional, if given, it will loaded into the page directly.
804- */
805- /* public */
806- Clazz . registerCSS = function ( clazzName , cssText ) {
807- if ( Clazz . cssAlreadyAggregated || window [ "ClazzLoader" ] == null ) {
808- return ;
809- }
810- clazzName = ClazzLoader . unwrapArray ( [ clazzName ] ) [ 0 ] ;
811- var cssPath = ClazzLoader . getClasspathFor ( clazzName , false , ".css" ) ;
812-
813- var basePath = ClazzLoader . getClasspathFor ( clazzName , true ) ;
814- var cssID = "c$$." + clazzName ;
815- /*
816- * Check whether the css resources is loaded or not
817- */
818- if ( ! ClazzLoader . isResourceExisted ( clazzName , cssPath , basePath ) ) {
819- ClazzLoader . registeredCSSs [ ClazzLoader . registeredCSSs . length ] = clazzName ;
820- if ( cssText == null || Clazz . cssForcedUsingFile ) {
821- var cssLink = document . createElement ( "LINK" ) ;
822- cssLink . rel = "stylesheet" ;
823- cssLink . id = cssID ;
824- cssLink . href = cssPath ;
825- document . getElementsByTagName ( "HEAD" ) [ 0 ] . appendChild ( cssLink ) ;
826- } else {
827- var prefix = "" ;
828- var idx = cssPath . lastIndexOf ( "/" ) ;
829- if ( idx != - 1 ) {
830- prefix = cssPath . substring ( 0 , idx + 1 ) ;
831- }
832- if ( document . createStyleSheet != null ) {
833- // prepare for createStyleSheet with "javascript:...";
834- /*
835- * TODO: Make more tests on the correctness of prefix!
836- */
837- //var protocol = window.location.protocol;
838- //var host = window.location.host;
839- var location = window . location . href . toString ( ) ;
840- //if (protocol == "file:" || host == "") {
841- var idx = location . lastIndexOf ( "/" ) ;
842- if ( idx != - 1 ) {
843- prefix = location . substring ( 0 , idx + 1 ) + prefix ;
844- }
845- //}
846- }
847- /*
848- * Fix the css images location
849- */
850- cssText = cssText . replace ( / ( u r l \s * \( \s * [ ' " ] ) ( .* ) ( [ ' " ] ) / ig,
851- //"
852- function ( $0 , $1 , $2 , $3 ) {
853- if ( $2 . indexOf ( "/" ) == 0
854- || $2 . indexOf ( "http://" ) == 0
855- || $2 . indexOf ( "https://" ) == 0
856- || $2 . indexOf ( "file:/" ) == 0
857- || $2 . indexOf ( "ftp://" ) == 0
858- || $2 . indexOf ( "javascript:" ) == 0 ) {
859- return $0 ;
860- }
861- return $1 + prefix + $2 + $3 ;
862- } ) ;
863- if ( document . createStyleSheet != null ) {
864- /*
865- * Internet Explorer does not support loading dynamic css styles
866- * by creating <STYLE> element!
867- */
868- var sheet = document . createStyleSheet ( ) ;
869- sheet . cssText = cssText ;
870- //sheet.id = cssID; // No ID support the this element for IE
871- window [ cssID ] = true ;
872- } else {
873- var cssStyle = document . createElement ( "STYLE" ) ;
874- cssStyle . id = cssID ;
875- cssStyle . appendChild ( document . createTextNode ( cssText ) ) ;
876- document . getElementsByTagName ( "HEAD" ) [ 0 ] . appendChild ( cssStyle ) ;
877- }
878- }
879-
880- var len = ClazzLoader . themes . length ;
881- for ( var i = 0 ; i < len ; i ++ ) {
882- var themeName = ClazzLoader . themes [ i ] ;
883- var themePath = ClazzLoader . themePaths [ themeName ] + "/" + clazzName . replace ( / \. / g, "/" ) + ".css" ;
884- var cssLink = document . createElement ( "LINK" ) ;
885- cssLink . rel = "stylesheet" ;
886- cssLink . id = cssID + themeName ;
887- cssLink . href = themePath ;
888- document . getElementsByTagName ( "HEAD" ) [ 0 ] . appendChild ( cssLink ) ;
889- }
890- }
891- } ;
0 commit comments