use of org.eclipse.xtext.xbase.lib.Pair in project xtext-eclipse by eclipse.
the class AbstractCallHierarchyViewPart method createLocationViewer.
protected TableViewer createLocationViewer(final Composite parent) {
final TableViewer locationViewer = new TableViewer(parent);
ArrayContentProvider _arrayContentProvider = new ArrayContentProvider();
locationViewer.setContentProvider(_arrayContentProvider);
locationViewer.setLabelProvider(this.createLocationLabelProvider());
final TableLayout layout = new TableLayout();
Table _table = locationViewer.getTable();
_table.setLayout(layout);
Table _table_1 = locationViewer.getTable();
_table_1.setHeaderVisible(true);
final Consumer<Pair<Integer, Pair<String, ColumnLayoutData>>> _function = (Pair<Integer, Pair<String, ColumnLayoutData>> it) -> {
layout.addColumnData(it.getValue().getValue());
this.createColumn(locationViewer.getTable(), it.getValue(), (it.getKey()).intValue());
};
IterableExtensions.<Pair<String, ColumnLayoutData>>indexed(((Iterable<? extends Pair<String, ColumnLayoutData>>) Conversions.doWrapArray(this.getLocationColumnDescriptions()))).forEach(_function);
return locationViewer;
}
use of org.eclipse.xtext.xbase.lib.Pair in project erlide_eclipse by erlang.
the class ErlidePreferencePage method addCheckBox.
protected Pair<Button, String> addCheckBox(final Composite parent, final String label, final String key, final int indentation) {
final Button checkBox = new Button(parent, SWT.CHECK);
checkBox.setText(label);
final GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.horizontalIndent = indentation;
gd.horizontalSpan = 2;
checkBox.setLayoutData(gd);
return new Pair<>(checkBox, getDialogPreferenceKey() + "/" + key);
}
use of org.eclipse.xtext.xbase.lib.Pair in project erlide_eclipse by erlang.
the class ErlModelCache method removeProject.
public void removeProject(final IErlProject project) {
// ErlLogger.debug("removeForProject %s", project.getName());
final List<IErlModule> includes = projectIncludeCache.getIfPresent(project);
if (includes != null) {
for (final IErlModule module : includes) {
moduleIncludeCache.invalidate(module);
}
}
final List<IErlModule> modules = projectModuleCache.getIfPresent(project);
if (modules != null) {
for (final IErlModule module : modules) {
moduleIncludeCache.invalidate(module);
}
}
projectIncludeCache.invalidate(project);
projectModuleCache.invalidate(project);
final Set<String> keysToRemove = Sets.newHashSet();
final Set<Entry<String, Pair<IErlProject, List<ExternalTreeEntry>>>> entrySet = externalTreeCache.asMap().entrySet();
for (final Entry<String, Pair<IErlProject, List<ExternalTreeEntry>>> entry : entrySet) {
if (entry.getValue().getKey() == project) {
keysToRemove.add(entry.getKey());
}
}
for (final String keyToRemove : keysToRemove) {
externalTreeCache.invalidate(keyToRemove);
}
}
use of org.eclipse.xtext.xbase.lib.Pair in project erlide_eclipse by erlang.
the class CompilerOptionTest method testToTerm_5.
@Test
public void testToTerm_5() throws OtpParserException {
final DefineOption option = CompilerOptions.DEFINE;
@SuppressWarnings("unchecked") final List<Pair<String, String>> values = Lists.newArrayList(new Pair<>("Macro", "[hej,1]"));
final OtpErlangObject actual = option.toTerm(values);
final String expected = "[{d,'Macro',[hej,1]}]";
Assert.assertEquals(expected, actual.toString());
}
use of org.eclipse.xtext.xbase.lib.Pair in project erlide_eclipse by erlang.
the class CompilerOptions method store.
public void store() throws BackingStoreException {
for (final CompilerOption option : ALL_OPTIONS) {
final Object value = options.get(option);
if (option instanceof BooleanOption) {
final Boolean val = (Boolean) value;
helper.putString(option.getName(), val.toString());
} else if (option instanceof PathsOption) {
if (value != null) {
@SuppressWarnings("unchecked") final Iterable<String> avalue = (Iterable<String>) value;
helper.putString(option.getName(), PathsOption.toString(avalue));
} else {
helper.remove(option.getName());
}
} else if (option instanceof ModuleOption) {
if (value != null) {
final String avalue = (String) value;
helper.putString(option.getName(), avalue);
} else {
helper.remove(option.getName());
}
} else if (option instanceof RawOption) {
if (value != null) {
final String avalue = (String) value;
helper.putString(option.getName(), avalue);
} else {
helper.remove(option.getName());
}
} else {
if (value != null) {
@SuppressWarnings("unchecked") final Collection<Pair<String, String>> val = (Collection<Pair<String, String>>) value;
helper.putString(option.getName(), val.toString());
} else {
helper.remove(option.getName());
}
}
}
helper.flush();
}
Aggregations