org.eclipse.ui.views.contentoutline.IContentOutlinePage#org.eclipse.ui.IEditorInput源码实例Demo

下面列出了org.eclipse.ui.views.contentoutline.IContentOutlinePage#org.eclipse.ui.IEditorInput 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: birt   文件: IDEFileReportProvider.java
public IPath getInputPath( IEditorInput input )
{
	if ( input instanceof IURIEditorInput )
	{
		//return new Path( ( (IURIEditorInput) input ).getURI( ).getPath( ) );
		URI uri = ( (IURIEditorInput) input ).getURI( );
		if(uri == null && input instanceof IFileEditorInput)
			return ((IFileEditorInput)input).getFile( ).getFullPath( );
		IPath localPath = URIUtil.toPath( uri );
		String host = uri.getHost( );
		if ( host != null && localPath == null )
		{
			return new Path( host + uri.getPath( ) ).makeUNC( true );
		}
		return localPath;
	}
	if ( input instanceof IFileEditorInput )
	{
		return ( (IFileEditorInput) input ).getFile( ).getLocation( );
	}
	return null;
}
 
@Override
public IStructuredSelection findSelection(IEditorInput anInput) {
    IDiagramDocument document = ProcessDiagramEditorPlugin.getInstance().getDocumentProvider()
            .getDiagramDocument(anInput);
    if (document == null) {
        return super.findSelection(anInput);
    }
    Diagram diagram = document.getDiagram();
    if (diagram == null || diagram.eResource() == null) {
        return StructuredSelection.EMPTY;
    }
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
        return new StructuredSelection(file);
    }
    return StructuredSelection.EMPTY;
}
 
源代码3 项目: tmxeditor8   文件: XLIFFEditor.java
/**
 * 启动编辑器。
 * 
 * @param site
 *            the site
 * @param input
 *            the input
 * @throws PartInitException
 *             the part init exception
 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite,
 *      org.eclipse.ui.IEditorInput)
 */
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	if (LOGGER.isDebugEnabled()) {
		LOGGER.debug("init(IEditorSite site, IEditorInput input)");
	}
	setSite(site);
	setInput(input);
	// 设置Editor标题栏的显示名称,否则名称用plugin.xml中的name属性
	setPartName(input.getName());

	Image oldTitleImage = titleImage;
	if (input != null) {
		IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
		IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId());
		ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null;
		titleImage = imageDesc != null ? imageDesc.createImage() : null;
	}

	setTitleImage(titleImage);
	if (oldTitleImage != null && !oldTitleImage.isDisposed()) {
		oldTitleImage.dispose();
	}

	getSite().setSelectionProvider(this);
}
 
源代码4 项目: wildwebdeveloper   文件: SelectionUtils.java
private static IFile getSelectedIFile() {
	try {
		ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
		if (selection instanceof IStructuredSelection) {
			return Adapters.adapt(((IStructuredSelection)selection).getFirstElement(), IFile.class);
		}
	} catch (Exception e) {
		Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e));
	}
	IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
	if (editor != null) {
		IEditorInput input = editor.getEditorInput();
		if (input instanceof IFileEditorInput) {
			return ((IFileEditorInput)input).getFile();
		}
	}
	return null;
}
 
源代码5 项目: xds-ide   文件: CoreEditorUtils.java
/**
    * Returns File underlying this editor input. 
    * 
    * This method should be modified, whenever new editor input is supported 
    * for some editor requiring access to File.
    * 
    * @param input the editor input to operate on.
    * 
    * @return file underlying given editor input.
    */    
   public static File editorInputToFile(IEditorInput input) {
	if (input == null) 
	    return null;
	
       if (input instanceof IFileEditorInput) {
       	IFile file = editorInputToIFile(input);
           if (file != null) {
               return ResourceUtils.getAbsoluteFile(file);
           }
       }
       else if (input instanceof IURIEditorInput) {
           IURIEditorInput uriEditorInput = (IURIEditorInput) input;
           return new File(uriEditorInput.getURI());
       }
       else if (input instanceof CommonSourceNotFoundEditorInput || input instanceof CompareEditorInput || input instanceof IStorageEditorInput) {
       	// do nothing
	}
       else{
       	LogHelper.logError("Unknown editor input");
       }
       
       return null;
}
 
源代码6 项目: Pydev   文件: PydevPackageExplorer.java
/**
 * Returns the element contained in the EditorInput
 */
Object getElementOfInput(IEditorInput input) {
    if (input instanceof IFileEditorInput) {
        return ((IFileEditorInput) input).getFile();
    }
    if (input instanceof IURIEditorInput) {
        IURIEditorInput iuriEditorInput = (IURIEditorInput) input;
        URI uri = iuriEditorInput.getURI();
        return new File(uri);

    }
    if (input instanceof PydevZipFileEditorInput) {
        PydevZipFileEditorInput pydevZipFileEditorInput = (PydevZipFileEditorInput) input;
        try {
            IStorage storage = pydevZipFileEditorInput.getStorage();
            if (storage instanceof PydevZipFileStorage) {
                PydevZipFileStorage pydevZipFileStorage = (PydevZipFileStorage) storage;
                return pydevZipFileStorage;
            }
        } catch (CoreException e) {
            Log.log(e);
        }

    }
    return null;
}
 
源代码7 项目: eclipse-extras   文件: DeleteEditorFileHandler.java
@Override
public Object execute( ExecutionEvent event ) {
  IEditorInput editorInput = HandlerUtil.getActiveEditorInput( event );
  IFile resource = ResourceUtil.getFile( editorInput );
  if( resource != null ) {
    if( resource.isAccessible() ) {
      deleteResource( HandlerUtil.getActiveWorkbenchWindow( event ), resource );
    }
  } else {
    File file = getFile( editorInput );
    IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow( event );
    if( file != null && prompter.confirmDelete( workbenchWindow, file )) {
      deleteFile( workbenchWindow, file );
    }
  }
  return null;
}
 
源代码8 项目: translationstudio8   文件: HtmlBrowserEditor.java
@Override
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
	setSite(site);
	setInput(input);
	setPartName(input.getName());
	
	Image oldTitleImage = titleImage;
	if (input != null) {
		IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry();
		IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId());
		ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null;
		titleImage = imageDesc != null ? imageDesc.createImage() : null;
	}

	setTitleImage(titleImage);
	if (oldTitleImage != null && !oldTitleImage.isDisposed()) {
		oldTitleImage.dispose();
	}

	FileEditorInput fileInput = (FileEditorInput) input;
	htmlUrl = fileInput.getFile().getLocation().toOSString();
}
 
源代码9 项目: bonita-studio   文件: SourceFileStore.java
private void closeRelatedEditorIfOpened(final ICompilationUnit compilationUnit) throws PartInitException {
    Optional<IWorkbenchPage> activePage = Optional.ofNullable(PlatformUI.getWorkbench().getActiveWorkbenchWindow())
            .map(IWorkbenchWindow::getActivePage);
    if (activePage.isPresent()) {
        if (editorPart != null) {
            if (PlatformUI.isWorkbenchRunning()) {
                activePage.get().closeEditor(editorPart, false);
            }
        } else {
            if (PlatformUI.isWorkbenchRunning()) {
                for (final IEditorReference editorReference : activePage.get().getEditorReferences()) {
                    final IEditorInput editorInput = editorReference.getEditorInput();
                    if (compilationUnit.getResource()
                            .equals(EditorUtil.retrieveResourceFromEditorInput(editorInput))) {
                        activePage.get().closeEditors(new IEditorReference[] { editorReference }, false);
                        break;
                    }
                }
            }
        }
    }
}
 
源代码10 项目: Pydev   文件: PyEditTitle.java
private boolean isDjangoHandledModule(String djangoModulesHandling, IEditorInput input, String lastSegment) {
    boolean handled = false;
    if (djangoModulesHandling == PyTitlePreferencesPage.TITLE_EDITOR_DJANGO_MODULES_SHOW_PARENT_AND_DECORATE
            || djangoModulesHandling == PyTitlePreferencesPage.TITLE_EDITOR_DJANGO_MODULES_DECORATE) {

        if (input instanceof IFileEditorInput) {
            IFileEditorInput iFileEditorInput = (IFileEditorInput) input;
            IFile file = iFileEditorInput.getFile();
            IProject project = file.getProject();
            try {
                if (project.hasNature(PythonNature.DJANGO_NATURE_ID)) {
                    if (PyTitlePreferencesPage.isDjangoModuleToDecorate(lastSegment)) {
                        //remove the module name.
                        handled = true;
                    }
                }
            } catch (CoreException e) {
                Log.log(e);
            }
        }
    }
    return handled;
}
 
private static IEditorInput getEditorInput(IJavaElement element) {
	while (element != null) {
		if (element instanceof ICompilationUnit) {
			ICompilationUnit unit= ((ICompilationUnit) element).getPrimary();
				IResource resource= unit.getResource();
				if (resource instanceof IFile)
					return new FileEditorInput((IFile) resource);
		}

		if (element instanceof IClassFile)
			return new InternalClassFileEditorInput((IClassFile) element);

		element= element.getParent();
	}

	return null;
}
 
源代码12 项目: xtext-eclipse   文件: DefaultMergeViewer.java
protected void configureSourceViewer(SourceViewer sourceViewer) {
	IEditorInput editorInput = getEditorInput(sourceViewer);
	SourceViewerConfiguration sourceViewerConfiguration = createSourceViewerConfiguration(sourceViewer, editorInput);
	sourceViewer.unconfigure();
	sourceViewer.configure(sourceViewerConfiguration);
	IXtextDocument xtextDocument = xtextDocumentUtil.getXtextDocument(sourceViewer);
	if (xtextDocument != null) {
		if (!xtextDocument.readOnly(TEST_EXISTING_XTEXT_RESOURCE)) {
			String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer);
			for (String contentType : configuredContentTypes) {
				sourceViewer.removeTextHovers(contentType);
			}
			sourceViewer.setHyperlinkDetectors(null, sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer));
		}
	}
}
 
@Override
public IEditorPart open(final URI uri, final EReference crossReference, final int indexInList, final boolean select) {
	Iterator<Pair<IStorage, IProject>> storages = mapper.getStorages(uri.trimFragment()).iterator();
	if (storages != null && storages.hasNext()) {
		try {
			IStorage storage = storages.next().getFirst();
			IEditorInput editorInput = EditorUtils.createEditorInput(storage);
			IWorkbenchPage activePage = workbench.getActiveWorkbenchWindow().getActivePage();
			final IEditorPart editor = IDE.openEditor(activePage, editorInput, getEditorId());
			selectAndReveal(editor, uri, crossReference, indexInList, select);
			return EditorUtils.getXtextEditor(editor);
		} catch (WrappedException e) {
			logger.error("Error while opening editor part for EMF URI '" + uri + "'", e.getCause());
		} catch (PartInitException partInitException) {
			logger.error("Error while opening editor part for EMF URI '" + uri + "'", partInitException);
		}
	}
	return null;
}
 
源代码14 项目: tlaplus   文件: TLAHyperlinkDetector.java
private int[] getDocumentAndRegion(SyntaxTreeNode csNode, IDocumentProvider documentProvider, IEditorInput editorInput)
		throws CoreException {
	IDocument document;
	// connect to the resource
	try {
		documentProvider.connect(editorInput);
		document = documentProvider.getDocument(editorInput);
	} finally {
		/*
		 * Once the document has been retrieved, the document provider is not needed.
		 * Always disconnect it to avoid a memory leak.
		 * 
		 * Keeping it connected only seems to provide synchronization of the document
		 * with file changes. That is not necessary in this context.
		 */
		documentProvider.disconnect(editorInput);
	}

	return getRegion(csNode, document);
}
 
源代码15 项目: scava   文件: PartEventListener.java
private void subscribeDocumentEventListener(IWorkbenchPartReference partRef) {
	IWorkbenchPart part = partRef.getPart(false);
	if (part instanceof IEditorPart) {
		IEditorPart editor = (IEditorPart) part;
		IEditorInput input = editor.getEditorInput();

		if (editor instanceof ITextEditor && input instanceof FileEditorInput) {
			ITextEditor textEditor = (ITextEditor) editor;

			// EventManager.setEditor(textEditor);

			saveListener(textEditor);

			IDocument document = textEditor.getDocumentProvider().getDocument(input);

			DocumentEventListener documentListener = new DocumentEventListener(textEditor.getTitle());
			document.addDocumentListener(documentListener);
		}
	}
}
 
源代码16 项目: doclipser   文件: DockerRunLaunchShortcut.java
@Override
public void launch(IEditorPart editor, String mode) {
    IEditorInput input = editor.getEditorInput();
    IFile dockerfile = (IFile) input.getAdapter(IFile.class);
    IPath dockerfilePath = null;
    if (dockerfile != null) {
        dockerfilePath = dockerfile.getLocation().removeLastSegments(1);
    }
    if (dockerfilePath == null) {
        ILocationProvider locationProvider = (ILocationProvider) input
                .getAdapter(ILocationProvider.class);
        if (locationProvider != null) {
            dockerfilePath = locationProvider.getPath(input);
        }
    }
    if (dockerfilePath != null) {
        launch(dockerfile, dockerfilePath);
    }
}
 
源代码17 项目: Pydev   文件: PyDebugModelPresentation.java
/**
 * Returns editor to be displayed
 */
@Override
public IEditorInput getEditorInput(Object element) {
    if (element instanceof PyBreakpoint) {
        String file = ((PyBreakpoint) element).getFile();
        if (file != null) {
            return EditorInputFactory.create(new File(file), false);

            //We should not open the editor here, just create the input... the debug framework opens it later on.
            //IPath path = new Path(file);
            //IEditorPart part = PyOpenEditor.doOpenEditor(path);
            //return part.getEditorInput();
        }
    }
    return null;
}
 
/**
 * Returns the editors to save before performing global Java-related
 * operations.
 *
 * @param saveUnknownEditors <code>true</code> iff editors with unknown buffer management should also be saved
 * @return the editors to save
 * @since 3.3
 */
public static IEditorPart[] getDirtyEditorsToSave(boolean saveUnknownEditors) {
	Set<IEditorInput> inputs= new HashSet<IEditorInput>();
	List<IEditorPart> result= new ArrayList<IEditorPart>(0);
	IWorkbench workbench= PlatformUI.getWorkbench();
	IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
	for (int i= 0; i < windows.length; i++) {
		IWorkbenchPage[] pages= windows[i].getPages();
		for (int x= 0; x < pages.length; x++) {
			IEditorPart[] editors= pages[x].getDirtyEditors();
			for (int z= 0; z < editors.length; z++) {
				IEditorPart ep= editors[z];
				IEditorInput input= ep.getEditorInput();
				if (!mustSaveDirtyEditor(ep, input, saveUnknownEditors))
					continue;

				if (inputs.add(input))
					result.add(ep);
			}
		}
	}
	return result.toArray(new IEditorPart[result.size()]);
}
 
源代码19 项目: texlipse   文件: SpellUncheckAction.java
/**
    * Clear the spelling error markers.
    * @param action the action
 */
public void run(IAction action) {
       
       if (targetEditor == null) {
           return;
       }
       if (!(targetEditor instanceof ITextEditor)) {
           return;
       }
       
       ITextEditor textEditor = (ITextEditor) targetEditor;
       IEditorInput input = textEditor.getEditorInput();
       
       if (input instanceof FileEditorInput) {
           SpellChecker.clearMarkers(((FileEditorInput)input).getFile());
       }
}
 
private IJavaProject getProject() {
	ITextEditor editor= getEditor();
	if (editor == null)
		return null;

	IJavaElement element= null;
	IEditorInput input= editor.getEditorInput();
	IDocumentProvider provider= editor.getDocumentProvider();
	if (provider instanceof ICompilationUnitDocumentProvider) {
		ICompilationUnitDocumentProvider cudp= (ICompilationUnitDocumentProvider) provider;
		element= cudp.getWorkingCopy(input);
	} else if (input instanceof IClassFileEditorInput) {
		IClassFileEditorInput cfei= (IClassFileEditorInput) input;
		element= cfei.getClassFile();
	}

	if (element == null)
		return null;

	return element.getJavaProject();
}
 
protected IFile getFile()
{
	AbstractThemeableEditor editor = fEditor;
	if (editor != null)
	{
		IEditorInput editorInput = editor.getEditorInput();

		if (editorInput instanceof IFileEditorInput)
		{
			IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
			return fileEditorInput.getFile();
		}
	}

	return null;
}
 
源代码22 项目: birt   文件: IDEMultiPageReportEditor.java
protected void setInput( IEditorInput input )
{

	// The workspace never changes for an editor. So, removing and re-adding
	// the
	// resourceListener is not necessary. But it is being done here for the
	// sake
	// of proper implementation. Plus, the resourceListener needs to be
	// added
	// to the workspace the first time around.
	if ( isWorkspaceResource )
	{
		getFile( getEditorInput( ) ).getWorkspace( )
				.removeResourceChangeListener( resourceListener );
	}

	isWorkspaceResource = input instanceof IFileEditorInput;

	super.setInput( input );

	if ( isWorkspaceResource )
	{
		getFile( getEditorInput( ) ).getWorkspace( )
				.addResourceChangeListener( resourceListener );
	}
}
 
源代码23 项目: birt   文件: SaveReportAsWizard.java
public SaveReportAsWizard( ModuleHandle model,
		IEditorInput orginalFile )
{
	setWindowTitle( SaveAsWizardWindowTitle );
	this.model = model;
	this.orginalFile = orginalFile;
}
 
源代码24 项目: Pydev   文件: EditorUtils.java
private static IEditorInput getEditorInput(IFileStore fileStore) {
    IFile workspaceFile = getWorkspaceFile(fileStore);
    if (workspaceFile != null) {
        return new FileEditorInput(workspaceFile);
    }
    return new FileStoreEditorInput(fileStore);
}
 
源代码25 项目: Pydev   文件: BaseEditor.java
/**
 * @return the project for the file that's being edited (or null if not available)
 */
public IProject getProject() {
    IEditorInput editorInput = this.getEditorInput();
    if (editorInput instanceof IAdaptable) {
        IAdaptable adaptable = editorInput;
        IFile file = adaptable.getAdapter(IFile.class);
        if (file != null) {
            return file.getProject();
        }
        IResource resource = adaptable.getAdapter(IResource.class);
        if (resource != null) {
            return resource.getProject();
        }
        if (editorInput instanceof IStorageEditorInput) {
            IStorageEditorInput iStorageEditorInput = (IStorageEditorInput) editorInput;
            try {
                IStorage storage = iStorageEditorInput.getStorage();
                IPath fullPath = storage.getFullPath();
                if (fullPath != null) {
                    IWorkspace ws = ResourcesPlugin.getWorkspace();
                    for (String s : fullPath.segments()) {
                        IProject p = ws.getRoot().getProject(s);
                        if (p.exists()) {
                            return p;
                        }
                    }
                }
            } catch (Exception e) {
                Log.log(e);
            }

        }
    }
    return null;
}
 
@Override
public void open(IWorkbenchPage page) {
	try {
		IEditorInput input = EditorUtils.createEditorInput(storage);
		IEditorDescriptor editorDescriptor = IDE.getEditorDescriptor(storage.getName());
		IEditorPart opened = IDE.openEditor(page, input, editorDescriptor.getId());
		if (region != null && opened instanceof ITextEditor) {
			ITextEditor openedTextEditor = (ITextEditor) opened;
			openedTextEditor.selectAndReveal(region.getOffset(), region.getLength());
		}
	} catch (PartInitException e) {
		LOG.error(e.getMessage(), e);
	}
}
 
源代码27 项目: dsl-devkit   文件: AbstractXtextUiTest.java
/**
 * Opens an {@link IEditorPart} for a provided {@link org.eclipse.emf.common.util.URI}.
 *
 * @param uri
 *          {@link org.eclipse.emf.common.util.URI} to open editor for
 * @param activate
 *          true if focus is to be set to the opened editor
 * @return {@link IEditorPart} created
 */
private IEditorPart openEditor(final org.eclipse.emf.common.util.URI uri, final boolean activate) {
  UiAssert.isNotUiThread();
  final IEditorPart editorPart = UIThreadRunnable.syncExec(getBot().getDisplay(), new Result<IEditorPart>() {
    @Override
    public IEditorPart run() {
      IEditorPart editor = getXtextTestUtil().get(GlobalURIEditorOpener.class).open(uri, activate);
      editor.setFocus();
      return editor;
    }
  });

  waitForEditorJobs(editorPart);

  getBot().waitUntil(new DefaultCondition() {
    @Override
    public boolean test() {
      if (editorPart.getEditorSite() != null && editorPart.getEditorInput() != null) {
        IEditorInput input = editorPart.getEditorInput();
        if (input instanceof IFileEditorInput) {
          return !((IFileEditorInput) input).getFile().isReadOnly();
        }
      }
      return false;
    }

    @Override
    public String getFailureMessage() {
      return "Editor must be initialized.";
    }
  }, EDITOR_ENABLED_TIMEOUT);

  return editorPart;
}
 
源代码28 项目: ice   文件: AbstractWorkbenchTester.java
/**
 * Tries to open an Eclipse editor given the specified input and the ID of
 * the editor.
 * 
 * @param input
 *            The editor's input.
 * @param id
 *            The Eclipse editor's ID as defined in the plug-in extensions.
 * @return The opened editor, or {@code null} if it could not be opened.
 */
protected IEditorReference openEditor(final IEditorInput input,
		final String id) {
	final AtomicReference<IEditorReference> editorRef = new AtomicReference<IEditorReference>();

	// This must be done on the UI thread. Use syncExec so that this method
	// will block until the editor can be opened.
	getDisplay().syncExec(new Runnable() {
		@Override
		public void run() {
			// Get the workbench window so we can open an editor.
			IWorkbenchWindow window = PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow();
			IWorkbenchPage page = window.getActivePage();

			// Try to open the editor in the workbench.
			try {
				// IEditorPart editor = page.openEditor(input, id);
				IEditorReference[] refs = page.openEditors(
						new IEditorInput[] { input }, new String[] { id },
						IWorkbenchPage.MATCH_NONE);
				if (refs.length > 0) {
					editorRef.set(refs[0]);
				}
			} catch (MultiPartInitException e) {
				// Nothing to do.
			}

			return;
		}
	});

	return editorRef.get();
}
 
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
	if (!(receiver instanceof ITextEditor)) {
		return false;
	}
	ITextEditor editor = (ITextEditor) receiver;

	IEditorInput input = editor.getEditorInput();
	IDocumentProvider docProvider = editor.getDocumentProvider();
	if (docProvider == null || input == null) {
		return false;
	}

	IDocument document = docProvider.getDocument(input);
	if (document == null) {
		return false;
	}

	IContentType[] contentTypes;
	try {
		ContentTypeInfo info = ContentTypeHelper.findContentTypes(document);
		if(info == null) {
			return false;
		}
		contentTypes = info.getContentTypes();
	} catch (CoreException e) {
		return false;
	}

	LanguageConfigurationRegistryManager registry = LanguageConfigurationRegistryManager.getInstance();
	return registry.getLanguageConfigurationFor(contentTypes) != null;
}
 
/**
 * Returns the element contained in the EditorInput
 * @param input the editor input
 * @return the input element
 */
Object getElementOfInput(IEditorInput input) {
	if (input instanceof IFileEditorInput)
		return ((IFileEditorInput)input).getFile();
	if (input != null)
		return JavaUI.getEditorInputJavaElement(input);
	return null;
}