org.eclipse.ui.intro and Google Maps [message #481804] |
Mon, 24 August 2009 11:45 |
Eclipse User |
|
|
|
Originally posted by: roald.hopman.industrial-tsi.com
Hey,
I'm quite new to Eclipse. I'm trying to make an intro page using
javascript and the Google Maps API. For some reason the only approach
which works is linking to the html page inside the root.xhtml. When I'm
using the http://org.eclipse.ui.intro approach I'm only getting a white
page. When linking to the xhtml page inside the root.xhtml I'm only seeing
my alerts but no google maps.
Thank you very much in advance,
Regards,
Roald Hopman
introContent.xml ::
<?xml version="1.0" encoding="utf-8" ?>
<introContent>
<page id="root" content="content/root.xhtml"/>
<page id="concept1" content="content/concept1.xhtml"/>
<page id="concept2" content="content/concept2.html"/>
</introContent>
root.xml ::
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content="application/xhtml+xml;charset=utf-8"/>
<title>root.xhtml</title>
<link rel="stylesheet" href="shared.css" type="text/css" />
<link rel="stylesheet" href="root.css" type="text/css" />
</head>
<body>
<h1>Welcome to RCP Product</h1>
<div class="page-style">
<div id="content">
<a href="http://org.eclipse.ui.intro/showPage?id=concept1"
id="firstLink">
<img border="0" src="link_obj.gif" alt="Concept1" />
XHTML via org.eclipseui.intro
</a>
<a href="http://org.eclipse.ui.intro/showPage?id=concept2">
<img border="0" src="link_obj.gif" alt="Concept2" />
HTML via org.eclipseui.intro.</a>
<a href="concept1.xhtml">
<img border="0" src="link_obj.gif" alt="Concept2" />
XHTML normal</a>
<a href="concept2.html">
<img border="0" src="link_obj.gif" alt="Concept2" />
HTML normal</a>
<anchor id="anchor1" />
</div>
</div>
</body>
</html>
concept1.xhtml ::::
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type"
content="application/xhtml+xml;charset=uft-8"/>
<title>Google Maps JavaScript API Example</title>
<script
src="http://maps.google.com/maps?file=api&v=2&key=abc&sensor=false"
type="text/javascript"></script>
<script src="maps.js" type="text/javascript">
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 640px; height: 480px"></div>
</body>
</html>
concept2.html ::::
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example</title>
<script
src="http://maps.google.com/maps?file=api&v=2&key=abc&sensor=false"
type="text/javascript"></script>
<script src="maps.js" type="text/javascript">
</script>
</head>
<body onload="initialize()" onunload="GUnload()">
<div id="map_canvas" style="width: 640px; height: 480px"></div>
</body>
</html>
maps.js ::::
alert('maps.js: Hello World!');
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
alert("Browser: "+ browser + version);
function addMarker(point,html){
// Create our "tiny" marker icon
// var blueIcon = new GIcon(G_DEFAULT_ICON);
// eclipse.image = "eclipse_icon.jpg";
// Set up our GMarkerOptions object
// markerOptions = { icon:eclipse };
var marker = new GMarker(point);
GEvent.addListener(marker,"click",function(){
marker.openInfoWindowHtml(html);
});
return marker;
}
function initialize() {
alert('maps.js init: Hello World!');
var mapOptions = {googleBarOptions : {style : "new"}};
var map = new
GMap2(document.getElementById("map_canvas"),mapOptions);
map.addControl(new GLargeMapControl3D());
// map.setMapType(G_HYBRID_MAP);
map.setCenter(new GLatLng(52.01, 5.1), 6);
var jsonData = {"markers": [
{"lat":52.040582100000002, "lng":5.0782549000000001,
"html":"<B>Industrial-TSI</B><BR/>Total Support Initiative<BR/>Eclipse and
Open Source services"},
{"lat":48.741638999999999, "lng":9.2970073000000006,
"html":"<B>Weigle Wilczek</B><BR/>OSGi and Eclipse"},
{"lat":50.713862900000002, "lng":7.1320464000000001,
"html":"<B>Sopera</B><BR/>Service-Oriented Architectures"}
]
};
for(var i=0; i<jsonData.markers.length;i++){
var point = new
GLatLng(jsonData.markers[i].lat,jsonData.markers[i].lng);
var marker = addMarker(point,jsonData.markers[i].html);
map.addOverlay(marker);
}
map.setUIToDefault();
map.enableGoogleBar();
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.03481 seconds