コード例 #1
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    structureModelBridge = new EcoreGmfDomainBridge();

    monitor =
        new DiagramUiEditingMonitor(
            structureModelBridge, EcoreToolsNavigatorUiBridge.getInstance());
    MonitorUi.getSelectionMonitors().add(monitor);
  }
コード例 #2
0
  public void testSelection() throws Exception {

    structureModelBridge = new EcoreGmfDomainBridge();

    activeContext = ContextCore.getContextManager().getActiveContext();
    assertNotNull(activeContext);

    monitor = new DiagramUiEditingMonitor(structureModelBridge, EcoreDiagramUiBridge.getInstance());
    MonitorUi.getSelectionMonitors().add(monitor);

    try {
      Thread.sleep(1000);
    } catch (InterruptedException e) {
    }

    IFile file = getEmfProject().getProject().getFile("model/library.ecorediag");
    assertNotNull(file);

    try {
      Thread.sleep(500);
    } catch (InterruptedException e) {
    }

    StructuredSelection selection = new StructuredSelection(file);

    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    ProjectExplorer pe =
        (ProjectExplorer) page.showView("org.eclipse.ui.navigator.ProjectExplorer");
    pe.getCommonViewer().setSelection(selection);
    monitor.handleWorkbenchPartSelection(pe, selection, true);

    //		assertNotNull(activeContext);
    //		assertEquals(activeContext.getAllElements().size(), 1);
    //		//should this be resource type?
    //		assertEquals(activeContext.getAllElements().get(0).getContentType(), "ecore");
    //		assertEquals(activeContext.getAllElements().get(0).getHandleIdentifier(),
    //				"/org.eclipse.mylyn.modeling.tests.ecorediagram/model/library.ecore");
    //		assertTrue(activeContext.getAllElements().get(0).getInterest().isInteresting());
  }