Examples of IStructuredModel


Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

    super();
    initializeDocumentProvider(null);
  }

  private IStructuredModel aboutToSaveModel() {
    IStructuredModel model = getInternalModel();
    if (model != null) {
      model.aboutToChangeModel();
    }
    return model;
  }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

   * (non-Javadoc)
   *
   * @see org.eclipse.ui.ISaveablePart#doSave(org.eclipse.core.runtime.IProgressMonitor)
   */
  public void doSave(IProgressMonitor progressMonitor) {
    IStructuredModel model = null;
    try {
      model = aboutToSaveModel();
      updateEncodingMemento();
      super.doSave(progressMonitor);
    }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

      fStructuredModel.releaseFromEdit();
    }

    //attempt to get the model for the given input
    super.doSetInput(input);
    IStructuredModel model = tryToGetModel(input);
   
    /* if could not get the model prompt user to update content type
     * if preferences allow, then try to get model again
     */
    if(model == null &&  SSEUIPlugin.getDefault().getPreferenceStore().getBoolean(EditorPreferenceNames.SHOW_UNKNOWN_CONTENT_TYPE_MSG)) {
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

   *
   * @return The {@link IStructuredModel} associated with the given {@link IEditorInput} or
   * <code>null</code> if no associated {@link IStructuredModel} could be found.
   */
  private IStructuredModel tryToGetModel(IEditorInput input) {
    IStructuredModel model = null;
   
    IDocument newDocument = getDocumentProvider().getDocument(input);
    if (newDocument instanceof IExecutionDelegatable) {
      ((IExecutionDelegatable) newDocument).setExecutionDelegate(new EditorExecutionContext(this));
    }

    // if we have a Model provider, get the model from it
    if (getDocumentProvider() instanceof IModelProvider) {
      model = ((IModelProvider) getDocumentProvider()).getModel(getEditorInput());
      if (!model.isShared()) {
        EditorModelUtil.addFactoriesTo(model);
      }
    }
    else if (newDocument instanceof IStructuredDocument) {
      // corresponding releaseFromEdit occurs in dispose()
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

    if (org.eclipse.wst.sse.core.internal.util.Debug.perfTestAdapterClassLoading) {
      startPerfTime = System.currentTimeMillis();
    }
    Object result = null;
    // text editor
    IStructuredModel internalModel = getInternalModel();
    if (ITextEditor.class.equals(required) || ITextEditorExtension5.class.equals(required) || ITextEditorExtension4.class.equals(required) || ITextEditorExtension3.class.equals(required) || ITextEditorExtension2.class.equals(required) || ITextEditorExtension.class.equals(required)) {
      result = this;
    }
    else if (IWorkbenchSiteProgressService.class.equals(required)) {
      return getEditorPart().getSite().getAdapter(IWorkbenchSiteProgressService.class);
    }
    // content outline page
    else if (IContentOutlinePage.class.equals(required)) {
      if (fOutlinePage == null || fOutlinePage.getControl() == null || fOutlinePage.getControl().isDisposed()) {
        ContentOutlineConfiguration cfg = createContentOutlineConfiguration();
        if (cfg != null) {
          ConfigurableContentOutlinePage outlinePage = new ConfigurableContentOutlinePage();
          outlinePage.setConfiguration(cfg);
          if (internalModel != null) {
            outlinePage.setInputContentTypeIdentifier(internalModel.getContentTypeIdentifier());
            outlinePage.setInput(internalModel);
          }

          if (fOutlinePageListener == null) {
            fOutlinePageListener = new OutlinePageListener();
          }

          outlinePage.addSelectionChangedListener(fOutlinePageListener);
          outlinePage.addDoubleClickListener(fOutlinePageListener);

          fOutlinePage = outlinePage;
        }
      }
      result = fOutlinePage;
    }
    // property sheet page, but only if the input's editable
    else if (IPropertySheetPage.class.equals(required) && isEditable()) {
      if (fPropertySheetPage == null || fPropertySheetPage.getControl() == null || fPropertySheetPage.getControl().isDisposed()) {
        PropertySheetConfiguration cfg = createPropertySheetConfiguration();
        if (cfg != null) {
          ConfigurablePropertySheetPage propertySheetPage = new ConfigurablePropertySheetPage();
          propertySheetPage.setConfiguration(cfg);
          fPropertySheetPage = propertySheetPage;
        }
      }
      result = fPropertySheetPage;
    }
    else if (IDocument.class.equals(required)) {
      result = getDocumentProvider().getDocument(getEditorInput());
    }
    else if (ISourceEditingTextTools.class.equals(required)) {
      result = createSourceEditingTextTools();
    }
    else if (IToggleBreakpointsTarget.class.equals(required)) {
      result = ToggleBreakpointsTarget.getInstance();
    }
    else if (ITextEditorExtension4.class.equals(required)) {
      result = this;
    }
    else if (IShowInTargetList.class.equals(required)) {
      result = new ShowInTargetListAdapter();
    }
    else if (IVerticalRuler.class.equals(required)) {
      return getVerticalRuler();
    }
    else if (SelectionHistory.class.equals(required)) {
      if (fSelectionHistory == null)
        fSelectionHistory = new SelectionHistory(this);
      result = fSelectionHistory;
    }
    else if (IResource.class.equals(required)) {
      IEditorInput input = getEditorInput();
      if (input != null) {
        result = input.getAdapter(required);
      }
    }
    else {
      if (result == null && internalModel != null) {
        result = internalModel.getAdapter(required);
      }
      // others
      if (result == null)
        result = super.getAdapter(required);
    }
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

        if (doc instanceof IStructuredDocument) {
          /*
           * Called in this manner because getExistingModel can skip
           * some calculations always performed in getModelForEdit
           */
          IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc);
          if (model == null) {
            model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument) doc);
          }
          fStructuredModel = model;
          fisReleased = false;
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

    action = getAction("FoldingExpandAll"); //$NON-NLS-1$
    foldingMenu.add(action);
    action = getAction("FoldingCollapseAll"); //$NON-NLS-1$
    foldingMenu.add(action);

    IStructuredModel internalModel = getInternalModel();
    if (internalModel != null) {
      boolean debuggingAvailable = BreakpointProviderBuilder.getInstance().isAvailable(internalModel.getContentTypeIdentifier(), BreakpointRulerAction.getFileExtension(getEditorInput()));
      if (debuggingAvailable) {
        // append actions to "debug" group (created in
        // AbstractDecoratedTextEditor.rulerContextMenuAboutToShow(IMenuManager)
        menu.appendToGroup("debug", getAction(ActionDefinitionIds.TOGGLE_BREAKPOINTS)); //$NON-NLS-1$
        menu.appendToGroup("debug", getAction(ActionDefinitionIds.MANAGE_BREAKPOINTS)); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

   */
  public void update() {
    if (fOutlinePage != null && fOutlinePage instanceof ConfigurableContentOutlinePage) {
      ContentOutlineConfiguration cfg = createContentOutlineConfiguration();
      ((ConfigurableContentOutlinePage) fOutlinePage).setConfiguration(cfg);
      IStructuredModel internalModel = getInternalModel();
      ((ConfigurableContentOutlinePage) fOutlinePage).setInputContentTypeIdentifier(internalModel.getContentTypeIdentifier());
      ((ConfigurableContentOutlinePage) fOutlinePage).setInput(internalModel);
    }
    if (fPropertySheetPage != null && fPropertySheetPage instanceof ConfigurablePropertySheetPage) {
      PropertySheetConfiguration cfg = createPropertySheetConfiguration();
      ((ConfigurablePropertySheetPage) fPropertySheetPage).setConfiguration(cfg);
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

    }
  }
 
  private void updateEncodingMemento() {
    boolean failed = false;
    IStructuredModel internalModel = getInternalModel();
    if (internalModel != null) {
      IStructuredDocument doc = internalModel.getStructuredDocument();
      EncodingMemento memento = doc.getEncodingMemento();
      IDocumentCharsetDetector detector = internalModel.getModelHandler().getEncodingDetector();
      if (memento != null && detector != null) {
        detector.set(doc);
        try {
          String newEncoding = detector.getEncoding();
          if (newEncoding != null) {
View Full Code Here

Examples of org.eclipse.wst.sse.core.internal.provisional.IStructuredModel

    if (input == null)
      return null;
    // create temporary model
    String id = input.toString() + ".html"; //$NON-NLS-1$
    IModelManager manager = StructuredModelManager.getModelManager();
    IStructuredModel model = manager.getModelForEdit(id, input, null);
    if (!(model instanceof IDOMModel)) {
      if (model != null)
        model.releaseFromEdit();
      return null;
    }
    return (IDOMModel) model;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.