18daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll/*
28daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * Copyright (C) 2012 The Android Open Source Project
38daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll *
48daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * Licensed under the Apache License, Version 2.0 (the "License");
58daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * you may not use this file except in compliance with the License.
68daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * You may obtain a copy of the License at
78daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll *
88daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll *      http://www.apache.org/licenses/LICENSE-2.0
98daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll *
108daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * Unless required by applicable law or agreed to in writing, software
118daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * distributed under the License is distributed on an "AS IS" BASIS,
128daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * See the License for the specific language governing permissions and
148daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll * limitations under the License.
158daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll */
168daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
178daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollpackage com.android.sdkuilib.internal.repository.ui;
188daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
198daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdklib.internal.repository.DownloadCache;
208daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdklib.internal.repository.DownloadCache.Strategy;
218daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdklib.util.SparseIntArray;
228daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdkuilib.internal.repository.MockDownloadCache;
238daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdkuilib.internal.repository.UpdaterData;
248daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdkuilib.internal.repository.core.PackageLoader;
258daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdkuilib.internal.repository.core.PkgCategory;
268daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport com.android.sdkuilib.internal.repository.core.PkgContentProvider;
278daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
288daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport org.eclipse.jface.viewers.ColumnLabelProvider;
298daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport org.eclipse.swt.graphics.Font;
308daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
318daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport java.util.ArrayList;
328daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollimport java.util.List;
338daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
348daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Mollpublic class MockPackagesPageImpl extends PackagesPageImpl {
358daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
368daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    public MockPackagesPageImpl(UpdaterData updaterData) {
378daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        super(updaterData);
388daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
398daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
408daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    /** UI is never disposed in the unit test. */
418daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
428daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected boolean isUiDisposed() {
438daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        return false;
448daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
458daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
468daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    /** Sync exec always executes immediately in the unit test, no threading is used. */
478daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
488daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected void syncExec(Runnable runnable) {
498daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        runnable.run();
508daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
518daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
528daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    private MockTreeViewer mTreeViewer;
538daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
548daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
558daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    void postCreate() {
568daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        mTreeViewer = new MockTreeViewer();
578daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        setITreeViewer(mTreeViewer);
588daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
598daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        setIColumns(new MockTreeColumn(mTreeViewer),  // columnName
608daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    new MockTreeColumn(mTreeViewer),  // columnApi
618daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    new MockTreeColumn(mTreeViewer),  // columnRevision
628daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    new MockTreeColumn(mTreeViewer)); // columnStatus
638daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
648daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        super.postCreate();
658daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
668daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
678daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
688daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected void refreshViewerInput() {
698daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        super.setViewerInput();
708daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
718daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
728daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
738daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected boolean isSortByApi() {
748daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        return true;
758daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
768daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
778daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
788daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected Font getTreeFontItalic() {
798daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        return null;
808daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
818daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
828daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
838daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected void loadPackages(boolean useLocalCache, boolean overrideExisting) {
848daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        super.loadPackagesImpl(useLocalCache, overrideExisting);
858daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
868daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
878daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    /**
888daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     * In this mock version, we use the default {@link PackageLoader} which will
898daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     * use the {@link DownloadCache} from the {@link UpdaterData}. This should be
908daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     * the mock download cache, in which case we change the strategy at run-time
918daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     * to set it to only-cache on the first manager update.
928daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     */
938daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    @Override
948daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    protected PackageLoader getPackageLoader(boolean useLocalCache) {
958daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        DownloadCache dc = mUpdaterData.getDownloadCache();
968daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        assert dc instanceof MockDownloadCache;
978daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        if (dc instanceof MockDownloadCache) {
988daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            ((MockDownloadCache) dc).overrideStrategy(useLocalCache ? Strategy.ONLY_CACHE : null);
998daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
1008daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        return mUpdaterData.getPackageLoader();
1018daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
1028daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1038daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    /**
1048daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     * Get a dump-out of the tree in a format suitable for unit testing.
1058daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll     */
1068daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    public String getMockTreeDisplay() throws Exception {
1078daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        return mTreeViewer.getTreeDisplay();
1088daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
1098daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1108daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    private static class MockTreeViewer implements PackagesPageImpl.ICheckboxTreeViewer {
1118daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private final SparseIntArray mWidths = new SparseIntArray();
1128daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private final List<MockTreeColumn> mColumns = new ArrayList<MockTreeColumn>();
1138daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private List<PkgCategory> mInput;
1148daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private PkgContentProvider mPkgContentProvider;
1158daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private String mLastRefresh;
1168daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private static final String SPACE = "                                                 ";
1178daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1188daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        @Override
1198daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public void setInput(List<PkgCategory> input) {
1208daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            mInput = input;
1218daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            refresh();
1228daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
1238daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1248daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        @Override
1258daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public Object getInput() {
1268daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            return mInput;
1278daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
1288daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1298daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        @Override
1308daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public void setContentProvider(PkgContentProvider pkgContentProvider) {
1318daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            mPkgContentProvider = pkgContentProvider;
1328daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
1338daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1348daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        @Override
1358daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public void refresh() {
1368daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            // Recompute the display of the tree
1378daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            StringBuilder sb = new StringBuilder();
1388daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            boolean widthChanged = false;
1398daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1408daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            for (int render = 0; render < (widthChanged ? 2 : 1); render++) {
1418daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                widthChanged = false;
1428daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                sb.setLength(0);
1438daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                for (Object cat : mPkgContentProvider.getElements(mInput)) {
1448daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    if (cat == null) {
1458daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                        continue;
1468daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    }
1478daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1488daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    if (sb.length() > 0) {
1498daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                        sb.append('\n');
1508daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    }
1518daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1528daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    widthChanged |= rowAsString(cat, sb, 3);
1538daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1548daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    Object[] children = mPkgContentProvider.getElements(cat);
1558daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    if (children == null) {
1568daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                        continue;
1578daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    }
1588daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    for (Object child : children) {
1598daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                        sb.append("\n L_");
1608daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                        widthChanged |= rowAsString(child, sb, 0);
1618daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    }
1628daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1638daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            }
1648daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1658daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            mLastRefresh = sb.toString();
1668daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
1678daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
1688daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        boolean rowAsString(Object element, StringBuilder sb, int space) {
1698daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            boolean widthChanged = false;
1708daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            sb.append("[] ");
1718daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            for (int col = 0; col < mColumns.size(); col++) {
1728daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                if (col > 0) {
1738daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    sb.append(" | ");
1748daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1758daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                String t = mColumns.get(col).getLabelProvider().getText(element);
1768daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                if (t == null) {
1778daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    t = "(null)";
1788daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1798daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                int len = t.length();
1808daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                int w = mWidths.get(col);
1818daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                if (len > w) {
1828daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    widthChanged = true;
1838daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    mWidths.put(col, len);
1848daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    w = len;
1858daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1868daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                String pad = len >= w ? "" : SPACE.substring(SPACE.length() - w + len);
1878daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                if (col == 0 && space > 0) {
1888daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    sb.append(SPACE.substring(SPACE.length() - space));
1898daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1908daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                if (col >= 1 && col <= 2) {
1918daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    sb.append(pad);
1928daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1938daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                sb.append(t);
1948daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                if (col == 0 || col > 2) {
1958daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                    sb.append(pad);
1968daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll                }
1978daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            }
1988daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            return widthChanged;
1998daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2008daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2018daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        @Override
2028daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public Object[] getCheckedElements() {
2038daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            return null;
2048daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2058daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2068daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public void addColumn(MockTreeColumn mockTreeColumn) {
2078daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            mColumns.add(mockTreeColumn);
2088daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2098daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2108daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public String getTreeDisplay() {
2118daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            return mLastRefresh;
2128daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2138daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
2148daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2158daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    private static class MockTreeColumn implements PackagesPageImpl.ITreeViewerColumn {
2168daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        private ColumnLabelProvider mLabelProvider;
2178daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2188daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public MockTreeColumn(MockTreeViewer treeViewer) {
2198daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            treeViewer.addColumn(this);
2208daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2218daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2228daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        @Override
2238daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public void setLabelProvider(ColumnLabelProvider labelProvider) {
2248daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            mLabelProvider = labelProvider;
2258daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2268daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll
2278daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        public ColumnLabelProvider getLabelProvider() {
2288daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll            return mLabelProvider;
2298daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll        }
2308daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll    }
2318daea84228bdda8d714f2ab4dfc19a3c2f10271bRaphael Moll}
232