本文整理汇总了Java中org.eclipse.core.resources.ProjectScope类的典型用法代码示例。如果您正苦于以下问题:Java ProjectScope类的具体用法?Java ProjectScope怎么用?Java ProjectScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectScope类属于org.eclipse.core.resources包,在下文中一共展示了ProjectScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: build
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
@Override
protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args,
IProgressMonitor monitor) throws CoreException {
ProjectScope projectScope = new ProjectScope(getProject());
IEclipsePreferences prefs = projectScope.getNode(BUILDER_ID);
if (kind == FULL_BUILD) {
fullBuild(prefs, monitor);
} else {
IResourceDelta delta = getDelta(getProject());
if (delta == null) {
fullBuild(prefs, monitor);
} else {
incrementalBuild(delta, prefs, monitor);
}
}
return null;
}
示例2: updateConfigurationFromSettings
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
private static boolean updateConfigurationFromSettings(AsciidocConfiguration configuration, IProject project) {
final IScopeContext projectScope = new ProjectScope(project);
IEclipsePreferences preferences = projectScope.getNode(Activator.PLUGIN_ID);
try {
createSettings(project, BACKEND_DEFAULT, RESOURCESPATH_DEFAULT, SOURCESPATH_DEFAULT, STYLESHEETPATH_DEFAULT, TARGETPATH_DEFAULT);
configuration.setBackend(preferences.get(BACKEND_PROPERTY, BACKEND_DEFAULT));
configuration.setResourcesPath(preferences.get(RESOURCESPATH_PROPERTY, RESOURCESPATH_DEFAULT));
configuration.setSourcesPath(preferences.get(SOURCESPATH_PROPERTY, SOURCESPATH_DEFAULT));
configuration.setStylesheetPath(preferences.get(STYLESHEETPATH_PROPERTY, STYLESHEETPATH_DEFAULT));
configuration.setTargetPath(preferences.get(TARGETPATH_PROPERTY, TARGETPATH_DEFAULT));
} catch (BackingStoreException e) {
Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, e.getMessage(), e));
return false;
}
configuration.source = AsciidocConfigurationSource.SETTINGS;
return true;
}
示例3: addSettings
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
private static void addSettings(IProject project, String workspaceRoot, List<String> targets,
List<String> buildFlags) throws BackingStoreException {
IScopeContext projectScope = new ProjectScope(project);
Preferences projectNode = projectScope.getNode(Activator.PLUGIN_ID);
int i = 0;
for (String target : targets) {
projectNode.put("target" + i, target);
i++;
}
projectNode.put("workspaceRoot", workspaceRoot);
i = 0;
for (String flag : buildFlags) {
projectNode.put("buildFlag" + i, flag);
i++;
}
projectNode.flush();
}
示例4: testProjectSavedInPreferencesSelected
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
@Test
public void testProjectSavedInPreferencesSelected()
throws ProjectRepositoryException, InterruptedException, BackingStoreException {
IEclipsePreferences node =
new ProjectScope(project).getNode(DeployPreferences.PREFERENCE_STORE_QUALIFIER);
try {
node.put("project.id", "projectId1");
node.put("account.email", EMAIL_1);
model = new DeployPreferences(project);
initializeProjectRepository();
when(loginService.getAccounts()).thenReturn(twoAccountSet);
deployPanel = createPanel(true /* requireValues */);
deployPanel.latestGcpProjectQueryJob.join();
ProjectSelector projectSelector = getProjectSelector();
IStructuredSelection selection = projectSelector.getViewer().getStructuredSelection();
assertThat(selection.size(), is(1));
assertThat(((GcpProject) selection.getFirstElement()).getId(), is("projectId1"));
} finally {
node.clear();
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:24,代码来源:AppEngineDeployPreferencesPanelTest.java
示例5: getWritablePreferenceStore
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public IPreferenceStore getWritablePreferenceStore(Object context) {
lazyInitialize();
if (context instanceof IFileEditorInput) {
context = ((IFileEditorInput) context).getFile().getProject();
}
if (context instanceof IProject) {
ProjectScope projectScope = new ProjectScope((IProject) context);
FixedScopedPreferenceStore result = new FixedScopedPreferenceStore(projectScope, getQualifier());
result.setSearchContexts(new IScopeContext[] {
projectScope,
new InstanceScope(),
new ConfigurationScope()
});
return result;
}
return getWritablePreferenceStore();
}
示例6: setOrganizeImportSettings
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
protected void setOrganizeImportSettings(
String[] order, int threshold, int staticThreshold, IJavaProject project) {
IEclipsePreferences scope =
new ProjectScope(project.getProject()).getNode("org.eclipse.jdt.ui");
if (order == null) {
scope.remove(PreferenceConstants.ORGIMPORTS_IMPORTORDER);
scope.remove(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD);
} else {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < order.length; i++) {
buf.append(order[i]);
buf.append(';');
}
scope.put(PreferenceConstants.ORGIMPORTS_IMPORTORDER, buf.toString());
scope.put(PreferenceConstants.ORGIMPORTS_ONDEMANDTHRESHOLD, String.valueOf(threshold));
scope.put(
PreferenceConstants.ORGIMPORTS_STATIC_ONDEMANDTHRESHOLD, String.valueOf(staticThreshold));
}
}
示例7: getLineDelimiterPreference
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
public static String getLineDelimiterPreference(IProject project) {
IScopeContext[] scopeContext;
if (project != null) {
// project preference
scopeContext = new IScopeContext[] {new ProjectScope(project)};
String lineDelimiter =
Platform.getPreferencesService()
.getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
if (lineDelimiter != null) return lineDelimiter;
}
// workspace preference
scopeContext = new IScopeContext[] {InstanceScope.INSTANCE};
String platformDefault =
System.getProperty("line.separator", "\n"); // $NON-NLS-1$ //$NON-NLS-2$
return Platform.getPreferencesService()
.getString(
Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, platformDefault, scopeContext);
}
示例8: formatOnSaveEnabled
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
private boolean formatOnSaveEnabled(IJavaProject javaProject) {
SaveParticipantRegistry spr = JavaPlugin.getDefault().getSaveParticipantRegistry();
IPostSaveListener[] listeners = spr.getEnabledPostSaveListeners(javaProject.getProject());
for (IPostSaveListener listener : listeners) {
if (listener instanceof CleanUpPostSaveListener) {
Map<String, String> settings =
CleanUpPreferenceUtil.loadSaveParticipantOptions(new ProjectScope(
javaProject.getProject()));
if (settings == null) {
return false;
}
return (CLEAN_UP_OPTION_TRUE.equals(settings.get(CleanUpConstants.FORMAT_SOURCE_CODE)));
}
}
return false;
}
示例9: getProjectPreferences
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
private final IEclipsePreferences getProjectPreferences() {
final IAdaptable element = getElement();
IProject project = null;
if (element instanceof IJavaProject) {
project = ((IJavaProject) element).getProject();
}
else if (element instanceof IProject) {
project = (IProject) element;
}
if (project != null) {
final IScopeContext context = new ProjectScope(project);
return context.getNode(BaseIds.ID);
}
return null;
}
示例10: initPreferencesStore
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
private void initPreferencesStore() {
IScopeContext projectScope = new ProjectScope(project);
preferences = projectScope.getNode(FileSyncPlugin.PLUGIN_ID);
buildPathMap(preferences);
preferences.addPreferenceChangeListener(this);
preferences.addNodeChangeListener(this);
IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
manager.addValueVariableListener(this);
jobChangeAdapter = new JobChangeAdapter(){
@Override
public void done(IJobChangeEvent event) {
// XXX dirty trick to re-evaluate dynamic egit variables on branch change
if(!event.getJob().getClass().getName().contains("org.eclipse.egit.ui.internal.branch.BranchOperationUI")){
return;
}
rebuildPathMap();
}
};
Job.getJobManager().addJobChangeListener(jobChangeAdapter);
ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
}
示例11: createPreferenceScopes
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
protected IScopeContext[] createPreferenceScopes(
NestedValidatorContext context) {
if (context != null) {
final IProject project = context.getProject();
if (project != null && project.isAccessible()) {
final ProjectScope projectScope = new ProjectScope(project);
if (projectScope.getNode(
JSONCorePlugin.getDefault().getBundle()
.getSymbolicName()).getBoolean(
JSONCorePreferenceNames.USE_PROJECT_SETTINGS, false))
return new IScopeContext[] { projectScope,
new InstanceScope(), new DefaultScope() };
}
}
return new IScopeContext[] { new InstanceScope(), new DefaultScope() };
}
示例12: getSelected
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
public IProfile getSelected(IProject project)
{
IProfile selected = fSelected.get(project);
if (selected == null && project != null)
{
// try to resolve the selected profile
PreferenceKey activeProfileKey = getActiveProfileKey();
ProjectScope scope = new ProjectScope(project);
IProfile profile = findProfile(activeProfileKey.getStoredValue(scope));
if (profile != null)
{
fSelected.put(project, profile);
selected = profile;
}
else
{
// Return the default workspace setting
selected = fSelected.get(null);
}
}
return selected;
}
示例13: hasProjectSpecificOptions
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
public boolean hasProjectSpecificOptions(IProject project)
{
if (project != null)
{
IScopeContext projectContext = new ProjectScope(project);
PreferenceKey[] allKeys = fAllKeys;
for (int i = 0; i < allKeys.length; i++)
{
if (allKeys[i].getStoredValue(projectContext, fManager) != null)
{
return true;
}
}
}
return false;
}
示例14: getActiveUserAgentIDs
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
/**
* Given a project, return the list of active user agent IDs. The current implementation processes only the first
* (primary) nature ID of the given project. Secondary natures may be taken into consideration at a later point in
* time
*
* @param project
* An {@link IProject}.
* @return Returns an array of user agent IDs for the main mature of the given project. In case the given project is
* null, an empty string array is returned.
*/
public String[] getActiveUserAgentIDs(IProject project)
{
if (project == null)
{
return ArrayUtil.NO_STRINGS;
}
// Extract the natures from the given project
String[] natureIDs = getProjectNatures(project);
// Look at the project-scope preferences for the active agents.
ProjectScope scope = new ProjectScope(project);
IEclipsePreferences node = scope.getNode(CommonEditorPlugin.PLUGIN_ID);
if (node != null)
{
String agents = node.get(IPreferenceConstants.USER_AGENT_PREFERENCE, null);
if (agents != null)
{
Map<String, String[]> userAgents = extractUserAgents(agents);
return getActiveUserAgentIDs(userAgents, natureIDs);
}
}
// In case we did not find any project-specific settings, use the project's nature IDs to grab the agents that
// were set in the workspace settings.
return getActiveUserAgentIDs(natureIDs);
}
示例15: clearPreferences
import org.eclipse.core.resources.ProjectScope; //导入依赖的package包/类
public void clearPreferences(IProject project)
{
if (project != null)
{
// Save to the project scope
IEclipsePreferences preferences = new ProjectScope(project).getNode(CommonEditorPlugin.PLUGIN_ID);
preferences.remove(IPreferenceConstants.USER_AGENT_PREFERENCE);
try
{
preferences.flush();
}
catch (BackingStoreException e)
{
// ignore
}
}
}