Пример #1
0
  private void createEditor(final String content) {
    this.fileTypes = detectFileType(getEditorInput().getFile());
    this.editorWidget = editorWigetFactory.createEditorWidget(fileTypes);

    // finish editor initialization
    this.editorView.setEditorWidget(this.editorWidget);

    this.document = this.editorWidget.getDocument();
    this.document.setFile(input.getFile());
    this.cursorModel = new EmbeddedEditorCursorModel(this.document);

    this.editorWidget.setTabSize(this.configuration.getTabWidth());

    // initialize info panel
    this.editorView.initInfoPanel(
        this.editorWidget.getMode(),
        this.editorWidget.getEditorType(),
        this.editorWidget.getKeymap(),
        this.document.getLineCount(),
        this.configuration.getTabWidth());

    // handle delayed focus
    // should also check if I am visible, but how ?
    if (delayedFocus) {
      this.editorWidget.setFocus();
      this.delayedFocus = false;
    }

    // delayed keybindings creation ?
    switchHasKeybinding();

    this.editorWidget.setValue(content);
    this.generalEventBus.fireEvent(new DocumentReadyEvent(this.getEditorHandle(), this.document));

    final OutlineImpl outline = getOutline();
    if (outline != null) {
      outline.bind(this.cursorModel, this.document);
    }

    firePropertyChange(PROP_INPUT);

    setupEventHandlers();
    setupFileContentUpdateHandler();
  }