예제 #1
0
  @Before
  public void setUp() {
    when(fileTypeRegistry.getFileTypeByFile(file)).thenReturn(fileType);
    when(fileTypeRegistry.getFileTypeByFile(newFileNode)).thenReturn(fileType);
    when(fileTypeRegistry.getFileTypeByFile(fileNode2)).thenReturn(fileType);
    when(editorRegistry.getEditor(fileType)).thenReturn(editorProvider);
    when(editorProvider.getEditor()).thenReturn(editor);
    when(file.getPath()).thenReturn(PATH);
    when(newFileNode.getPath()).thenReturn(NEW_PATH);

    when(editor.getEditorInput()).thenReturn(editorInput);
    when(editorInput.getFile()).thenReturn(file);

    editorAgent =
        new EditorAgentImpl(
            eventBus,
            fileTypeRegistry,
            editorRegistry,
            workspace,
            notificationManager,
            coreLocalizationConstant,
            nodeManager,
            projectServiceClient,
            appContext,
            dtoUnmarshallerFactory);
  }
예제 #2
0
  @Override
  public void onFileOperation(FileEvent event) {
    if (event.getOperationType() != FileEvent.FileOperation.CLOSE) {
      return;
    }

    final String eventFilePath = event.getFile().getPath();
    final String filePath = input.getFile().getPath();
    if (filePath.equals(eventFilePath)) {
      workspaceAgent.removePart(this);
    }
  }
  @Before
  public void setUp() {
    when(appContext.getCurrentProject()).thenReturn(currentProject);

    when(environment.getScope()).thenReturn(SYSTEM);
    when(environment.getPath()).thenReturn(TEXT);
    when(environment.getName()).thenReturn(TEXT);
    when(environment.getType()).thenReturn(TEXT);
    when(environment.getRam()).thenReturn(MB_500.getValue());

    when(currentProject.getCurrentTree()).thenReturn(treeStructure);
    when(currentProject.getProjectDescription()).thenReturn(descriptor);

    when(fileTypeRegistry.getFileTypeByFile(file)).thenReturn(fileType);
    when(editorProvider.getEditor()).thenReturn(editor);

    when(editor.getEditorInput()).thenReturn(editorInput);
    when(editorInput.getFile()).thenReturn(file);

    presenter = new DummyPanelProperties(view, appContext);
  }