SDK Updater: Minor change to make composite constructor compliant with

SWT designer.

All custom params should be last. SWT Designer expects the first
arg to be the parent composite.
This commit is contained in:
Raphael
2009-06-01 15:21:22 -07:00
parent 595a016713
commit 861624885d
2 changed files with 24 additions and 13 deletions

View File

@@ -74,16 +74,16 @@ public class RemotePackagesPage extends Composite {
private Label mDescriptionLabel; private Label mDescriptionLabel;
/** /**
* Create the composite. * Create the composite.
* @param parent The parent of the composite. * @param parent The parent of the composite.
* @param updaterData An instance of {@link UpdaterData}. If null, a local * @param updaterData An instance of {@link UpdaterData}. If null, a local
* one will be allocated just to help with the SWT Designer. * one will be allocated just to help with the SWT Designer.
* @param updaterWindow The parent window.
*/ */
public RemotePackagesPage(UpdaterWindowImpl updaterWindow, RemotePackagesPage(Composite parent,
Composite parent, UpdaterData updaterData,
UpdaterData updaterData) { UpdaterWindowImpl updaterWindow) {
super(parent, SWT.BORDER); super(parent, SWT.BORDER);
mUpdaterWindow = updaterWindow; mUpdaterWindow = updaterWindow;
@@ -161,11 +161,23 @@ public class RemotePackagesPage extends Composite {
// Hide everything down-below from SWT designer // Hide everything down-below from SWT designer
//$hide>>$ //$hide>>$
/**
* Must be called once to set the adapter input for the sources tree viewer.
*/
public void setInput(RepoSourcesAdapter sources) {
mTreeViewerSources.setContentProvider(sources.getContentProvider());
mTreeViewerSources.setLabelProvider( sources.getLabelProvider());
mTreeViewerSources.setInput(sources);
onTreeSelected();
}
/**
* Called by the constructor right after {@link #createContents(Composite)}.
*/
private void postCreate() { private void postCreate() {
adjustColumnsWidth(); adjustColumnsWidth();
} }
/** /**
* Adds a listener to adjust the columns width when the parent is resized. * Adds a listener to adjust the columns width when the parent is resized.
* <p/> * <p/>
@@ -183,13 +195,12 @@ public class RemotePackagesPage extends Composite {
}); });
} }
public void setInput(RepoSourcesAdapter sources) { /**
mTreeViewerSources.setContentProvider(sources.getContentProvider()); * Called when an item in the package table viewer is selected.
mTreeViewerSources.setLabelProvider( sources.getLabelProvider()); * If the items is an {@link IDescription} (as it should), this will display its long
mTreeViewerSources.setInput(sources); * description in the description area. Otherwise when the item is not of the expected
onTreeSelected(); * type or there is no selection, it empties the description area.
} */
private void onTreeSelected() { private void onTreeSelected() {
ISelection sel = mTreeViewerSources.getSelection(); ISelection sel = mTreeViewerSources.getSelection();
if (sel instanceof ITreeSelection) { if (sel instanceof ITreeSelection) {

View File

@@ -129,7 +129,7 @@ public class UpdaterWindowImpl {
mPagesRootComposite.setLayout(mStackLayout); mPagesRootComposite.setLayout(mStackLayout);
mLocalPackagePage = new LocalPackagesPage(mPagesRootComposite, mUpdaterData); mLocalPackagePage = new LocalPackagesPage(mPagesRootComposite, mUpdaterData);
mRemotePackagesPage = new RemotePackagesPage(this, mPagesRootComposite, mUpdaterData); mRemotePackagesPage = new RemotePackagesPage(mPagesRootComposite, mUpdaterData, this);
mSashForm.setWeights(new int[] {150, 576}); mSashForm.setWeights(new int[] {150, 576});
} }