use of org.eclipse.jface.preference.IPersistentPreferenceStore in project xtext-xtend by eclipse.
the class XtendUIValidationTests method testConfigurableIssueCode.
@Test
public void testConfigurableIssueCode() {
try {
final IPersistentPreferenceStore xtendPrefStore = this.getXtendPreferencesStore();
try {
xtendPrefStore.setValue(IssueCodes.UNUSED_PRIVATE_MEMBER, "warning");
StringConcatenation _builder = new StringConcatenation();
_builder.append("class TestConfigurableIssueCode {");
_builder.newLine();
_builder.append("\t");
_builder.append("private String unusedField = \"unusedField\"");
_builder.newLine();
_builder.append("}");
_builder.newLine();
XtendFile _xtendFile = this.testHelper.xtendFile("TestConfigurableIssueCode.xtend", _builder.toString());
final Procedure1<XtendFile> _function = (XtendFile it) -> {
final XtendMember unusedField = IterableExtensions.<XtendMember>head(IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(it.getXtendTypes(), XtendClass.class)).getMembers());
this.helper.assertWarning(unusedField, XtendPackage.Literals.XTEND_FIELD, IssueCodes.UNUSED_PRIVATE_MEMBER);
};
ObjectExtensions.<XtendFile>operator_doubleArrow(_xtendFile, _function);
xtendPrefStore.setValue(IssueCodes.UNUSED_PRIVATE_MEMBER, "error");
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("class TestConfigurableIssueCode {");
_builder_1.newLine();
_builder_1.append("\t");
_builder_1.append("private String unusedField = \"unusedField\"");
_builder_1.newLine();
_builder_1.append("}");
_builder_1.newLine();
XtendFile _xtendFile_1 = this.testHelper.xtendFile("TestConfigurableIssueCode.xtend", _builder_1.toString());
final Procedure1<XtendFile> _function_1 = (XtendFile it) -> {
final XtendMember unusedField = IterableExtensions.<XtendMember>head(IterableExtensions.<XtendClass>head(Iterables.<XtendClass>filter(it.getXtendTypes(), XtendClass.class)).getMembers());
this.helper.assertError(unusedField, XtendPackage.Literals.XTEND_FIELD, IssueCodes.UNUSED_PRIVATE_MEMBER);
};
ObjectExtensions.<XtendFile>operator_doubleArrow(_xtendFile_1, _function_1);
} finally {
xtendPrefStore.setToDefault(IssueCodes.UNUSED_PRIVATE_MEMBER);
}
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.jface.preference.IPersistentPreferenceStore in project xtext-xtend by eclipse.
the class QuickfixTestBuilder method tearDown.
public void tearDown() {
this.editor = null;
this._workbenchTestHelper.closeAllEditors(false);
final Consumer<IFile> _function = (IFile it) -> {
try {
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
it.delete(true, _nullProgressMonitor);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
};
this._workbenchTestHelper.getFiles().forEach(_function);
this._workbenchTestHelper.getFiles().clear();
if ((this.modifiedIssueCodes != null)) {
IPersistentPreferenceStore _preferenceStore = this.getPreferenceStore();
final Procedure1<IPersistentPreferenceStore> _function_1 = (IPersistentPreferenceStore it) -> {
final Consumer<String> _function_2 = (String code) -> {
it.setToDefault(code);
};
this.modifiedIssueCodes.forEach(_function_2);
it.setToDefault(XbaseBuilderPreferenceAccess.PREF_USE_COMPILER_SOURCE);
it.setToDefault(XbaseBuilderPreferenceAccess.PREF_JAVA_VERSION);
};
ObjectExtensions.<IPersistentPreferenceStore>operator_doubleArrow(_preferenceStore, _function_1);
this.modifiedIssueCodes = null;
}
NullProgressMonitor _nullProgressMonitor = new NullProgressMonitor();
this._syncUtil.yieldToQueuedDisplayJobs(_nullProgressMonitor);
}
use of org.eclipse.jface.preference.IPersistentPreferenceStore in project tdi-studio-se by Talend.
the class DefaultRunProcessService method storeProjectPreferences.
@Override
public void storeProjectPreferences(IPreferenceStore preferenceStore) {
RepositoryWorkUnit workUnit = new //$NON-NLS-1$
RepositoryWorkUnit(//$NON-NLS-1$
"Store project preferences") {
@Override
protected void run() {
try {
if (preferenceStore instanceof IPersistentPreferenceStore) {
((IPersistentPreferenceStore) preferenceStore).save();
}
} catch (IOException e) {
ExceptionHandler.process(e);
}
}
};
workUnit.setAvoidUnloadResources(true);
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(workUnit);
}
use of org.eclipse.jface.preference.IPersistentPreferenceStore in project knime-core by knime.
the class IntroPage method showMissingBrowserWarning.
private void showMissingBrowserWarning(final IWebBrowser browser) {
IPersistentPreferenceStore prefStore = (IPersistentPreferenceStore) KNIMEUIPlugin.getDefault().getPreferenceStore();
boolean omitWarnings = prefStore.getBoolean(PreferenceConstants.P_OMIT_MISSING_BROWSER_WARNING);
if (!omitWarnings) {
MessageDialogWithToggle dialog = MessageDialogWithToggle.openWarning(Display.getDefault().getActiveShell(), "Missing browser integration", "KNIME is unable to display web pages in an internal browser. This may be caused by missing " + "system libraries. Please visit https://www.knime.com/faq#q6 for details.\n" + "Some web pages may open in an external browser.", "Do not show again", false, prefStore, PreferenceConstants.P_OMIT_MISSING_BROWSER_WARNING);
if (dialog.getToggleState()) {
prefStore.setValue(PreferenceConstants.P_OMIT_MISSING_BROWSER_WARNING, true);
try {
prefStore.save();
} catch (IOException ex) {
// too bad, ignore it
}
}
}
}
use of org.eclipse.jface.preference.IPersistentPreferenceStore in project abstools by abstools.
the class ProjectAddLocationHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getActiveMenuSelection(event);
Object firstElement = selection.getFirstElement();
if (firstElement instanceof IProject) {
IProject project = (IProject) firstElement;
AbsNature nature = UtilityFunctions.getAbsNature(project);
if (nature == null)
return null;
IPersistentPreferenceStore projectStore = nature.getProjectPreferenceStore();
boolean locationTypecheckingEnabled = projectStore.getBoolean(Constants.LOCATION_TYPECHECK);
if (!locationTypecheckingEnabled) {
MessageDialog.openInformation(Display.getDefault().getActiveShell(), "Locationtypechecking", "Location type checking is disabled. Please enable for this function to work!");
return null;
}
UtilityFunctions.saveEditors(project, false);
Map<LocationTypeVariable, LocationType> locationTypeInferrerResult = nature.getLocationTypeInferrerResult();
if (locationTypeInferrerResult != null) {
InferMain inferMain = new InferMain();
String commandId = event.getCommand().getId();
if ("org.abs-models.abs.plugin.projectaddalllocations".equals(commandId)) {
inferMain.setConfig(InferMain.Config.values());
} else if ("org.abs-models.abs.plugin.projectaddclasslocations".equals(commandId)) {
inferMain.setConfig(InferMain.Config.CLASSES);
} else if ("org.abs-models.abs.plugin.projectaddfieldlocations".equals(commandId)) {
inferMain.setConfig(InferMain.Config.FIELDS);
} else if ("org.abs-models.abs.plugin.projectaddfunctionlocations".equals(commandId)) {
inferMain.setConfig(InferMain.Config.FUNCTIONS);
} else if ("org.abs-models.abs.plugin.projectaddinterfacelocations".equals(commandId)) {
inferMain.setConfig(InferMain.Config.INTERFACES);
}
try {
inferMain.writeInferenceResultsBack(locationTypeInferrerResult);
try {
project.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
}
} catch (IOException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error while inserting locations", "An error occurred while inserting locations!\n" + e.getLocalizedMessage());
}
}
}
return null;
}
Aggregations