Examples of XtextEditor


Examples of org.eclipse.xtext.ui.editor.XtextEditor

final class ProtobufValidation {
  static void validate(IEditorPart editor) {
    if (!(editor instanceof XtextEditor) || !(editor.getEditorInput() instanceof FileEditorInput)) {
      return;
    }
    XtextEditor xtextEditor = (XtextEditor) editor;
    if (!ProtobufEditorPlugIn.protobufLanguageName().equals(xtextEditor.getLanguageName())) {
      return;
    }
    validate(xtextEditor);
  }
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

* @author alruiz@google.com (Alex Ruiz)
*/
public abstract class SmartInsertHandler extends AbstractHandler {
  /** {@inheritDoc} */
  @Override public final Object execute(ExecutionEvent event) {
    XtextEditor activeEditor = getActiveXtextEditor();
    if (activeEditor != null) {
      insertContent(activeEditor, styledTextFrom(activeEditor));
    }
    return null;
  }
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

  }

  @Override
  public void partActivated(final IWorkbenchPart part) {
    if (part instanceof XtextEditor) {
      XtextEditor xtextEditor = (XtextEditor) part;
      IXtextDocument xtextDocument = xtextEditor.getDocument();
      if (xtextDocument != lastActiveDocument) {
        selectionLinker.setXtextEditor(xtextEditor);
        final IFigure contents = xtextDocument.readOnly(new IUnitOfWork<IFigure, XtextResource>() {
          @Override
          public IFigure exec(final XtextResource resource) throws Exception {
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

public abstract class AbstractEditorHandler extends AbstractHandler {

  public Object execute(ExecutionEvent event) throws ExecutionException {

    final XtextEditor xtextEditor = EditorUtils.getActiveXtextEditor(event);
    if (xtextEditor == null) {
      return null;
    }
    final IXtextDocument document = xtextEditor.getDocument();
    document.modify(new IUnitOfWork.Void<XtextResource>() {
      @Override
      public void process(XtextResource state) throws Exception {
        doExecute(xtextEditor, state);
      }
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

      } catch (InterruptedException e) {
        e.printStackTrace();
      }

    } else if (activeEditor != null && activeEditor instanceof XtextEditor) {
      final XtextEditor editor = (XtextEditor) activeEditor;
      final Holder<String> ref = new Holder<String>();
      try {
        workbench.getProgressService().run(true, true, new IRunnableWithProgress() {

          @Override
          public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            XtextDocument doc = (XtextDocument) editor.getDocument();
            String result = doc.readOnly(new IUnitOfWork<String, XtextResource>() {
              @Override
              public String exec(XtextResource r) throws Exception {
                Model m = (Model) r.getContents().get(0);
                return interpret(m, monitor);
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

    return null;
  }

  public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
      XtextEditor editor = EditorUtils.getActiveXtextEditor(event);
      if(editor != null) {
        final ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
        IPPQueryData context = editor.getDocument().readOnly(new IUnitOfWork<IPPQueryData, XtextResource>() {
          public IPPQueryData exec(XtextResource localResource) throws Exception {
            return createQueryData(localResource, selection);
          }
        });
        if(context != null) {
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

              IEditorInput editorInput = editorReference.getEditorInput();
              if(editorInput instanceof IStorageEditorInput &&
                  contains(storages, ((IStorageEditorInput) editorInput).getStorage())) {
                IEditorPart editor = editorReference.getEditor(true);
                if(editor instanceof XtextEditor) {
                  XtextEditor xtextEditor = (XtextEditor) editor;
                  return xtextEditor.getDocument();
                }
              }
            }
            catch(Exception e) {
              LOG.error("Error accessing document", e);
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

    String pluginid = PPActivator.getInstance().getBundle().getSymbolicName();
    Object editor = ctx.getVariable("activeEditor");
    if(editor == null || !(editor instanceof XtextEditor)) {
      return new Status(IStatus.ERROR, pluginid, "Handler invoked on wrong type of editor: XtextEditor");
    }
    XtextEditor xtextEditor = (XtextEditor) editor;
    IXtextDocument xtextDocument = XtextDocumentUtil.get(xtextEditor);
    if(xtextDocument == null) {
      return new Status(IStatus.ERROR, pluginid, "No document found in current editor");
    }
    IStatus result = xtextDocument.readOnly(new IUnitOfWork<IStatus, XtextResource>() {
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

public class FXMLAdapterFactory implements IAdapterFactory {

  @Override
  public Object getAdapter(Object adaptableObject, Class adapterType) {
    if((adapterType == IFXMLProviderAdapter.class || adapterType == IFXPreviewAdapter.class) && adaptableObject instanceof XtextEditor ) {
      XtextEditor editor = (XtextEditor) adaptableObject;
      if( "at.bestsolution.efxclipse.tooling.fxgraph.FXGraph".equals(editor.getLanguageName()) ) {
        return new FXMLProviderAdapter(editor);
      }
    }
    return null;
  }
View Full Code Here

Examples of org.eclipse.xtext.ui.editor.XtextEditor

  @Override
  @SuppressWarnings("rawtypes")
  public Object getAdapter(Object adaptableObject, Class adapterType) {
    if(adapterType == IFXPreviewAdapter.class && adaptableObject instanceof XtextEditor ) {
      final XtextEditor editor = (XtextEditor) adaptableObject;
      if( "at.bestsolution.efxclipse.tooling.css.CssDsl".equals(editor.getLanguageName()) ) {
        return new IFXPreviewAdapter() {
         
          @Override
          public IEditorPart getEditorPart() {
            return editor;
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.