use of org.eclipse.core.runtime.preferences.IScopeContext in project erlide_eclipse by erlang.
the class PreferencesHelperTest method nextContexts_1.
@Test
public void nextContexts_1() {
final IScopeContext[] list = PreferencesHelperTest.ALL_SCOPE_CONTEXTS;
final IScopeContext item = ConfigurationScope.INSTANCE;
final IScopeContext[] val = PreferencesHelper.getNextContexts(list, item);
Assert.assertNotNull(val);
Assert.assertEquals(1, val.length);
Assert.assertEquals(DefaultScope.INSTANCE, val[0]);
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project erlide_eclipse by erlang.
the class PreferencesHelper method removeAllAtLowestScope.
public void removeAllAtLowestScope() {
final IScopeContext sc = storeContext;
final IEclipsePreferences p = sc.getNode(qualifier);
if (p != null) {
try {
final String[] keys = p.keys();
for (final String key : keys) {
remove(key, sc);
}
flush();
} catch (final BackingStoreException e) {
}
}
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project liferay-ide by liferay.
the class WorkflowDefinitionValidator method validate.
@Override
public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) {
if (resource.getType() != IResource.FILE) {
return null;
}
ValidationResult result = new ValidationResult();
IFile workflowDefinitionXml = (IFile) resource;
if (workflowDefinitionXml.isAccessible() && CoreUtil.isLiferayProject(resource.getProject())) {
IScopeContext[] scopes = { new InstanceScope(), new DefaultScope() };
ProjectScope projectScope = new ProjectScope(workflowDefinitionXml.getProject());
boolean useProjectSettings = projectScope.getNode(PREFERENCE_NODE_QUALIFIER).getBoolean(ProjectCore.USE_PROJECT_SETTINGS, false);
if (useProjectSettings) {
scopes = new IScopeContext[] { projectScope, new InstanceScope(), new DefaultScope() };
}
try {
Map<String, Object>[] problems = detectProblems(workflowDefinitionXml, scopes);
for (int i = 0; i < problems.length; i++) {
Object messageValue = problems[i].get(IMarker.MESSAGE);
ValidatorMessage message = ValidatorMessage.create(messageValue.toString(), resource);
message.setType(MARKER_TYPE);
message.setAttributes(problems[i]);
result.add(message);
}
if (ListUtil.isNotEmpty(problems)) {
IResource[] resources = { workflowDefinitionXml };
result.setDependsOn(resources);
}
} catch (Exception e) {
KaleoCore.logError(e);
}
}
return result;
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project liferay-ide by liferay.
the class ModuleProjectProviderDefaultValueService method compute.
@Override
protected String compute() {
String retval = "gradle-module";
IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
String defaultProjectBuildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_MODULE_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
if (defaultProjectBuildType != null) {
ILiferayProjectProvider provider = LiferayCore.getProvider(defaultProjectBuildType);
if (provider != null) {
retval = defaultProjectBuildType;
}
}
return retval;
}
use of org.eclipse.core.runtime.preferences.IScopeContext in project liferay-ide by liferay.
the class WorkspaceProjectProviderDefaultValueService method compute.
@Override
protected String compute() {
String retval = "gradle-liferay-workspace";
IScopeContext[] prefContexts = { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
String defaultProjectBuildType = Platform.getPreferencesService().getString(ProjectCore.PLUGIN_ID, ProjectCore.PREF_DEFAULT_WORKSPACE_PROJECT_BUILD_TYPE_OPTION, null, prefContexts);
if (defaultProjectBuildType != null) {
ILiferayProjectProvider provider = LiferayCore.getProvider(defaultProjectBuildType);
if (provider != null) {
retval = defaultProjectBuildType;
}
}
return retval;
}
Aggregations