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


Java IContainer.getFile方法代碼示例

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


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

示例1: addJvmOptions

import org.eclipse.core.resources.IContainer; //導入方法依賴的package包/類
private void addJvmOptions ( final ILaunchConfigurationWorkingCopy cfg, final Profile profile, final IContainer container ) throws CoreException
{
    final List<String> args = new LinkedList<> ();

    args.addAll ( profile.getJvmArguments () );

    for ( final SystemProperty p : profile.getProperty () )
    {
        addSystemProperty ( profile, args, p.getKey (), p.getValue (), p.isEval () );
    }

    for ( final Map.Entry<String, String> entry : getInitialProperties ().entrySet () )
    {
        addSystemProperty ( profile, args, entry.getKey (), entry.getValue (), false );
    }

    final IFile dataJson = container.getFile ( new Path ( "data.json" ) ); //$NON-NLS-1$
    if ( dataJson.exists () )
    {
        addJvmArg ( args, "org.eclipse.scada.ca.file.provisionJsonUrl", escapeArgValue ( dataJson.getLocation ().toFile ().toURI ().toString () ) ); //$NON-NLS-1$
    }

    cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, StringHelper.join ( args, "\n" ) );
    cfg.setAttribute ( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, StringHelper.join ( profile.getArguments (), "\n" ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:LaunchShortcut.java

示例2: createFileDeleteIfExists

import org.eclipse.core.resources.IContainer; //導入方法依賴的package包/類
/**
 * Create a file in a folder with the specified name and content
 * 
 * @param fullpath
 * @param filename
 * @param content
 * @throws CoreException
 * @throws InterruptedException
 */
public static IFile createFileDeleteIfExists(String fullpath, String filename, String content,
		IProgressMonitor monitor) throws CoreException, InterruptedException {
	SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
	subMonitor.setTaskName("Create file delete if it exists " + fullpath);
	IFile newFile;
	try {
		IWorkspaceRoot wroot = ResourcesPlugin.getWorkspace().getRoot();
		IContainer container = (IContainer) wroot.findMember(new Path(fullpath));
		newFile = container.getFile(new Path(filename));
		if (newFile.exists()) {
			JDTManager.rename(newFile, new NullProgressMonitor());
			newFile.delete(true, new NullProgressMonitor());
		}
		subMonitor.split(30);
		byte[] source = content.getBytes(Charset.forName("UTF-8"));
		newFile.create(new ByteArrayInputStream(source), true, new NullProgressMonitor());
		subMonitor.split(70);
	} finally {
		subMonitor.done();
	}
	return newFile;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:32,代碼來源:ResourceManager.java

示例3: copyFiles

import org.eclipse.core.resources.IContainer; //導入方法依賴的package包/類
public static void copyFiles(File srcFolder, IContainer destFolder) throws CoreException, FileNotFoundException {
	for (File f : srcFolder.listFiles()) {
		if (f.isDirectory()) {
			IFolder newFolder = destFolder.getFolder(new Path(f.getName()));
			newFolder.create(true, true, null);
			copyFiles(f, newFolder);
		} else {
			IFile newFile = destFolder.getFile(new Path(f.getName()));
			InputStream in = new FileInputStream(f);
			try {
				newFile.create(in, true, null);
			} finally {
				try {
					if (in != null)
						in.close();
				} catch (IOException e) {
				}
			}
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:22,代碼來源:ImportHelper.java

示例4: copyFile

import org.eclipse.core.resources.IContainer; //導入方法依賴的package包/類
public static void copyFile(File f, IContainer destFolder) throws CoreException, FileNotFoundException {
	IFile newFile = destFolder.getFile(new Path(f.getName()));
	InputStream in = new FileInputStream(f);
	try {
		newFile.create(in, true, null);
	} finally {
		try {
			if (in != null)
				in.close();
		} catch (IOException e) {
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:14,代碼來源:ImportHelper.java

示例5: get

import org.eclipse.core.resources.IContainer; //導入方法依賴的package包/類
/**
 * @param folder
 * @param file
 * @return
 */
public static IFile get(IContainer folder, String file) {
	final IFile buildfile = folder.getFile(new Path(file));
	return buildfile;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:10,代碼來源:ResourceManager.java


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