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

The following examples show how to use org.eclipse.core.resources.IProject#getPersistentProperty() . 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: ResourceUtils.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
public static String getAbsolutePathOfLinkedResource(IResource resource) {
  	try {
  		QualifiedName qn = ResourceUtils.createPersistentPropertyQualifiedName(IResourceAttributes.LINKED_RESOURCE_ORIGINAL_PATH_ATTR_NAME, resource.getFullPath().toOSString());
	IProject project = resource.getProject();
	if (project != null && project.isOpen()) {
		String path = project.getPersistentProperty(qn);
		if (path != null) {
			return getAbsolutePathAsInFS(path);
		}
	}
} catch (CoreException e) {
	LogHelper.logError(e);
}
  	
  	return null;
  }
 
Example 2
Source File: CpplintCheckSettings.java    From CppStyle with MIT License 6 votes vote down vote up
private static boolean enableCpplint(IResource resource) {
	boolean enable = CppStyle.getDefault().getPreferenceStore()
			.getBoolean(CppStyleConstants.ENABLE_CPPLINT_ON_SAVE);

	try {
		IProject project = resource.getProject();
		String enableProjectSpecific = project
				.getPersistentProperty(new QualifiedName("", CppStyleConstants.PROJECTS_PECIFIC_PROPERTY));

		if (enableProjectSpecific != null && Boolean.parseBoolean(enableProjectSpecific)) {
			String value = project
					.getPersistentProperty(new QualifiedName("", CppStyleConstants.ENABLE_CPPLINT_PROPERTY));
			if (value != null) {
				return Boolean.parseBoolean(value);
			}

			return false;
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}

	return enable;
}
 
Example 3
Source File: ClangFormatFormatter.java    From CppStyle with MIT License 6 votes vote down vote up
private boolean enableClangFormatOnSave(IResource resource) {
	boolean enable = CppStyle.getDefault().getPreferenceStore()
			.getBoolean(CppStyleConstants.ENABLE_CLANGFORMAT_ON_SAVE);

	try {
		IProject project = resource.getProject();
		String enableProjectSpecific = project
				.getPersistentProperty(new QualifiedName("", CppStyleConstants.PROJECTS_PECIFIC_PROPERTY));

		if (enableProjectSpecific != null && Boolean.parseBoolean(enableProjectSpecific)) {
			String value = project
					.getPersistentProperty(new QualifiedName("", CppStyleConstants.ENABLE_CLANGFORMAT_PROPERTY));
			if (value != null) {
				return Boolean.parseBoolean(value);
			}

			return false;
		}
	} catch (CoreException e) {
		CppStyle.log(e);
	}

	return enable;
}
 
Example 4
Source File: DerbyProperties.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void load(IProject project) throws CoreException {
		
		String property = project.getPersistentProperty(new QualifiedName (
				CommonNames.UI_PATH, DSPORT));
		port = (property != null && property.length() > 0) ? Integer.parseInt(property) : port;
		property = project.getPersistentProperty(new QualifiedName (
				CommonNames.UI_PATH, DSHOST));
		host = (property != null && property.length() > 0) ? property : host;
		property = project.getPersistentProperty(new QualifiedName (
				CommonNames.UI_PATH, DS_SYS_HOME));
		systemHome = (property != null && property.length() > 0) ? property : systemHome;
//		property = project.getPersistentProperty(new QualifiedName (
//				CommonNames.UI_PATH, DS_RUNNING_PORT));
//		runningPort = (property != null && property.length() > 0) ? Integer.parseInt(property) : runningPort;
	}
 
Example 5
Source File: DerbyProperties.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void load(IProject project) throws CoreException {
		
		String property = project.getPersistentProperty(new QualifiedName (
				CommonNames.UI_PATH, DSPORT));
		port = (property != null && property.length() > 0) ? Integer.parseInt(property) : port;
		property = project.getPersistentProperty(new QualifiedName (
				CommonNames.UI_PATH, DSHOST));
		host = (property != null && property.length() > 0) ? property : host;
		property = project.getPersistentProperty(new QualifiedName (
				CommonNames.UI_PATH, DS_SYS_HOME));
		systemHome = (property != null && property.length() > 0) ? property : systemHome;
//		property = project.getPersistentProperty(new QualifiedName (
//				CommonNames.UI_PATH, DS_RUNNING_PORT));
//		runningPort = (property != null && property.length() > 0) ? Integer.parseInt(property) : runningPort;
	}
 
Example 6
Source File: NonSharedProjectFilter.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static boolean isBinaryPDEProject(IProject project) {
	try {
		return project.hasNature(PDE_NATURE_ID) && project.getPersistentProperty(EXTERNAL_PDE_PROJECT_PROPERTY) != null;
	} catch (CoreException e) {
		return false;
	}
}
 
Example 7
Source File: RuntimeEnvironmentPropertyPage.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean hasProjectSpecificOptions(IProject project) {
	try {
		final String value = project.getPersistentProperty(
				qualify(PROPERTY_NAME_HAS_PROJECT_SPECIFIC));
		return Boolean.parseBoolean(value);
	} catch (CoreException e) {
		SARLEclipsePlugin.getDefault().log(e);
	}
	return false;
}
 
Example 8
Source File: CpplintCheckSettings.java    From CppStyle with MIT License 5 votes vote down vote up
public static String getCpplintRoot(IFile file) {
	IProject project = file.getProject();
	String rootSpec;
	try {
		rootSpec = project.getPersistentProperty(new QualifiedName("", CppStyleConstants.CPPLINT_PROJECT_ROOT));

		if (rootSpec == null || rootSpec.isEmpty()) {
			return null;
		}
	} catch (CoreException e) {
		return null;
	}

	String rootVc = getVersionControlRoot(file);

	if (rootVc == null) {
		return null;
	}

	String relative = new File(rootVc).toURI().relativize(new File(rootSpec).toURI()).getPath();

	if (relative.endsWith("" + Path.SEPARATOR)) {
		return relative.substring(0, relative.length() - 1);
	}

	return relative;
}
 
Example 9
Source File: CDEpropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the data path.
 *
 * @param project the project
 * @return the data path
 */
public static String getDataPath(IProject project) {
  String dataPath;
  try {
    dataPath = project.getPersistentProperty(new QualifiedName("", DATAPATH_PROPERTY_KEY));
  } catch (CoreException e) {
    dataPath = "";
  }
  if (null == dataPath)
    dataPath = "";
  return dataPath;
}
 
Example 10
Source File: CDEpropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the import by default.
 *
 * @param project the project
 * @return the import by default
 */
public static String getImportByDefault(IProject project) {
  String byDefault;
  try {
    byDefault = project.getPersistentProperty(new QualifiedName("", BY_DEFAULT_PROPERTY_KEY));
  } catch (CoreException e) {
    byDefault = "";
  }
  if (null == byDefault)
    byDefault = "";
  return byDefault;
}
 
Example 11
Source File: CDEpropertyPage.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Gets the adds the to flow.
 *
 * @param project the project
 * @return the adds the to flow
 */
public static String getAddToFlow(IProject project) {
  String byDefault;
  try {
    byDefault = project.getPersistentProperty(new QualifiedName("", ADD_TO_FLOW_PROPERTY_KEY));
  } catch (CoreException e) {
    byDefault = "";
  }
  if (null == byDefault)
    byDefault = "";
  return byDefault;
}