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


Java IProjectDescription類代碼示例

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


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

示例1: configure

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
@Override
public void configure() throws CoreException {
	IProjectDescription desc = project.getDescription();
	ICommand[] commands = desc.getBuildSpec();

	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(MinifyBuilder.BUILDER_ID)) {
			return;
		}
	}

	ICommand[] newCommands = new ICommand[commands.length + 1];
	System.arraycopy(commands, 0, newCommands, 0, commands.length);
	ICommand command = desc.newCommand();
	command.setBuilderName(MinifyBuilder.BUILDER_ID);
	newCommands[newCommands.length - 1] = command;
	desc.setBuildSpec(newCommands);
	project.setDescription(desc, null);
}
 
開發者ID:mnlipp,項目名稱:EclipseMinifyBuilder,代碼行數:20,代碼來源:MinifyNature.java

示例2: deconfigure

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
@Override
public void deconfigure() throws CoreException {
	IProjectDescription description = getProject().getDescription();
	ICommand[] commands = description.getBuildSpec();
	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(MinifyBuilder.BUILDER_ID)) {
			ICommand[] newCommands = new ICommand[commands.length - 1];
			System.arraycopy(commands, 0, newCommands, 0, i);
			System.arraycopy(commands, i + 1, newCommands, i,
					commands.length - i - 1);
			description.setBuildSpec(newCommands);
			project.setDescription(description, null);
			return;
		}
	}
}
 
開發者ID:mnlipp,項目名稱:EclipseMinifyBuilder,代碼行數:17,代碼來源:MinifyNature.java

示例3: configure

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
public void configure() throws CoreException {
	IProjectDescription desc = project.getDescription();
	ICommand[] commands = desc.getBuildSpec();

	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(GemocSequentialLanguageBuilder.BUILDER_ID)) {
			return;
		}
	}

	ICommand[] newCommands = new ICommand[commands.length + 1];
	System.arraycopy(commands, 0, newCommands, 0, commands.length);
	ICommand command = desc.newCommand();
	command.setBuilderName(GemocSequentialLanguageBuilder.BUILDER_ID);
	newCommands[newCommands.length - 1] = command;
	desc.setBuildSpec(newCommands);
	project.setDescription(desc, null);
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:19,代碼來源:GemocSequentialLanguageNature.java

示例4: addAsMainNature

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
public static void addAsMainNature(IProject project, String natureID, IProgressMonitor monitor) throws CoreException{
	if (monitor != null && monitor.isCanceled()) {
		throw new OperationCanceledException();
	}
	if (!project.hasNature(natureID)) {
		IProjectDescription description = project.getDescription();
		String[] natures = description.getNatureIds();
		String[] newNatures = new String[natures.length + 1];
		System.arraycopy(natures, 0, newNatures, 1, natures.length);
		newNatures[0] = natureID;
		description.setNatureIds(newNatures);
		project.setDescription(description, null);
	} else {
		if (monitor != null) {
			monitor.worked(1);
		}
	}
}
 
開發者ID:eclipse,項目名稱:gemoc-studio-modeldebugging,代碼行數:19,代碼來源:AddRemoveGemocSequentialLanguageNatureHandler.java

示例5: createProject

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
protected void createProject ( final IProgressMonitor monitor ) throws CoreException
{
    monitor.beginTask ( "Create project", 2 );

    final IProject project = this.info.getProject ();

    final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( project.getName () );
    desc.setLocation ( this.info.getProjectLocation () );
    desc.setNatureIds ( new String[] { Constants.PROJECT_NATURE_CONFIGURATION, PROJECT_NATURE_JS } );

    final ICommand jsCmd = desc.newCommand ();
    jsCmd.setBuilderName ( BUILDER_JS_VALIDATOR );

    final ICommand localBuilder = desc.newCommand ();
    localBuilder.setBuilderName ( Constants.PROJECT_BUILDER );

    desc.setBuildSpec ( new ICommand[] { jsCmd, localBuilder } );

    if ( !project.exists () )
    {
        project.create ( desc, new SubProgressMonitor ( monitor, 1 ) );
        project.open ( new SubProgressMonitor ( monitor, 1 ) );
    }
    monitor.done ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:26,代碼來源:CreateProjectOperation.java

示例6: createFeatureProject

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
private void createFeatureProject ( final IProject project, final Map<String, String> properties, final IProgressMonitor monitor ) throws CoreException
{
    monitor.beginTask ( "Creating feature project", 6 );

    final String name = this.pluginId + ".feature"; //$NON-NLS-1$
    final IProjectDescription desc = project.getWorkspace ().newProjectDescription ( name );

    final ICommand featureBuilder = desc.newCommand ();
    featureBuilder.setBuilderName ( "org.eclipse.pde.FeatureBuilder" ); //$NON-NLS-1$

    desc.setNatureIds ( new String[] { "org.eclipse.pde.FeatureNature" } ); //$NON-NLS-1$
    desc.setBuildSpec ( new ICommand[] {
            featureBuilder
    } );

    final IProject newProject = project.getWorkspace ().getRoot ().getProject ( name );
    newProject.create ( desc, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    newProject.open ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1

    addFilteredResource ( newProject, "pom.xml", getResource ( "feature-pom.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    addFilteredResource ( newProject, "feature.xml", getResource ( "feature/feature.xml" ), "UTF-8", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    addFilteredResource ( newProject, "feature.properties", getResource ( "feature/feature.properties" ), "ISO-8859-1", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    addFilteredResource ( newProject, "build.properties", getResource ( "feature/build.properties" ), "ISO-8859-1", properties, new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1

    monitor.done ();
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:27,代碼來源:ClientTemplate.java

示例7: createProjectPluginResource

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
public IProject createProjectPluginResource(String projectName, IProgressMonitor monitor) throws CoreException {
	IWorkspace myWorkspace = ResourcesPlugin.getWorkspace();
	IWorkspaceRoot myWorkspaceRoot = myWorkspace.getRoot();
	IProject resourceProject = myWorkspaceRoot.getProject(projectName);
	
	if (!resourceProject.exists()) {		
		if(myWorkspaceRoot.getLocation().toFile().equals(new Path(Engine.PROJECTS_PATH).toFile())){
			logDebug("createProjectPluginResource : project is in the workspace folder");
			
			resourceProject.create(monitor);
		}else{
			logDebug("createProjectPluginResource: project isn't in the workspace folder");
	
			IPath projectPath = new Path(Engine.PROJECTS_PATH + "/" + projectName).makeAbsolute();
			IProjectDescription description = myWorkspace.newProjectDescription(projectName);
			description.setLocation(projectPath);
			resourceProject.create(description, monitor);
		}
	}
	
	return resourceProject;
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:23,代碼來源:ConvertigoPlugin.java

示例8: removeBuilderFromProject

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
public static void removeBuilderFromProject(IProjectDescription description)
{
	// Look for builder.
	int index = -1;
	ICommand[] cmds = description.getBuildSpec();
	for( int j = 0; j < cmds.length; j++ )
	{
		if( cmds[j].getBuilderName().equals(BUILDER_ID) )
		{
			index = j;
			break;
		}
	}
	if( index == -1 )
		return;

	// Remove builder from project.
	List<ICommand> newCmds = new ArrayList<ICommand>();
	newCmds.addAll(Arrays.asList(cmds));
	newCmds.remove(index);
	description.setBuildSpec(newCmds.toArray(new ICommand[newCmds.size()]));
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:23,代碼來源:JPFManifestBuilder.java

示例9: configure

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
@Override
public void configure() throws CoreException
{
	IProjectDescription description = project.getDescription();
	JPFManifestBuilder.addBuilderToProject(description);
	project.setDescription(description, null);
	JPFClasspathContainer.addToProject(JavaCore.create(project));
	new Job("Check JPF Manifest")
	{
		@Override
		protected IStatus run(IProgressMonitor monitor)
		{
			try
			{
				project.build(IncrementalProjectBuilder.FULL_BUILD, JPFManifestBuilder.BUILDER_ID, null, monitor);
			}
			catch( CoreException e )
			{
				JPFClasspathLog.logError(e);
			}
			return Status.OK_STATUS;
		}
	}.schedule();
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:25,代碼來源:JPFProjectNature.java

示例10: removeGW4ENature

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
/**
 * Remove the GW4E nature from this project This remove the nature
 * and the GraphWalker libraries from its classpath
 * 
 * @param project
 */
public static void removeGW4ENature(IProject project) {
	try {
		IProjectDescription description = project.getDescription();
		List<String> newNatures = new ArrayList<String>();
		for (String natureId : description.getNatureIds()) {
			if (!NATURE_ID.equals(natureId)) {
				newNatures.add(natureId);
			}
		}
		description.setNatureIds(newNatures.toArray(new String[newNatures.size()]));
		project.setDescription(description, null);
	} catch (CoreException e) {
		ResourceManager.logException(e);
		return;
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:23,代碼來源:GW4ENature.java

示例11: setGW4ENature

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
/**
 * Set the GW4E Nature to the passed project
 * 
 * @param project
 * @return
 * @throws CoreException
 */
public static IStatus setGW4ENature(IProject project) throws CoreException {
	IProjectDescription description = project.getDescription();
	String[] natures = description.getNatureIds();
	String[] newNatures = new String[natures.length + 1];
	System.arraycopy(natures, 0, newNatures, 0, natures.length);

	// add our id
	newNatures[natures.length] = GW4ENature.NATURE_ID;

	// validate the natures
	IWorkspace workspace = ResourcesPlugin.getWorkspace();
	IStatus status = workspace.validateNatureSet(newNatures);

	if (status.getCode() == IStatus.OK) {
		description.setNatureIds(newNatures);
		project.setDescription(description, null);
	}
	return status;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:27,代碼來源:GW4ENature.java

示例12: setBuilder

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
/**
 * Set the GW4E builder
 * 
 * @param project
 * @param monitor
 * @throws CoreException
 */
public static void setBuilder(IProject project, IProgressMonitor monitor) throws CoreException {
	IProjectDescription desc = project.getDescription();
	ICommand[] commands = desc.getBuildSpec();

	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
			return;
		}
	}

	ICommand[] newCommands = new ICommand[commands.length + 1];
	System.arraycopy(commands, 0, newCommands, 0, commands.length);
	ICommand command = desc.newCommand();
	command.setBuilderName(GW4EBuilder.BUILDER_ID);
	newCommands[newCommands.length - 1] = command;
	desc.setBuildSpec(newCommands);
	project.setDescription(desc, null);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:ClasspathManager.java

示例13: unsetBuilder

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
/**
 * Remove the GW4E builder
 * 
 * @param project
 * @param monitor
 * @throws CoreException
 */
public static void unsetBuilder(IProject project, IProgressMonitor monitor) throws CoreException {
	IProjectDescription description = project.getDescription();
	ICommand[] commands = description.getBuildSpec();
	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
			ICommand[] newCommands = new ICommand[commands.length - 1];
			System.arraycopy(commands, 0, newCommands, 0, i);
			System.arraycopy(commands, i + 1, newCommands, i, commands.length - i - 1);
			description.setBuildSpec(newCommands);
			project.setDescription(description, null);
			GW4EBuilder.removeProjectProblemMarker(project, monitor);
			return;
		}
	}
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:23,代碼來源:ClasspathManager.java

示例14: hasNature

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
/**
 * Test whether the project has the passed nature
 * 
 * @param receiver
 * @param nature
 * @return
 */
public static boolean hasNature(Object receiver, String nature) {
	IProject project = JDTManager.toJavaProject(receiver);
	if (project == null || !project.isOpen())
		return false;
	IProjectDescription description;
	try {
		description = project.getDescription();
	} catch (CoreException e) {
		ResourceManager.logException(e);
		return false;
	}
	String[] natures = description.getNatureIds();
	for (int i = 0; i < natures.length; i++) {
		if (nature.equalsIgnoreCase(natures[i]))
			return true;
	}
	return false;
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:26,代碼來源:ResourceManager.java

示例15: testUnsetBuilder

import org.eclipse.core.resources.IProjectDescription; //導入依賴的package包/類
@Test
public void testUnsetBuilder() throws Exception {
	IJavaProject p = ProjectHelper.getProject(PROJECT_NAME);
	ClasspathManager.setBuilder(p.getProject(), null);
	IProjectDescription desc = p.getProject().getDescription();
	ICommand[] commands = desc.getBuildSpec();
	boolean found = false;
	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
			found=true;
		}
	}
	assertTrue(found);
	ClasspathManager.unsetBuilder(p.getProject(), null);
	desc = p.getProject().getDescription();
	commands = desc.getBuildSpec();
	found = false;
	for (int i = 0; i < commands.length; ++i) {
		if (commands[i].getBuilderName().equals(GW4EBuilder.BUILDER_ID)) {
			found=true;
		}
	}
	assertFalse(found);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:25,代碼來源:ClasspathManagerTest.java


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