本文整理匯總了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;
}
示例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);
}
}
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
}
}
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}