use of org.eclipse.ui.preferences.WorkingCopyManager in project mdw-designer by CenturyLinkCloud.
the class WorkspaceConfigurator method setFormatter.
protected void setFormatter() {
IScopeContext instanceScope = InstanceScope.INSTANCE;
IEclipsePreferences uiPrefs = instanceScope.getNode(JavaUI.ID_PLUGIN);
if (getWorkspaceConfig().getCodeFormatter().equals(WorkspaceConfig.CODE_FORMATTERS[0]))
uiPrefs.put("formatter_profile", "_CenturyLinkIT");
else
uiPrefs.put("formatter_profile", "_MDWCodeFormatter");
try {
uiPrefs.flush();
uiPrefs.sync();
IProfileVersioner profileVersioner = new ProfileVersioner();
ProfileStore profileStore = new FormatterProfileStore(profileVersioner);
List<ProfileManager.Profile> profiles = profileStore.readProfiles(instanceScope);
if (profiles == null)
profiles = profileStore.readProfiles(DefaultScope.INSTANCE);
if (profiles == null)
profiles = new ArrayList<>();
WorkingCopyManager workingCopyManager = new WorkingCopyManager();
PreferencesAccess access = PreferencesAccess.getWorkingCopyPreferences(workingCopyManager);
ProfileManager profileManager = new FormatterProfileManager(profiles, instanceScope, access, profileVersioner);
profileManager.commitChanges(instanceScope);
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Set Code Formatter");
}
}
use of org.eclipse.ui.preferences.WorkingCopyManager in project xtext-eclipse by eclipse.
the class PropertyAndPreferencePage method getWorkingCopyManager.
protected IWorkingCopyManager getWorkingCopyManager() {
IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
IWorkingCopyManager manager;
if (container == null) {
manager = new WorkingCopyManager();
} else {
manager = container.getWorkingCopyManager();
}
return manager;
}
Aggregations