use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class CreaterepoPreferencePage method init.
@Override
public void init(IWorkbench workbench) {
setPreferenceStore(new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID));
setDescription(Messages.CreaterepoPreferencePage_description);
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class ToggleRpmlintNatureAction method toggleNature.
/**
* Toggles rpmlint nature on a project.
*
* @param project
* The project on which to toggle the nature.
*/
private static void toggleNature(IProject project) {
String rpmlintPath = new ScopedPreferenceStore(InstanceScope.INSTANCE, Activator.PLUGIN_ID).getString(PreferenceConstants.P_RPMLINT_PATH);
if (!Files.exists(Paths.get(rpmlintPath))) {
IStatus warning = new Status(IStatus.WARNING, Activator.PLUGIN_ID, 1, Messages.RunRpmlintAction_1, null);
ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.RunRpmlintAction_2, null, warning);
return;
}
try {
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
for (int i = 0; i < natures.length; ++i) {
if (RpmlintNature.NATURE_ID.equals(natures[i])) {
// Remove the nature
String[] newNatures = new String[natures.length - 1];
System.arraycopy(natures, 0, newNatures, 0, i);
System.arraycopy(natures, i + 1, newNatures, i, natures.length - i - 1);
description.setNatureIds(newNatures);
project.setDescription(description, null);
return;
}
}
// Add the nature
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
newNatures[natures.length] = RpmlintNature.NATURE_ID;
description.setNatureIds(newNatures);
project.setDescription(description, null);
} catch (CoreException e) {
// TODO log exception
}
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project yamcs-studio by yamcs.
the class AutoCompleteService method get.
public int get(final Long uniqueId, final AutoCompleteType acType, final String content, final IAutoCompleteResultListener listener) {
AutoCompletePlugin.getLogger().log(Level.FINE, ">> ChannelNameService get: " + content + " for type: " + acType.value() + " <<");
if (content == null || content.isEmpty())
// no result
return 0;
// Useful to handle default data source
ContentDescriptor desc = new ContentDescriptor();
final IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.csstudio.utility.pv");
// They need to be kept synchronized.
if (store != null)
desc.setDefaultDataSource(store.getString("default_type") + "://");
desc.setContentType(ContentType.Undefined);
desc.setAutoCompleteType(acType);
desc.setOriginalContent(content);
desc.setValue(content);
List<ContentDescriptor> descList = parseContent(desc);
if (DEBUG) {
System.out.println("=============================================");
System.out.println("--- ContentDescriptor list ---");
for (ContentDescriptor ct : descList) System.out.println(ct);
}
// Useful to keep the order
int index = 0;
List<ScheduledContent> providerList = retrieveProviders(acType, descList);
if (DEBUG) {
System.out.println("--- Associated Content ---");
}
// Execute them in parallel
for (ScheduledContent sc : providerList) {
if (DEBUG) {
System.out.println(sc.settings + " => " + sc.desc);
}
final ProviderTask task = new ProviderTask(uniqueId, index, sc.desc, sc.settings, listener);
synchronized (workQueue) {
workQueue.add(task);
}
new Thread(task).start();
index++;
}
return index;
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project eclipse.platform.text by eclipse.
the class WorkbenchChainedTextFontFieldEditor method startPropagate.
/**
* Starts the propagation of the text font preference set in the workbench
* to given target preference store using the given preference key.
*
* @param target the target preference store
* @param targetKey the key to be used in the target preference store
*/
public static void startPropagate(IPreferenceStore target, String targetKey) {
// $NON-NLS-1$
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, "org.eclipse.ui.workbench");
PropagatingFontFieldEditor.startPropagate(store, JFaceResources.TEXT_FONT, target, targetKey);
}
use of org.eclipse.ui.preferences.ScopedPreferenceStore in project linuxtools by eclipse.
the class GprofLaunchTest method setUp.
@Before
public void setUp() throws Exception {
// $NON-NLS-1$
proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), "fibTest");
ProjectScope ps = new ProjectScope(proj.getProject());
ScopedPreferenceStore scoped = new ScopedPreferenceStore(ps, ProviderProfileConstants.PLUGIN_ID);
scoped.setSearchContexts(new IScopeContext[] { ps, InstanceScope.INSTANCE });
scoped.setValue(ProviderProfileConstants.PREFS_KEY + GPROF_CATEGORY, GPROF_PROVIDER_ID);
scoped.setValue(ProviderProfileConstants.USE_PROJECT_SETTINGS + GPROF_CATEGORY, true);
scoped.save();
IExtensionPoint extPoint = Platform.getExtensionRegistry().getExtensionPoint(LAUNCH_SHORT_EXTPT);
IConfigurationElement[] configs = extPoint.getConfigurationElements();
for (IConfigurationElement cfg : configs) {
if (cfg.getAttribute("id").equals(ID)) {
// $NON-NLS-1$
try {
// $NON-NLS-1$
shortcut = (ProviderLaunchShortcut) cfg.createExecutableExtension("class");
// $NON-NLS-1$
launchConfigTypeId = cfg.getChildren("class")[0].getChildren("parameter")[1].getAttribute("value");
} catch (Exception e) {
fail(e.getMessage());
}
}
}
config = createConfiguration(proj.getProject());
// (otherwise test hangs on 'enable GGprof support' dialogue. )
enableGprofSupport();
// ---- Continue with launch.
launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
wc = config.getWorkingCopy();
}
Aggregations