Java Code Examples for org.eclipse.core.resources.IProject#setPersistentProperty()

The following examples show how to use org.eclipse.core.resources.IProject#setPersistentProperty() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuntimeEnvironmentPropertyPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
@Override
public boolean performOk() {
	final IProject prj = getProject();
	if (prj == null || !super.performOk()
			|| !saveProjectSpecificOptions(getProject(), useProjectSettings())) {
		return false;
	}
	final ISREInstall projectSRE = this.sreBlock.getSelectedSRE();
	final boolean isSystemWide = this.sreBlock.isSystemWideDefaultSRE();
	final String id = (projectSRE == null) ? null : projectSRE.getId();
	try {
		prj.setPersistentProperty(
				qualify(PROPERTY_NAME_USE_SYSTEM_WIDE_SRE),
				Boolean.toString(isSystemWide));
		prj.setPersistentProperty(
				qualify(PROPERTY_NAME_SRE_INSTALL_ID),
				id);
		return true;
	} catch (CoreException e) {
		SARLEclipsePlugin.getDefault().log(e);
	}
	return false;
}
 
Example 2
Source File: DerbyProperties.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void save(IProject project) throws CoreException {
		
		project.setPersistentProperty(new QualifiedName (
			CommonNames.UI_PATH, DSPORT), Integer.toString(port));
		project.setPersistentProperty(new QualifiedName (
			CommonNames.UI_PATH, DSHOST), host);
		project.setPersistentProperty(new QualifiedName (
			CommonNames.UI_PATH, DS_SYS_HOME), systemHome);
//		project.setPersistentProperty(new QualifiedName (
//				CommonNames.UI_PATH, DS_RUNNING_PORT), Integer.toString(runningPort));
	}
 
Example 3
Source File: DerbyProperties.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void save(IProject project) throws CoreException {
		
		project.setPersistentProperty(new QualifiedName (
			CommonNames.UI_PATH, DSPORT), Integer.toString(port));
		project.setPersistentProperty(new QualifiedName (
			CommonNames.UI_PATH, DSHOST), host);
		project.setPersistentProperty(new QualifiedName (
			CommonNames.UI_PATH, DS_SYS_HOME), systemHome);
//		project.setPersistentProperty(new QualifiedName (
//				CommonNames.UI_PATH, DS_RUNNING_PORT), Integer.toString(runningPort));
	}
 
Example 4
Source File: WorkspaceModelsManager.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
static public void setValuesProjectDescription(final IProject proj, final boolean builtin, final boolean inPlugin,
	final boolean inTests, final Bundle bundle) {
	/* Modify the project description */
	IProjectDescription desc = null;
	try {

		final List<String> ids = new ArrayList<>();
		ids.add(XTEXT_NATURE);
		ids.add(GAMA_NATURE);
		if ( inTests ) {
			ids.add(TEST_NATURE);
		} else if ( inPlugin ) {
			ids.add(PLUGIN_NATURE);
		} else if ( builtin ) {
			ids.add(BUILTIN_NATURE);
		}
		desc = proj.getDescription();
		desc.setNatureIds(ids.toArray(new String[ids.size()]));
		// Addition of a special nature to the project.
		if ( inTests && bundle == null ) {
			desc.setComment("user defined");
		} else if ( (inPlugin || inTests) && bundle != null ) {
			String name = bundle.getSymbolicName();
			final String[] ss = name.split("\\.");
			name = ss[ss.length - 1] + " plugin";
			desc.setComment(name);
		} else {
			desc.setComment("");
		}
		proj.setDescription(desc, IResource.FORCE, null);
		// Addition of a special persistent property to indicate that the project is built-in
		if ( builtin ) {
			proj.setPersistentProperty(BUILTIN_PROPERTY,
				Platform.getProduct().getDefiningBundle().getVersion().toString());
		}
	} catch (final CoreException e) {
		e.printStackTrace();
	}
}
 
Example 5
Source File: BuildPathManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * setBuildPaths
 * 
 * @param project
 * @param entries
 */
public boolean setBuildPaths(IProject project, Collection<IBuildPathEntry> entries)
{
	if (project == null || entries == null)
	{
		return false;
	}

	List<String> nameAndPaths = CollectionsUtil.map(entries, new IMap<IBuildPathEntry, String>()
	{
		public String map(IBuildPathEntry item)
		{
			return item.getDisplayName() + NAME_AND_PATH_DELIMITER + item.getPath();
		}
	});

	String value = StringUtil.join(BUILD_PATH_ENTRY_DELIMITER, nameAndPaths);

	// FIXME This severely limits the value's size, which we could run into over time! It also does not make the
	// value portable across users/workspaces
	try
	{
		project.setPersistentProperty(getBuildPathPropertyName(), value);
		return true;
	}
	catch (CoreException e)
	{
		// @formatter:off
			String message = MessageFormat.format(
				Messages.BuildPathManager_UnableToSetPersistenceProperty,
				PROJECT_BUILD_PATH_PROPERTY_NAME,
				project.getName()
			);
			// @formatter:on

		IdeLog.logError(BuildPathCorePlugin.getDefault(), message, e);
		return false;
	}
}
 
Example 6
Source File: RuntimeEnvironmentPropertyPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
/** Save the flag that indicates if the specific project options must be
 * used.
 *
 * @param project the project.
 * @param useSpecificOptions indicates if the specific options must be used.
 * @return <code>true</code> if the property was saved successfully.
 */
@SuppressWarnings("static-method")
protected boolean saveProjectSpecificOptions(IProject project, boolean useSpecificOptions) {
	if (project != null) {
		try {
			project.setPersistentProperty(
					qualify(PROPERTY_NAME_HAS_PROJECT_SPECIFIC),
					Boolean.toString(useSpecificOptions));
			return true;
		} catch (CoreException e) {
			SARLEclipsePlugin.getDefault().log(e);
		}
	}
	return false;
}
 
Example 7
Source File: CDEpropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the data path.
 *
 * @param project the project
 * @param dataPath the data path
 */
public static void setDataPath(IProject project, String dataPath) {
  try {
    project.setPersistentProperty(new QualifiedName("", DATAPATH_PROPERTY_KEY), dataPath);
  } catch (CoreException e) {
    throw new InternalErrorCDE("unhandled exception", e);
  }
}
 
Example 8
Source File: CDEpropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the import by default.
 *
 * @param project the project
 * @param byDefault the by default
 */
public static void setImportByDefault(IProject project, String byDefault) {
  try {
    project.setPersistentProperty(new QualifiedName("", BY_DEFAULT_PROPERTY_KEY), byDefault);
  } catch (CoreException e) {
    throw new InternalErrorCDE("unhandled exception", e);
  }
}
 
Example 9
Source File: CDEpropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the add to flow.
 *
 * @param project the project
 * @param byDefault the by default
 */
public static void setAddToFlow(IProject project, String byDefault) {
  try {
    project.setPersistentProperty(new QualifiedName("", ADD_TO_FLOW_PROPERTY_KEY), byDefault);
  } catch (CoreException e) {
    throw new InternalErrorCDE("unhandled exception", e);
  }
}
 
Example 10
Source File: TypeSystemLocationPropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
public static void setTypeSystemLocation(IProject project, String typeSystemLocation) {
  
  try {
    project.setPersistentProperty(new QualifiedName("", TYPE_SYSTEM_PROPERTY), typeSystemLocation);
  } catch (CoreException e) {
    CasEditorPlugin.log(e);
  }
}