Package org.eclipse.ui

Examples of org.eclipse.ui.IEditorPart


      }
    }
  }
 
  public static void uninstall(IWorkbenchPart part) {
    IEditorPart editor;
    if (part instanceof IEditorPart) {
      editor = EclipseEmmetHelper.getTextEditor((IEditorPart) part);
      if (editor instanceof AbstractTextEditor)
        uninstall((AbstractTextEditor) editor);
    }
View Full Code Here


   
    return false;
  }
 
  public EclipseEmmetEditor getEditor() {
    IEditorPart editor = EclipseEmmetHelper.getActiveEditor();
    if (editor != null) {
      emmetEditor.setContext(editor);
      return emmetEditor;
    }
   
View Full Code Here

      }
    } catch (Exception e) {  }
   
    if (result == null) {
      // try Aptana 2 way
      IEditorPart ed = editor.getEditor();
      if (ed instanceof ITextEditor) {
        Class<? extends IEditorPart> editorClass = ed.getClass();
        try {
          Method getFileContext = editorClass.getMethod("getFileContext", new Class[]{});
          Object fileContext = getFileContext.invoke(ed);
          if (fileContext != null) {
            Class<? extends Object> fcClass = fileContext.getClass();
View Full Code Here

 
  /* (non-Javadoc)
   * @see org.eclipse.jface.preference.IPreferencePage#performOk()
   */
  public boolean performOk() {
    IEditorPart activeEditor = PlatformUI.getWorkbench()
    .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    if(activeEditor instanceof PerlEditor) {
      ((PerlEditor) activeEditor).refreshTaskView();
    }   
    return super.performOk();
View Full Code Here

{

    public Object execute(ExecutionEvent event) throws ExecutionException
    {
        final Shell shell = HandlerUtil.getActiveShell(event);
        final IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
        if (editorPart != null)
        {
            IEditorInput editorInput = editorPart.getEditorInput();

            if (!(editorInput instanceof IFileEditorInput))
            {
                throw new ExecutionException("Editor input must be a file");
            }
            IFileEditorInput fileInput = (IFileEditorInput) editorInput;

            try
            {
                // Save the editor content (if dirty)
                IRunnableWithProgress saveOperation = new IRunnableWithProgress()
                {
                    public void run(IProgressMonitor monitor)
                        throws InvocationTargetException, InterruptedException
                    {
                        if (editorPart.isDirty())
                        {
                            if (MessageDialog.openQuestion(
                                shell,
                                "Save File",
                                "The file contents must be saved before the command can be executed. Do you wish to save now?"))
                            {
                                editorPart.doSave(monitor);
                            }
                            else
                            {
                                throw new InterruptedException();
                            }
View Full Code Here

  private void fromProject(ExecutionEvent event, IProject project, String action) throws ExecutionException {
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    IFile file = project.getFile("conf/routes");
    IEditorPart editorPart;
    if (file.exists()) {
      try {
        editorPart = FilesAccess.openFile(file);
        if (action != null) {
          FilesAccess.goToLineContaining(editorPart, action);
View Full Code Here

    } catch (JavaModelException e1) {
      // Should not happen
      e1.printStackTrace();
      return;
    }
    IEditorPart newEditorPart;
    try {
      newEditorPart = FilesAccess.openFile(file);
      focusOrCreateMethod(newEditorPart, type, method);
    } catch (CoreException e) {
      // Should never happen
View Full Code Here

      this.editorID = editorID;
    }
  }

  public static IEditorPart openFile(IFile file) throws CoreException {
    IEditorPart result = null;
    IWorkbenchPage page = getCurrentPage();
    IMarker marker;
    marker = file.createMarker(IMarker.TEXT);
    result = IDE.openEditor(page, marker);
    marker.delete();
View Full Code Here

        // no action
    }

    private void checkRef(IWorkbenchPartReference partRef)
    {
        IEditorPart editor = partRef.getPage().getActiveEditor();
        if (editor != null)
        {
            IEditorInput input = editor.getEditorInput();
            if (input instanceof IFileEditorInput)
            {
                IFileEditorInput f = (IFileEditorInput) input;
                IProject project = f.getFile().getProject();
                if ( SigilCore.isSigilProject(project)) {
View Full Code Here

   * @param event
   * @throws ExecutionException
   */
  public static EditorHelper getCurrent(ExecutionEvent event)
      throws ExecutionException {
    IEditorPart editor = HandlerUtil.getActiveEditor(event);
    if (editor instanceof ITextEditor) {
      return new EditorHelper((ITextEditor) editor);
    } else {
      return null;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.ui.IEditorPart

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.