/** see if any extra right click handlers are defined */ private static void loadLoaderExtensions() { IExtensionRegistry registry = Platform.getExtensionRegistry(); if (registry != null) { final IExtensionPoint point = registry.getExtensionPoint(PLUGIN_ID, EXTENSION_POINT_ID); final IExtension[] extensions = point.getExtensions(); for (int i = 0; i < extensions.length; i++) { final IExtension iExtension = extensions[i]; final IConfigurationElement[] confE = iExtension.getConfigurationElements(); for (int j = 0; j < confE.length; j++) { final IConfigurationElement iConfigurationElement = confE[j]; RightClickContextItemGenerator newInstance; try { newInstance = (RightClickContextItemGenerator) iConfigurationElement.createExecutableExtension("class"); addRightClickGenerator(newInstance); } catch (final CoreException e) { CorePlugin.logError( Status.ERROR, "Trouble whilst loading right-click handler extensions", e); } } } } }
/** This method is called upon plug-in activation */ @Override public void start(final BundleContext context) throws Exception { super.start(context); // also provide someps extra functionality to the right-click editor RightClickSupport.addRightClickGenerator(new GenerateTrack()); RightClickSupport.addRightClickGenerator(new GroupTracks()); RightClickSupport.addRightClickGenerator(new GenerateInfillSegment()); RightClickSupport.addRightClickGenerator(new MergeTracks()); RightClickSupport.addRightClickGenerator(new MergeContacts()); RightClickSupport.addRightClickGenerator(new GenerateTMASegment()); RightClickSupport.addRightClickGenerator(new GenerateTUASolution()); RightClickSupport.addRightClickGenerator(new GenerateTrackFromActiveCuts()); RightClickSupport.addRightClickGenerator(new GenerateSensorRangePlot()); RightClickSupport.addRightClickGenerator(new GenerateNewSensor()); RightClickSupport.addRightClickGenerator(new GenerateNewSensorContact()); RightClickSupport.addRightClickGenerator(new GenerateNewNarrativeEntry()); RightClickSupport.addRightClickGenerator(new ImportAsTrack()); RightClickSupport.addRightClickGenerator(new TrimTrack()); RightClickSupport.addRightClickGenerator(new RainbowShadeSonarCuts()); RightClickSupport.addRightClickGenerator(new InterpolateTrack()); // and the Replay importer/exporter (used to export items from the // layer-manager) ImportManager.addImporter(new Debrief.ReaderWriter.Replay.ImportReplay()); // make Debrief the default editor for XML files final IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); editorRegistry.setDefaultEditor("*.xml", "org.mwc.debrief.PlotEditor"); // tell the message provider where it can fire messages to MessageProvider.Base.setProvider(this); _myImageHelper = new DebriefImageHelper(); // give the LayerManager our image creator. CoreViewLabelProvider.addImageHelper(_myImageHelper); // provide helper for triggering 'new-leg' operation final GiveMeALeg triggerNewLeg = new GiveMeALeg() { @Override public void createLegFor(final Layer parent) { final InsertTrackSegment ts = new InsertTrackSegment(parent); ts.run(null); } }; CompositeTrackWrapper.setNewLegHelper(triggerNewLeg); CompositeTrackWrapper.initialise(CorePlugin.getToolParent()); AISDecoder.initialise(CorePlugin.getToolParent()); }