Search in sources :

Example 41 with Pair

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;
}
Also used : Table(org.eclipse.swt.widgets.Table) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) ColumnLayoutData(org.eclipse.jface.viewers.ColumnLayoutData) TableViewer(org.eclipse.jface.viewers.TableViewer) TableLayout(org.eclipse.jface.viewers.TableLayout) Pair(org.eclipse.xtext.xbase.lib.Pair)

Example 42 with Pair

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);
}
Also used : Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Pair(org.eclipse.xtext.xbase.lib.Pair)

Example 43 with Pair

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);
    }
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) ExternalTreeEntry(org.erlide.engine.services.search.ExternalTreeEntry) Entry(java.util.Map.Entry) IErlModule(org.erlide.engine.model.root.IErlModule) ExternalTreeEntry(org.erlide.engine.services.search.ExternalTreeEntry) List(java.util.List) Pair(org.eclipse.xtext.xbase.lib.Pair)

Example 44 with Pair

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());
}
Also used : DefineOption(org.erlide.core.builder.CompilerOption.DefineOption) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) Pair(org.eclipse.xtext.xbase.lib.Pair) Test(org.junit.Test)

Example 45 with Pair

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();
}
Also used : ModuleOption(org.erlide.core.builder.CompilerOption.ModuleOption) PathsOption(org.erlide.core.builder.CompilerOption.PathsOption) Collection(java.util.Collection) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) BooleanOption(org.erlide.core.builder.CompilerOption.BooleanOption) RawOption(org.erlide.core.builder.CompilerOption.RawOption) Pair(org.eclipse.xtext.xbase.lib.Pair)

Aggregations

Pair (org.eclipse.xtext.xbase.lib.Pair)67 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)22 Test (org.junit.Test)15 Collection (java.util.Collection)11 List (java.util.List)11 ArrayList (java.util.ArrayList)9 AbstractHierarchyBuilderTest (org.eclipse.xtext.junit4.ide.AbstractHierarchyBuilderTest)9 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)9 Map (java.util.Map)6 EObject (org.eclipse.emf.ecore.EObject)6 Resource (org.eclipse.emf.ecore.resource.Resource)6 AbstractElement (org.eclipse.xtext.AbstractElement)6 HashMap (java.util.HashMap)5 ParameterizedTypeRef (org.eclipse.n4js.ts.typeRefs.ParameterizedTypeRef)5 Type (org.eclipse.n4js.ts.types.Type)5 EList (org.eclipse.emf.common.util.EList)4 StringConcatenationClient (org.eclipse.xtend2.lib.StringConcatenationClient)4 UnorderedGroup (org.eclipse.xtext.UnorderedGroup)4 LinkedHashMap (java.util.LinkedHashMap)3 LinkedList (java.util.LinkedList)3