Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » org.eclipse.ui.intro and Google Maps
org.eclipse.ui.intro and Google Maps [message #481804] Mon, 24 August 2009 11:45 Go to next message
Eclipse UserFriend
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&amp;v=2&amp;key=abc&amp;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&amp;v=2&amp;key=abc&amp;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();
}
Re: org.eclipse.ui.intro and Google Maps [message #482120 is a reply to message #481804] Tue, 25 August 2009 12:46 Go to previous message
Eclipse UserFriend
Originally posted by: roald.hopman.industrial-tsi.com

Solved! :)

It turns out the Google Maps API doesn't work with XHTML. So concept2.html
works via org.eclipse.ui.intro if I leave out the XHTML doctype.

More information :
http://www.nczonline.net/blog/2006/03/27/google-maps-api-no- xhtml-support/
http://groups.google.com/group/Google-Maps-API/browse_thread /thread/af7269ab1bb48767
Previous Topic:Add scroll bars to composite
Next Topic:Re: How to add StructuredTextEditor to MultiPageEditor
Goto Forum:
  


Current Time: Fri Apr 19 01:54:21 GMT 2024

Powered by FUDForum. Page generated in 0.01629 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top