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


Java IFile.getProject方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IFile.getProject方法的典型用法代碼示例。如果您正苦於以下問題:Java IFile.getProject方法的具體用法?Java IFile.getProject怎麽用?Java IFile.getProject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IFile的用法示例。


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

示例1: performFinish

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public boolean performFinish() {
	final Option<IFile> option = newModelFilePage.getModelFile();

	if (option.some()) {
		final IFile modelFile = option.get();
		project = modelFile.getProject();

		// Convert project to modeling project
		try {
			ModelingProjectManager.INSTANCE.convertToModelingProject(project, new NullProgressMonitor());
		} catch (final CoreException e) {
		}

		rootObjectType = initModelPage.getInitialObjectName();
		newT4SModelFile = newModelFilePage.getName().toLowerCase() + ".time4sys";

		super.performFinish();
		return true;
	}
	return false;
}
 
開發者ID:polarsys,項目名稱:time4sys,代碼行數:26,代碼來源:NewModelWizard.java

示例2: loadProperties

import org.eclipse.core.resources.IFile; //導入方法依賴的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

示例3: getChildren

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public Object[] getChildren(Object parentElement) {
    if (!(parentElement instanceof IFile)) {
        return null;
    }
    IFile iFile = (IFile) parentElement;
    IProject iProject = iFile.getProject();

    List<PgObjLocation> refs = PgDbParser.getParser(iProject).getObjsForPath(iFile.getLocation().toOSString());
    List<SegmentsWithParent> segments = new ArrayList<>(refs.size());
    for (PgObjLocation loc : refs) {
        if (loc.getAction() != StatementActions.NONE) {
            segments.add(new SegmentsWithParent(loc, iFile));
        }
    }
    return segments.toArray();
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:18,代碼來源:NavigatorOutlineContentProvider.java

示例4: createJavaProjectThroughActiveEditor

import org.eclipse.core.resources.IFile; //導入方法依賴的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: test

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
@Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    if ("gluonMobileFound".equals(property)) {
        try {
            IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (activeWorkbenchWindow == null) {
                return false;
            }
            IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
            if (activePage == null) {
                return false;
            }
            IWorkbenchPart activePart = activePage.getActivePart();
            if (activePart == null || ! (activePart instanceof CompilationUnitEditor)) {
                return false;
            }
            IEditorPart editor = activePage.getActiveEditor();
            if (editor == null) {
                return false;
            }
            IEditorInput input = editor.getEditorInput();
            if (input == null || ! (input instanceof FileEditorInput)) {
                return false;
            }
            IFile file = ((FileEditorInput) input).getFile();
            if (file != null && file.getType() == IResource.FILE && file.getFileExtension().equals("java")) {
                ProjectUtils utils = new ProjectUtils(file.getProject());
            return utils.isGluonMobileProject();
            }
        } catch (Exception e) { }
    }
    return false;
}
 
開發者ID:gluonhq,項目名稱:ide-plugins,代碼行數:34,代碼來源:InsertFunctionTester.java

示例6: updateProjectPluginConfiguration

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Update plugin.xml according to the model
 * 
 * @param resource
 */
private void updateProjectPluginConfiguration(IResource resource) {
	if (resource instanceof IFile 
		&& resource.getFileExtension().equals("melange")) {
		IFile file = (IFile) resource;
		IProject project = file.getProject();
		// try {
		if (file.exists()) {
			
			//Load .melange file
			URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
			ResourceSet rs = new ResourceSetImpl();
			Resource res = rs.getResource(uri, true);
			ModelTypingSpace root = (ModelTypingSpace)res.getContents().get(0);
			String packageName = root.getName();
			
			//Browse declared Languages
			for (fr.inria.diverse.melange.metamodel.melange.Element element : root.getElements()) {
				if(element instanceof Language){
					Language language = (Language) element;
					// update entry in plugin.xml
					setPluginLanguageNameAndFilePath(project, file, packageName+"."+language.getName());
				}
			}
			
			//Use default model loader
			updateModelLoaderClass(project, null);
			ManifestChanger manifestChanger = new ManifestChanger(project);
			try {
				manifestChanger.addPluginDependency(org.eclipse.gemoc.executionframework.extensions.sirius.Activator.PLUGIN_ID);
				manifestChanger.commit();
			} catch (BundleException | IOException | CoreException e) {
				e.printStackTrace();
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:42,代碼來源:GemocSequentialLanguageBuilder.java

示例7: handleChange

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Traite un changement de fichier.
 * 
 * @param file Fichier.
 */
private void handleChange(IFile file) {
	/* Construit le fournisseur de fichier. */
	IProject project = file.getProject();
	IJavaProject javaProject = projectMap.get(project);
	FileProvider fileProvider = new FileProvider(file, project, javaProject, DOCUMENT_PROVIDER);

	/* Traite le fichier. */
	handleFile(fileProvider);
}
 
開發者ID:sebez,項目名稱:vertigo-chroma-kspplugin,代碼行數:15,代碼來源:ResourceStore.java

示例8: handleBundleManifestDelta

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private void handleBundleManifestDelta(IFile file, IResourceDelta delta)
{
	int kind = delta.getKind();
	IProject project = file.getProject();
	IPluginModel model = getPluginModel(project);
	if( kind == IResourceDelta.REMOVED && model != null )
	{
		removeModel(project);
		// switch to legacy plugin structure, if applicable
		createModel(project, true);
	}
	else if( kind == IResourceDelta.ADDED || model == null )
	{
		createModel(project, true);
	}
	else if( kind == IResourceDelta.CHANGED && (IResourceDelta.CONTENT & delta.getFlags()) != 0 )
	{
		boolean wasFragment = model.isFragmentModel();
		model.reload();

		// Fragment-Host header was added or removed
		if( wasFragment != model.isFragmentModel() )
		{
			removeModel(project);
			createModel(project, true);
		}
		else
		{
			addChange(model, IModelProviderEvent.MODELS_CHANGED);
		}
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:33,代碼來源:WorkspacePluginModelManager.java

示例9: setIJavaProject

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private static void setIJavaProject() {
	IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	if ((page.getActiveEditor().getEditorInput().getClass()).isAssignableFrom(FileEditorInput.class)) {
		IFileEditorInput input = (IFileEditorInput) page.getActiveEditor().getEditorInput();
		IFile file = input.getFile();
		IProject activeProject = file.getProject();
		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(activeProject.getName());
		iJavaProject = JavaCore.create(project);
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:11,代碼來源:FilterOperationClassUtility.java

示例10: getTargetFolderForTestImplementation

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Return the folder for test implementation
 * 
 * @param selectedFolder
 * @return
 */
public static String getTargetFolderForTestImplementation(IFile file) {
	IProject project = file.getProject();
	IPath p = file.getFullPath();
	if (isFolderMainResources(project, p))
		return Constant.SOURCE_MAIN_JAVA;
	return Constant.SOURCE_TEST_JAVA;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:14,代碼來源:GraphWalkerContextManager.java

示例11: getActiveProjectLocation

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 * Gets the active project location.
 * 
 * @return the active project location
 */
public static String getActiveProjectLocation() {
	IWorkbenchPart workbenchPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
			.getActivePart();
	IFile file = (IFile) workbenchPart.getSite().getPage().getActiveEditor().getEditorInput()
			.getAdapter(IFile.class);
	IProject project = file.getProject();
	String activeProjectLocation = project.getLocation().toOSString();
	return activeProjectLocation;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:15,代碼來源:MultiParameterFileUIUtils.java

示例12: acceptFile

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
private boolean acceptFile(IFile in) {
	if (!PreferenceManager.isGraphModelFile(in))
		return false;
	IProject project = in.getProject();
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(in.getFullPath())) {
			return true;
		}
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:14,代碼來源:RenameGraphParticipant.java

示例13: buildGeneratedAnnotationValue

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static IPath buildGeneratedAnnotationValue(IFile in) {
	IPath ret = null;
	if (!PreferenceManager.isGraphModelFile(in))
		return null;
	IProject project = in.getProject();
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(in.getFullPath())) {
			ret = in.getFullPath().makeRelativeTo(project.getFullPath());
			break;
		}
	}
	return ret;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:16,代碼來源:Helper.java

示例14: buildModelAnnotationValue

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public static IPath buildModelAnnotationValue (IFile in) {
	IPath ret = null;
	if (!PreferenceManager.isGraphModelFile(in)) return null;
	IProject project = in.getProject();
	String[] folders = PreferenceManager.getAuthorizedFolderForGraphDefinition();
	for (int i = 0; i < folders.length; i++) {
		IPath base = project.getFullPath().append(folders[i]);
		if (base.isPrefixOf(in.getFullPath())) {
			ret = in.getFullPath().makeRelativeTo(base);
			break;
		}
	}
	return ret;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:15,代碼來源:Helper.java

示例15: QuickUpdateJob

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
public QuickUpdateJob(IFile file, DbInfo dbInfo, byte[] textSnapshot, SQLEditor editor) {
    super(Messages.QuickUpdate_quick_update, editor, QuickUpdateJobTester.EVAL_PROP);
    this.file = file;
    this.proj = new PgDbProject(file.getProject());
    this.dbinfo = dbInfo;
    this.textSnapshot = textSnapshot;
}
 
開發者ID:pgcodekeeper,項目名稱:pgcodekeeper,代碼行數:8,代碼來源:QuickUpdate.java


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