示例#1
0
 public final void testPropMgt() {
   final Editable itemOne =
       new FixWrapper(new Fix(new HiResDate(122333), new WorldLocation(1, 2, 3), 12, 14));
   final Editable itemTwo =
       new FixWrapper(new Fix(new HiResDate(122334), new WorldLocation(1, 2, 5), 13, 12));
   final Editable itemThree = new SensorWrapper("alpha");
   final Editable[] lst = new Editable[] {itemOne, itemTwo};
   final Editable[] lst2 = new Editable[] {itemOne, itemThree};
   final Editable[] lst3 = new Editable[] {itemThree, itemOne, itemThree};
   final Editable[] lst4 = new Editable[] {itemThree, itemThree};
   final Editable[] lst5 = new Editable[] {itemOne};
   assertEquals("no data", 2, lst.length);
   PropertyDescriptor[] props = RightClickSupport.getCommonPropertiesFor(lst);
   assertNotNull("found some data", props);
   assertEquals("found right matches", 13, props.length);
   props = RightClickSupport.getCommonPropertiesFor(lst2);
   assertNotNull("found some data", props);
   assertEquals("found right matches", 1, props.length);
   props = RightClickSupport.getCommonPropertiesFor(lst3);
   assertNotNull("found some data", props);
   assertEquals("found right matches", 1, props.length);
   props = RightClickSupport.getCommonPropertiesFor(lst4);
   assertNotNull("found some data", props);
   assertEquals("found right matches", 9, props.length);
   props = RightClickSupport.getCommonPropertiesFor(lst5);
   assertNotNull("found some data", props);
   assertEquals("found right matches", 13, props.length);
 }
示例#2
0
    public final void testAdditionalSomePresent() {
      LabelWrapper lw = new LabelWrapper("Some label", new WorldLocation(1.1, 1.1, 12), Color.red);
      Editable[] editables = new Editable[] {lw};
      MenuManager menu = new MenuManager("Holder");

      RightClickSupport.getDropdownListFor(menu, editables, null, null, null, true);

      // note: this next test may return 4 if run from within IDE,
      // some contributions provided by plugins
      assertEquals("Has items", 2, menu.getSize(), 2);
    }
示例#3
0
    public final void testAdditionalNonePresent() {
      ShapeWrapper sw =
          new ShapeWrapper(
              "rect",
              new RectangleShape(
                  new WorldLocation(12.1, 12.3, 12), new WorldLocation(1.1, 1.1, 12)),
              Color.red,
              new HiResDate(2222));
      Editable[] editables = new Editable[] {sw};
      MenuManager menu = new MenuManager("Holder");

      RightClickSupport.getDropdownListFor(menu, editables, null, null, null, true);

      boolean foundTransparent = false;

      // note: this next test may return 4 if run from within IDE,
      // some contributions provided by plugins
      assertEquals("Has items", 2, menu.getSize(), 2);

      IContributionItem[] items = menu.getItems();
      for (int i = 0; i < items.length; i++) {
        IContributionItem thisI = items[i];
        if (thisI instanceof MenuManager) {
          MenuManager subMenu = (MenuManager) thisI;
          IContributionItem[] subItems = subMenu.getItems();
          for (int j = 0; j < subItems.length; j++) {
            IContributionItem subI = subItems[j];
            if (subI instanceof ActionContributionItem) {
              ActionContributionItem ac = (ActionContributionItem) subI;
              String theName = ac.getAction().getText();
              if (theName.equals("Semi transparent")) foundTransparent = true;
            }
          }
        }
      }

      assertTrue("The additional bean info got processed!", foundTransparent);
    }
示例#4
0
  /** 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());
  }