當前位置: 首頁>>代碼示例>>Java>>正文


Java IFileEditorInput類代碼示例

本文整理匯總了Java中org.eclipse.ui.IFileEditorInput的典型用法代碼示例。如果您正苦於以下問題:Java IFileEditorInput類的具體用法?Java IFileEditorInput怎麽用?Java IFileEditorInput使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IFileEditorInput類屬於org.eclipse.ui包,在下文中一共展示了IFileEditorInput類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEditorID

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * Gets the default editor ID for the given {@link IEditorInput} and element.
 * 
 * @param input
 *            the {@link IEditorInput}
 * @param element
 *            the element
 * @return the default editor ID for the given {@link IEditorInput} and element if any, <code>null</code>
 *         otherwise
 */
public static String getEditorID(IEditorInput input, Object element) {
	final String res;
	if (input instanceof URIEditorInput) {
		res = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(
				((URIEditorInput)input).getURI().lastSegment()).getId();
	} else if (input instanceof IFileEditorInput) {
		IEditorDescriptor defaultEditor = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(
				((IFileEditorInput)input).getFile().getName());
		if (defaultEditor != null) {
			res = defaultEditor.getId();
		} else {
			res = "org.eclipse.emf.ecore.presentation.ReflectiveEditorID";
		}
	} else {
		res = null;
	}
	return res;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:29,代碼來源:EMFEditorUtils.java

示例2: init

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
@Override
public void init ( final IEditorSite site, final IEditorInput input ) throws PartInitException
{
    setSite ( site );
    setInput ( input );

    final IFileEditorInput fileInput = AdapterHelper.adapt ( input, IFileEditorInput.class );
    if ( fileInput != null )
    {
        this.loader = new FileLoader ( fileInput );
        setContentDescription ( fileInput.getName () );
        setPartName ( fileInput.getName () );
    }

    if ( this.loader == null )
    {
        throw new PartInitException ( "Invalid editor input. Unable to load data" );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:20,代碼來源:HDSEditor.java

示例3: setInputWithNotify

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
@Override
protected void setInputWithNotify ( final IEditorInput input )
{
    super.setInputWithNotify ( input );

    this.fileInput = (IFileEditorInput)input;
    final IFile file = this.fileInput.getFile ();

    try
    {
        final URI uri = URI.createPlatformResourceURI ( file.getFullPath ().toString (), true );
        // we need a real platform URI since otherwise the StaticSymbolLoader cannot resolve URIs
        final Resource resource = getEditingDomain ().getResourceSet ().createResource ( uri );
        resource.load ( null );
    }
    catch ( final IOException e )
    {
        throw new RuntimeException ( "Failed to load input", e );
    }
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:21,代碼來源:AbstractModelEditor.java

示例4: createJavaProjectThroughActiveEditor

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
private IJavaProject createJavaProjectThroughActiveEditor() {
	
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	 	    if(page.getActiveEditor().getEditorInput() instanceof IFileEditorInput)
	 	    {	
	 		IFileEditorInput input = (IFileEditorInput) page.getActiveEditor().getEditorInput();
	 		IFile file = input.getFile();
	 		IProject activeProject = file.getProject();
	 		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(activeProject.getName());
	 		return JavaCore.create(project);
	 	    }
	 	    else if(page.getActiveEditor().getEditorInput() instanceof IClassFileEditorInput)
	 	    {
	  IClassFileEditorInput classFileEditorInput=(InternalClassFileEditorInput)page.getActiveEditor().getEditorInput() ;
	  IClassFile classFile=classFileEditorInput.getClassFile();
	  return classFile.getJavaProject();
	 	    }
	 	    return null;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:20,代碼來源:ValidatorUtility.java

示例5: createContainerControls

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
@Override
protected void createContainerControls(Composite parent, int nColumns) {

	super.createContainerControls(parent, nColumns);
	Text text = (Text) parent.getChildren()[1];
	text.setEditable(false);
	IEditorInput editorInput = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActiveEditor().getEditorInput();
	if (editorInput instanceof IFileEditorInput) {
		IFileEditorInput fileEditorInput = (IFileEditorInput) editorInput;
		IProject project = fileEditorInput.getFile().getProject();
		if (project != null) {
			IFolder srcFolder = project.getFolder("src/main/java");
			if (srcFolder != null && srcFolder.exists()) {
				text.setText(project.getName() + "/" + srcFolder.getProjectRelativePath().toString());
			}
		}
		Button button = (Button) parent.getChildren()[2];
		button.setEnabled(false);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:CustomizeNewClassWizardPage.java

示例6: loadProperties

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * 
 * loading the properties files
 */
public void loadProperties() {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if (page.getActiveEditor().getEditorInput() instanceof IFileEditorInput) {
		IFileEditorInput input = (IFileEditorInput) page.getActiveEditor().getEditorInput();
		List<File> paramNameList = null;
		IFile file = input.getFile();
		IProject activeProject = file.getProject();
		final File globalparamFilesPath = new File(activeProject.getLocation().toString() + "/" + "globalparam");
		final File localParamFilePath = new File(activeProject.getLocation().toString() + "/" + Constants.PARAM_FOLDER);
		File[] files = (File[]) ArrayUtils.addAll(listFilesForFolder(globalparamFilesPath),
				getJobsPropertyFile(localParamFilePath,file));
		if (files != null) {
			paramNameList = Arrays.asList(files);
			getParamMap(paramNameList, null);
		}
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:22,代碼來源:Utils.java

示例7: getParameterFileIPath

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
private IPath getParameterFileIPath(){
	if(getEditorInput() instanceof IFileEditorInput){
		IFileEditorInput input = (IFileEditorInput)getEditorInput() ;
		IFile file = input.getFile();
		IProject activeProject = file.getProject();
		String activeProjectName = activeProject.getName();

		IPath parameterFileIPath =new Path("/"+activeProjectName+"/param/"+ getPartName().replace(".job", ".properties"));
	    activeProjectName.concat("_").concat(getPartName().replace(".job", "_"));

		return parameterFileIPath;
	}else{
		return null;
	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:17,代碼來源:ELTGraphicalEditor.java

示例8: disableRunningGraphResource

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
private void disableRunningGraphResource(IEditorInput editorInput,String partName){
	if(editorInput instanceof IFileEditorInput){
		IFileEditorInput input = (IFileEditorInput)editorInput ;
		IFile fileJob = input.getFile();
		IPath xmlFileIPath =new Path(input.getFile().getFullPath().toOSString().replace(".job", ".xml"));
		IFile fileXml = ResourcesPlugin.getWorkspace().getRoot().getFile(xmlFileIPath);
		ResourceAttributes attributes = new ResourceAttributes();
		attributes.setReadOnly(true);
		attributes.setExecutable(true);

		try {
			fileJob.setResourceAttributes(attributes);
			fileXml.setResourceAttributes(attributes);
		} catch (CoreException e) {
			logger.error("Unable to disable running job resources", e);
		}

	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:ELTGraphicalEditor.java

示例9: enableRunningGraphResource

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
private void enableRunningGraphResource(IEditorInput editorInput,
		String partName) {
	IFileEditorInput input = (IFileEditorInput)editorInput ;
	IFile fileJob = input.getFile();
	IPath xmlFileIPath =new Path(input.getFile().getFullPath().toOSString().replace(".job", ".xml"));
	IFile fileXml = ResourcesPlugin.getWorkspace().getRoot().getFile(xmlFileIPath);
	ResourceAttributes attributes = new ResourceAttributes();
	attributes.setReadOnly(false);
	attributes.setExecutable(true);

	try {
		if(fileJob.exists()){
			
			fileJob.setResourceAttributes(attributes);
		}
		if(fileXml.exists()){
			
			fileXml.setResourceAttributes(attributes);
		}
	} catch (CoreException e) {
		logger.error("Unable to enable locked job resources",e);
	}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:25,代碼來源:ELTGraphicalEditor.java

示例10: updateMainGraphOnSavingSubjob

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
private void updateMainGraphOnSavingSubjob() {
	hydrograph.ui.graph.model.Component subjobComponent=null;
	if (container != null && container.getLinkedMainGraphPath()!=null) {
		for (int i = 0; i < container.getUIComponentList().size(); i++) {
			subjobComponent = ((ComponentEditPart)(container.getSubjobComponentEditPart())).getCastedModel();
				break;
		}
		if(subjobComponent!=null){
			String path=getEditorInput().getToolTipText();
			if (getEditorInput() instanceof IFileEditorInput)
				path = ((IFileEditorInput) getEditorInput()).getFile().getFullPath().toString();
			IPath subJobFilePath=new Path(path);
			SubJobUtility subJobUtility=new SubJobUtility();
			SubjobUtility.INSTANCE.showOrHideErrorSymbolOnComponent(container,subjobComponent);
			if (subjobComponent.getComponentEditPart() != null) {
				((ComponentEditPart) subjobComponent.getComponentEditPart()).updateComponentStatus();
			}
			subJobUtility.updateContainerAndSubjob(container, subjobComponent, subJobFilePath);
			((ComponentEditPart)container.getSubjobComponentEditPart()).changePortSettings();
		}
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:23,代碼來源:ELTGraphicalEditor.java

示例11: removeTempSubJobTrackFiles

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * Remove temp tracking subjob file after tool close, rerun and modification. 
 */
public void removeTempSubJobTrackFiles() {
	
if(deleteOnDispose){
	try {
		IFile file=((IFileEditorInput)getEditorInput()).getFile();
		if(file.exists()){
		ResourcesPlugin.getWorkspace().getRoot().getFile(file.getFullPath()).delete(true, null);
		ResourcesPlugin.getWorkspace().getRoot().getFile(file.getFullPath().removeFileExtension().addFileExtension(Constants.XML_EXTENSION_FOR_IPATH)).delete(true, null);
		}
	} catch (Exception e) {
		logger.error("Failed to remove temp subjob tracking files: "+e);
	}
}

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:19,代碼來源:ELTGraphicalEditor.java

示例12: getOpenEditorOfMarker

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * Note: it compares marker's resource file name and open editors' file name.
 *
 * @param marker
 * @return if marker's editor is open, return editor, else return null
 */
public static IEditorPart getOpenEditorOfMarker(final IMarker marker) {
  final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
  for (final IWorkbenchWindow iWorkbenchWindow : windows) {
    final IWorkbenchPage[] pages = iWorkbenchWindow.getPages();
    for (final IWorkbenchPage iWorkbenchPage : pages) {
      final IEditorReference[] editors = iWorkbenchPage.getEditorReferences();
      for (final IEditorReference iEditorReference : editors) {
        try {
          if (iEditorReference instanceof IFileEditorInput) {
            final IFileEditorInput input = (IFileEditorInput) iEditorReference.getEditorInput();
            final IFile file = input.getFile();
            // TODO Caused by: java.lang.NullPointerException when delete marker on ecore editor.
            if (file.getFullPath().equals(marker.getResource().getFullPath())) {
              return iEditorReference.getEditor(false);
            }
          }
        } catch (final PartInitException e) {
          e.printStackTrace();
        }
      }
    }
  }
  return null;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:31,代碼來源:MarkerFactory.java

示例13: AstManager

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * Constructor. Loads the AST and sets up the StyledText to automatically
 * reload after certain events.
 * @param editor IEditorPart which owns the following StyledText.
 * @param styledText StyledText to which this AST pertains.
 */
public AstManager(IEditorPart editor, StyledText styledText) {
    try {
        editorPath = ((IFileEditorInput) editor.getEditorInput()).getFile()
                .getFullPath().toFile().getCanonicalPath();
    } catch (IOException e) {
        // ignore IOErrors while constructing path
        editorPath = "?";
    }
    this.editor = editor;
    this.styledText = styledText;
    //This is the only why I know to get the ProjectionViewer. Perhaps there is better way. ~Ben
    ITextOperationTarget t = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
    if(t instanceof ProjectionViewer) projectionViewer = (ProjectionViewer)t;
    hookupAutoReload();
    reload();
}
 
開發者ID:SERESLab,項目名稱:iTrace-Archive,代碼行數:23,代碼來源:AstManager.java

示例14: needsToSaveDirtyEditors

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * Most SVN workspace actions modify the workspace and thus should
 * save dirty editors.
 * @see org.tigris.subversion.subclipse.ui.actions.SVNAction#needsToSaveDirtyEditors()
 */
protected boolean needsToSaveDirtyEditors() {

	IResource[] selectedResources = getSelectedResources();
	if (selectedResources != null && selectedResources.length > 0) {
		IEditorReference[] editorReferences = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
		for (IEditorReference editorReference : editorReferences) {
			if (editorReference.isDirty()) {
				try {
					IEditorInput editorInput = editorReference.getEditorInput();
					if (editorInput instanceof IFileEditorInput) {
						IFile file = ((IFileEditorInput)editorInput).getFile();
						if (needsToSave(file, selectedResources)) {
							return true;
						}
					}
				} catch (PartInitException e) {}
			}
		}
	}
	
	return false;
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:28,代碼來源:WorkspaceAction.java

示例15: registerFullOutline

import org.eclipse.ui.IFileEditorInput; //導入依賴的package包/類
/**
 * register the full outline.
 * @param view the view.
 */
public void registerFullOutline(TexOutlineTreeView view) {
    boolean projectChange = false;
    if (view == null || view.getEditor() == null) {
        projectChange = true;
    }
    else if (view.getEditor().getEditorInput() instanceof IFileEditorInput) {
        IFileEditorInput oldInput = (IFileEditorInput) view.getEditor().getEditorInput();
        IProject newProject = getProject();
        // Check whether the project changes
        if (!oldInput.getFile().getProject().equals(newProject))
            projectChange = true;
    } else
        projectChange = true;

    this.fullOutline = view;
    this.fullOutline.setEditor(this);
    if (projectChange) {
        //If the project changes we have to update the fulloutline
        this.fullOutline.projectChanged();
        this.documentModel.updateNow();
    }
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:27,代碼來源:TexEditor.java


注:本文中的org.eclipse.ui.IFileEditorInput類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。