Eclipse tips and tricks

From Aptana Development

This page lists tips for common issues that you may encounter while using Eclipse to do your Aptana development.

Exporting a plugin

  • If plugin export is hanging (particuarly at 0%), check that you do not have a cycle where two plugins or features are dependent on each other.
  • Check that plugin.xml is included in the build if your plugin extension points don't work.
  • Check that update site URL (for feature.xml) ends in a "/"
  • A "qualifier" suffix for version is compared as a string, so make sure to pad numbers with 0's. See the example below.
  <condition property="build.number" value="0000${build.number.temp}">
     <length string="${build.number.temp}" trim="true" length="1"/>
  </condition>

Working with features and update URLS

Every feature has an associated update URL that is stored in the feature.xml file. However, updating this programmatically can be difficult. The following tips should help.

Note: In this example, we wish to modify the update URL.

  • The overview pane for editing feature.xml accepts "ftp", "http", "https", "file", and "gopher" as protocols. You may enter other protocols in the actual .xml file, but the editor box will display an error.
  • If you manually enter a protocol in the feature.xml file, the overview box will show the field as blank. If you edit anything else on that page, the protocol value will be erased from the feature.xml file.
  • The getURL() in feature is the location of the feature on disk. This, so overriding feature.setContentProvider() and providing a new provider with a different getURL() method will not work.
  • You can try editing FeatureModel. Feature derives from FeatureModel, and FeatureModel contains a URLEntryModel. There is an internal getURLString method which does give back the correct URL. However, both URLEntryModel and FeatureModel have read-only flags set, so updating any of these values throws an exception. (See the example below.)
 if(features.length == 1)
 {
   FeatureModel f = (FeatureModel)features[0];
   try
   {
      URLEntryModel entry = (URLEntryModel)f.getUpdateSiteEntryModel();
      URLEntryModel newModel = new URLEntryModel();
      newModel.setAnnotation(entry.getAnnotation());
      newModel.setType(entry.getType());
      newModel.setURLString(entry.getURLString() + "site.xml?platform=32");
      newModel.resolve(entry.getURL(), entry.getURL());
      f.setUpdateSiteEntryModel(newModel);
   }
   catch(Exception ex) {
      String s = ex.getMessage();
      s += "a";
   }
 }
</p>

* You can use three methods to update '''searchRequest''' when searching for features and provide a map file:
** Provide a map file in the '''preference_customization.ini''' file for the main feature plugin. In general, this works by providing an alternate URL for the user to visit when prompted with a specific feature id. Although this method works, you will need to update  specified '''map.xml''' file to add the UID into the query string. It overrides an organization from providing their own map file (which can be useful at times, to control which updates people are downloading for which products).
** The second method is to modify the URL programmatically. The disadvantage to this is that you need to update the '''searchrequest''' with a value for your custom-generated map file. Not only does this mean you need to custom-generate a map file at installation, but you also need to hook this in every time you do an update. 
<pre>
 UpdateSearchRequest searchRequest = UpdateUtils.createNewUpdatesRequest(features);
 UpdateSearchScope scope = new UpdateSearchScope();
 scope.setUpdateMapURL(new URL("http://localhost/map.xml"));
 searchRequest.setScope(scope);
  • Finally, you can provide a custom URL Stream Handler. So far, this appears to work well, and works by specifying your update url as something like aptana://. At startup, you then create a URLStreamHandler that knows what to do with an aptana:// url, and modifies it an passes it on. The con is the issue with editing the feature.xml file mentioned at the start of this list.

Related Topics



Aptana Developer Home