当前位置: 首页>>代码示例>>Java>>正文


Java ResourcesPlugin类代码示例

本文整理汇总了Java中org.eclipse.core.resources.ResourcesPlugin的典型用法代码示例。如果您正苦于以下问题:Java ResourcesPlugin类的具体用法?Java ResourcesPlugin怎么用?Java ResourcesPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResourcesPlugin类属于org.eclipse.core.resources包,在下文中一共展示了ResourcesPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupWorkspace

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * Loads (and indexes) all the required external libraries. Also imports all the workspace projects.
 */
@Before
public void setupWorkspace() throws Exception {
	final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	assertTrue("Expected empty workspace. Projects were in workspace: " + Arrays.toString(projects),
			0 == projects.length);
	final URI externalRootLocation = getResourceUri(PROBANDS, EXT_LOC);
	externalLibraryPreferenceStore.add(externalRootLocation);
	final IStatus result = externalLibraryPreferenceStore.save(new NullProgressMonitor());
	assertTrue("Error while saving external library preference changes.", result.isOK());
	waitForAutoBuild();
	for (final String projectName : ALL_PROJECT_IDS) {
		final File projectsRoot = new File(getResourceUri(PROBANDS, WORKSPACE_LOC));
		ProjectUtils.importProject(projectsRoot, projectName);
	}
	waitForAutoBuild();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:RunExternalLibrariesPluginTest.java

示例2: testWorkspaceProjectHidingExternalProject_after

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * Check if index is populated only with workspace project content when the external location with single project is
 * registered and workspace contains project with the same name. External library is registered before project is
 * created in the workspace.
 */
public void testWorkspaceProjectHidingExternalProject_after() throws Exception {

	IProject createJSProject = ProjectUtils.createJSProject("LibFoo");
	IFolder src = configureProjectWithXtext(createJSProject);
	IFile manifest = createJSProject.getProject().getFile("manifest.n4mf");
	assertMarkers("manifest of first project should have no errors", manifest, 0);

	createTestFile(src, "Foo", "console.log('hi')");
	createTestFile(src, "AAAA", "console.log('hi')");
	createTestFile(src, "BBB", "console.log('hi')");
	waitForAutoBuild();

	copyProjectsToLocation(externalLibrariesRoot, "LibFoo");
	setExternalLibrariesPreferenceStoreLocations(externalLibraryPreferenceStore, externalLibrariesRoot);

	Collection<String> expectedWorkspace = collectIndexableFiles(ResourcesPlugin.getWorkspace());

	assertResourceDescriptions(expectedWorkspace, BuilderUtil.getAllResourceDescriptions());

	removeExternalLibrariesPreferenceStoreLocations(externalLibraryPreferenceStore, externalLibrariesRoot);

}
 
开发者ID:eclipse,项目名称:n4js,代码行数:28,代码来源:ExternalPackagesPluginTest.java

示例3: locateUnit

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
public static UnitLocation locateUnit(VFUnit unit) throws CoreException, IOException {
	VFClass vfClass = unit.getVfMethod().getVfClass();
	String className = vfClass.getSootClass().getName();
	String projectName = GlobalSettings.get("AnalysisProject");
	IPath path = new Path("/sootOutput/" + className + ".jimple");
	IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
	File file = project.getFile(path).getLocation().toFile();
	List<String> lines = Files.readAllLines(file.toPath());

	// determine method offset
	int[] methodPosition = find(lines, unit.getVfMethod().getSootMethod().getDeclaration(), 0);

	String toFind = unit.getUnit().toString() + ";";
	int[] position = find(lines, toFind, methodPosition[1]);

	UnitLocation location = new UnitLocation();
	location.jimpleFile = path;
	location.charStart = position[0];
	location.charEnd = position[1];
	location.line = position[2];
	location.project = project;
	location.vfUnit = unit;
	return location;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:25,代码来源:UnitLocator.java

示例4: loadBuildProperties

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
private void loadBuildProperties() {
	String buildPropFilePath = buildPropFilePath();
	IPath bldPropPath = new Path(buildPropFilePath);
	IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(bldPropPath);
	try {
		InputStream reader = iFile.getContents();
		buildProps.load(reader);

	} catch (CoreException | IOException e) {
		MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
				"Exception occurred while loading build properties from file -\n" + e.getMessage());
	}

	Enumeration<?> propertyNames = buildProps.propertyNames();
	populateTextBoxes(propertyNames);

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:18,代码来源:RunConfigDialog.java

示例5: getLogicalSystemDefinition

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
public LogicalSystemNode getLogicalSystemDefinition(String name, String containerName) {
	LogicalSystemNode ret = null;
	if (containerName != null) {
		String[] names = StringUtils.split(containerName, "/");
		IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
		IResource resource = wsRoot.findMember(new Path("/" + names[0]));
		IPath loc = resource.getLocation();
		File file = new File(loc.toOSString() + File.separator + name + ".lsys");
		try {
			ret = ParseUtil.getLogicalSystemNodeFromText(FileUtils.readFileToString(file));
		} catch (IOException e) {
			EclipseUtil.writeStactTraceToConsole(e);
		}
	}
	return ret;
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:PluginUtil.java

示例6: dispose

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void dispose() {
	updateProblemIndication = false;

	ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);

	getSite().getPage().removePartListener(partListener);

	adapterFactory.dispose();

	if (getActionBarContributor().getActiveEditor() == this) {
		getActionBarContributor().setActiveEditor(null);
	}

	for (PropertySheetPage propertySheetPage : propertySheetPages) {
		propertySheetPage.dispose();
	}

	if (contentOutlinePage != null) {
		contentOutlinePage.dispose();
	}

	super.dispose();
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:30,代码来源:HrmEditor.java

示例7: getElements

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
@Override
public IAdaptable[] getElements() {
	final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	final IProject[] elements = new IProject[projects.length];
	int elementCount = 0;
	for (int i = 0, size = projects.length; i < size; i++) {
		final IProject project = projects[i];
		final IN4JSProject n4Project = core.findProject(toUri(project)).orNull();
		if (type == null) { // Other Projects
			if (n4Project == null || !n4Project.exists()) {
				elements[elementCount++] = project;
			}
		} else {
			if (n4Project != null && n4Project.exists() && type.equals(n4Project.getProjectType())) {
				elements[elementCount++] = project;
			}
		}
	}
	return Arrays.copyOfRange(elements, 0, elementCount);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:21,代码来源:ProjectTypeAwareWorkingSetManager.java

示例8: close

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * Closes a project.
 * 
 * @return <code>false</code> if the close process has been canceled by user.
 */
public boolean close() {
	// close opened editors
	closeAllEditors();
	
	// save project and copy temporary files to project files
	boolean bRet = save(true);
	if (bRet) {
		ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);

		// clear Source picker view if needed
		clearSourcePickerView();
		
		Engine.theApp.databaseObjectsManager.clearCache(getObject());
	}
	return bRet;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:22,代码来源:ProjectTreeObject.java

示例9: doSaveAs

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * This also changes the editor's input.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void doSaveAs ()
{
    SaveAsDialog saveAsDialog = new SaveAsDialog ( getSite ().getShell () );
    saveAsDialog.open ();
    IPath path = saveAsDialog.getResult ();
    if ( path != null )
    {
        IFile file = ResourcesPlugin.getWorkspace ().getRoot ().getFile ( path );
        if ( file != null )
        {
            doSaveAs ( URI.createPlatformResourceURI ( file.getFullPath ().toString (), true ), new FileEditorInput ( file ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:RecipeEditor.java

示例10: dialogChanged

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * This method ensures user select Target project and permissions
 */
private void dialogChanged() {
	IResource container = ResourcesPlugin.getWorkspace().getRoot()
			.findMember(new Path(getContainerName().get("TargetPath")));
	

	if (getContainerName().get("TargetPath").length() == 0) {
		updateStatus("File container must be specified");
		return;
	}
	if (container == null
			|| (container.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
		updateStatus("File container must exist");
		return;
	}
	if (!container.isAccessible()) {
		updateStatus("Project must be writable");
		return;
	}
	updateStatus(null);
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:24,代码来源:WizardPageHandler.java

示例11: createSubjobInSpecifiedFolder

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * @param subJobXMLPath
 * @param parameterFilePath
 * @param parameterFile
 * @param subJobFile
 * @param importFromPath
 * @param subjobPath
 * @return
 * @throws InstantiationException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws NoSuchMethodException
 * @throws JAXBException
 * @throws ParserConfigurationException
 * @throws SAXException
 * @throws IOException
 * @throws CoreException
 * @throws FileNotFoundException
 */
public static Container createSubjobInSpecifiedFolder(IPath subJobXMLPath, IPath parameterFilePath, IFile parameterFile,
		IFile subJobFile, IPath importFromPath,String subjobPath) throws InstantiationException, IllegalAccessException,
		InvocationTargetException, NoSuchMethodException, JAXBException, ParserConfigurationException,
		SAXException, IOException, CoreException, FileNotFoundException {
	UiConverterUtil converterUtil = new UiConverterUtil();
	Object[] subJobContainerArray=null;
		IFile xmlFile = ResourcesPlugin.getWorkspace().getRoot().getFile(subJobXMLPath);
		File file = new File(xmlFile.getFullPath().toString());
	if (file.exists()) {
		subJobContainerArray = converterUtil.convertToUiXml(importFromPath.toFile(), subJobFile, parameterFile,true);
	} else {
		IProject iProject = ResourcesPlugin.getWorkspace().getRoot().getProject(parameterFilePath.segment(1));
		IFolder iFolder = iProject.getFolder(subjobPath.substring(0, subjobPath.lastIndexOf('/')));
		if (!iFolder.exists()) {
			iFolder.create(true, true, new NullProgressMonitor());
		}
		IFile subjobXmlFile = iProject.getFile(subjobPath);
		subJobContainerArray = converterUtil.convertToUiXml(importFromPath.toFile(), subJobFile, parameterFile,true);
		if (!subjobXmlFile.exists() && subJobContainerArray[1] == null) {
			subjobXmlFile.create(new FileInputStream(importFromPath.toString()), true, new NullProgressMonitor());
		}
	}
	return (Container) subJobContainerArray[0];
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:44,代码来源:SubjobUiConverterUtil.java

示例12: chooseWorkspace

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
protected void chooseWorkspace ()
{
    final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
    dialog.setTitle ( "Select driver exporter configuration file" );
    dialog.setMessage ( "Choose a driver exporter file for the configuration" );
    dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
    dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
    dialog.setAllowMultiple ( true );
    dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
    if ( dialog.open () == IDialogConstants.OK_ID )
    {
        final IResource resource = (IResource)dialog.getFirstResult ();
        if ( resource != null )
        {
            final String arg = resource.getFullPath ().toString ();
            final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
            this.fileText.setText ( fileLoc );
            makeDirty ();
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:22,代码来源:HiveTab.java

示例13: getTemplates

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * 
 * @param modelingProject the name of the selected modeling project
 * @return the list of all the report templates name that are available in the selected modeling project
 */
public static List<String> getTemplates(String modelingProject) { // For the SimulationManagementWindow (names)
	List<String> templatesName = new ArrayList<String>();
	IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(modelingProject);
	IFolder templatesFolder = project.getFolder("Report Templates");
	try {
		IResource[] folderContent = templatesFolder.members();
		for(IResource resource : folderContent) {
			if(resource.getType() == IFile.FILE && resource.getFileExtension().equals("rptdesign")) {
				templatesName.add(resource.getName());
			}
		}
	} catch (CoreException e) {
		e.printStackTrace();
		JOptionPane.showMessageDialog(null, "Error: " + e.getMessage() + "", "Error", JOptionPane.ERROR_MESSAGE);
	}
	return templatesName;
}
 
开发者ID:cetic,项目名称:SimQRI,代码行数:23,代码来源:WorkspaceManager.java

示例14: showInstruction

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
/**
 * Show the given {@link EObject instruction}.
 * 
 * @param editorPart
 *            the opened {@link DialectEditor}
 * @param instruction
 *            the {@link EObject instruction} to show
 */
public static void showInstruction(DialectEditor editorPart, EObject instruction) {
	final URI resourceURI = instruction.eResource().getURI();
	if (resourceURI.isPlatformResource()) {
		final String resourcePath = resourceURI.toPlatformString(true);
		final IResource resource = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
				resourcePath));
		try {
			final IMarker marker = resource.createMarker(EValidator.MARKER);
			marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
			final TraceabilityMarkerNavigationProvider navigationProvider = new TraceabilityMarkerNavigationProvider(
					(DialectEditor)editorPart);
			navigationProvider.gotoMarker(marker);
			marker.delete();
		} catch (CoreException e) {
			DebugSiriusIdeUiPlugin.INSTANCE.log(e);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:27,代码来源:SiriusEditorUtils.java

示例15: performFinish

import org.eclipse.core.resources.ResourcesPlugin; //导入依赖的package包/类
public boolean performFinish() {
	final Collection<ProjectDescriptor> projectDescriptors = getProjectDescriptors();
	
	WorkspaceJob job = new WorkspaceJob("Unzipping Projects") {
		@Override
		public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
			monitor.beginTask("Unzipping Projects", projectDescriptors.size());
			//System.out.println("Unzipping projects...");
			for ( ProjectDescriptor desc : projectDescriptors ) {
				unzipProject(desc, monitor);
				monitor.worked(1);
			}
			//System.out.println("Projects unzipped");
			return Status.OK_STATUS;
		}
	};
	job.setRule(ResourcesPlugin.getWorkspace().getRoot());
	job.schedule();
	return true;
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:21,代码来源:AbstractExampleWizard.java


注:本文中的org.eclipse.core.resources.ResourcesPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。