Package org.tuba.plugins

Examples of org.tuba.plugins.IEditorConnector


    Tuple<ITutorialDocument, IEditorConnector> tuple = getTutorialDocument();
    if (tuple == null)
      return;

    ITutorialDocument document = tuple.getLeft();
    IEditorConnector editorConnector = tuple.getRight();
    tuple = null;

    boolean doIntegration = false;
    for (ArtefactLocation location : artefactLocations) {
      String providerID = location.getProviderID();
      String artefactID = location.getArtefactID();
      if (providerID == null || artefactID == null)
        continue;
      XMLProvider provider = new XMLProvider(providerID,
          artefactID);
      XMLReference reference = new XMLReference(provider);
      IntegrationDialog dialog = new IntegrationDialog(PlatformUI
          .getWorkbench().getActiveWorkbenchWindow().getShell(),
          document);
      if (dialog.open() != Dialog.OK)
        continue;

      for (MetaArtefactOperation operation : dialog.getOperations()) {
        XMLArtefactOperation o = new XMLArtefactOperation(operation
            .getId());
        o.setConfiguration(operation.getConfiguration());
        reference.getOperations().add(o);
      }

      MetaIntegrator integrator = dialog.getIntegrator();
      if (integrator != null) {
        XMLIntegrator i = new XMLIntegrator(integrator.getId());
        i.setConfiguration(integrator.getConfiguration());
        reference.setIntegrator(i);
      }

      XMLArtefact artefactTag = ReferenceManager.getInstance()
          .generateArtefact(document, reference);

      if (editorConnector.insertTag(document, artefactTag.toString()))
        doIntegration = true;
    }

    if (doIntegration) {
      IntegrationJob job = new IntegrationJob(document);
View Full Code Here


 
  private Tuple<ITutorialDocument, IEditorConnector> getTutorialDocument() {
    IEditorPart editorPart = getCurrentEditor();
    if (editorPart == null)
      return null;
    IEditorConnector editorConnector = EditorConnectorManager.getInstance()
        .getEditorConnector(editorPart);
    if (editorConnector == null)
      return null;

    ITutorialDocument document = editorConnector.getDocument(editorPart);
    if (document == null)
      return null;

    return new Tuple<ITutorialDocument, IEditorConnector>(document,
        editorConnector);
View Full Code Here

  /** private constructor because of singleton pattern */
  private EditorConnectorManager() {
    super();
    // TODO in some extension point
    IEditorConnector editorConnector = new OOEditorConnector();
    editorMap.put(OfficeEditor.class.getName(), editorConnector);
    addOOExtensions(editorConnector);
  }
View Full Code Here

  public void partClosed(IWorkbenchPart part) {
    if (!(part instanceof IEditorPart))
      return;
    IEditorPart editor = (IEditorPart) part;
    IEditorConnector editorConnector = EditorConnectorManager.getInstance()
        .getEditorConnector(editor);
    if (editorConnector == null)
      return;

    ITutorialDocument tutorialDocument = editorConnector
        .getDocument(editor);
    DocumentManager.getInstance().removeDocument(tutorialDocument);
  }
View Full Code Here

  public void partOpened(IWorkbenchPart part) {
    if (!(part instanceof IEditorPart))
      return;
    IEditorPart editor = (IEditorPart) part;
    IEditorConnector editorConnector = EditorConnectorManager.getInstance()
        .getEditorConnector(editor);
    if (editorConnector == null)
      return;

    ITutorialDocument tutorialDocument = editorConnector
        .getDocument(editor);
    editorConnector.replaceSaveRoutine(editor, tutorialDocument);

    DocumentManager.getInstance().addDocument(tutorialDocument,
        editorConnector);
    integrateArtefacts(tutorialDocument);
  }
View Full Code Here

      ITutorialDocument document = DocumentManager.getInstance()
          .getTutorialDocument(file);

      if (document != null) {
        IEditorConnector editorConnector = DocumentManager
            .getInstance().getDocumentInfo(document)
            .getEditorConnector();
        editorConnector.saveAs(document, generateTarget(resource));
      } else {
        Tuple<ITutorialDocument, IEditorConnector> tuple = loadDocument(file);
        if (tuple != null) {
          document = tuple.getLeft();
          integrateArtefacts(document);
          IEditorConnector editorConnector = tuple.getRight();
          editorConnector.saveAs(document, generateTarget(resource));
        }
      }

      monitor.worked(1);
    }
View Full Code Here

    return Status.OK_STATUS;
  }

  private Tuple<ITutorialDocument, IEditorConnector> loadDocument(IFile file) {
    IEditorConnector editorConnector = EditorConnectorManager.getInstance()
        .getEditorConnectorForExtension(file.getFileExtension());
    if (editorConnector == null)
      return null;

    ITutorialDocument document = editorConnector.loadDocument(file);

    if (document == null)
      return null;

    return new Tuple<ITutorialDocument, IEditorConnector>(document,
View Full Code Here

TOP

Related Classes of org.tuba.plugins.IEditorConnector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.