in PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.azureexplorer/src/com/microsoft/azuretools/azureexplorer/editors/container/ContainerRegistryExplorerEditor.java [175:514]
public void createPartControl(Composite parent) {
scrolledComposite = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
panelHolder = new Composite(scrolledComposite, SWT.NONE);
GridLayout glPanelHolder = new GridLayout(1, false);
glPanelHolder.marginHeight = 0;
glPanelHolder.verticalSpacing = 0;
glPanelHolder.horizontalSpacing = 0;
panelHolder.setLayout(glPanelHolder);
progressBar = new ProgressBar(panelHolder, SWT.HORIZONTAL | SWT.INDETERMINATE);
GridData gdProgressBar = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
gdProgressBar.heightHint = PROGRESS_BAR_HEIGHT;
progressBar.setLayoutData(gdProgressBar);
container = new Composite(panelHolder, SWT.NONE);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
GridLayout glContainer = new GridLayout(4, false);
glContainer.marginHeight = 2;
glContainer.marginWidth = 0;
glContainer.horizontalSpacing = 30;
glContainer.verticalSpacing = 10;
container.setLayout(glContainer);
Label lblRegistryName = new Label(container, SWT.NONE);
lblRegistryName.setText(LABEL_NAME);
txtRegistryName = new Text(container, SWT.READ_ONLY | SWT.BORDER);
txtRegistryName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtRegistryName.setText(LOADING);
Label lblAdminUserEnabled = new Label(container, SWT.NONE);
lblAdminUserEnabled.setText(LABEL_ADMIN_USER_ENABLED);
compAdminUserBtn = new Composite(container, SWT.NONE);
compAdminUserBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
GridLayout compositeLayout = new GridLayout(2, true);
compositeLayout.marginWidth = 0;
compositeLayout.marginHeight = 0;
compositeLayout.horizontalSpacing = 0;
compositeLayout.verticalSpacing = 0;
compAdminUserBtn.setLayout(compositeLayout);
btnEnable = new Button(compAdminUserBtn, SWT.NONE);
btnEnable.setEnabled(false);
btnEnable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
btnEnable.setText(BTN_ENABLE);
btnDisable = new Button(compAdminUserBtn, SWT.NONE);
btnDisable.setEnabled(false);
btnDisable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
btnDisable.setText(BTN_DISABLE);
Label lblType = new Label(container, SWT.NONE);
lblType.setText(LABEL_TYPE);
txtType = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtType.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtType.setText(LOADING);
lblUserName = new Label(container, SWT.NONE);
lblUserName.setText(LABEL_USER_NAME);
lblUserName.setVisible(false);
txtUserName = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtUserName.setText(LOADING);
txtUserName.setVisible(false);
Label lblResourceGroup = new Label(container, SWT.NONE);
lblResourceGroup.setText(LABEL_RES_GRP);
txtResGrp = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtResGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtResGrp.setText(LOADING);
lblPrimaryPassword = new Label(container, SWT.NONE);
lblPrimaryPassword.setText(LABEL_PASSWORD);
lblPrimaryPassword.setVisible(false);
lnkPrimaryPassword = new Link(container, SWT.NONE);
lnkPrimaryPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lnkPrimaryPassword.setText(COPY_TO_CLIPBOARD);
lnkPrimaryPassword.setVisible(false);
lnkPrimaryPassword.addListener(SWT.Selection,
new AzureListenerWrapper(INSIGHT_NAME, "lnkPrimaryPassword", null) {
@Override
protected void handleEventFunc(Event event) {
try {
Utils.copyToSystemClipboard(password);
} catch (Exception e) {
onError(e.getMessage());
}
}
});
Label lblSubscriptionId = new Label(container, SWT.NONE);
lblSubscriptionId.setText(LABEL_SUBSCRIPTION);
txtSubscriptionId = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtSubscriptionId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtSubscriptionId.setText(LOADING);
lblSecondaryPassword = new Label(container, SWT.NONE);
lblSecondaryPassword.setText(LABEL_PASSWORD2);
lblSecondaryPassword.setVisible(false);
lnkSecondaryPassword = new Link(container, SWT.NONE);
lnkSecondaryPassword.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
lnkSecondaryPassword.setText(COPY_TO_CLIPBOARD);
lnkSecondaryPassword.setVisible(false);
lnkSecondaryPassword.addListener(SWT.Selection,
new AzureListenerWrapper(INSIGHT_NAME, "lnkSecondaryPassword", null) {
@Override
protected void handleEventFunc(Event event) {
try {
Utils.copyToSystemClipboard(password2);
} catch (Exception e) {
onError(e.getMessage());
}
}
});
Label lblRegion = new Label(container, SWT.NONE);
lblRegion.setText(LABEL_REGION);
txtRegion = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtRegion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtRegion.setText(LOADING);
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
Label lblLoginServerUrl = new Label(container, SWT.NONE);
lblLoginServerUrl.setText(LABEL_LOGIN_SERVER_URL);
txtLoginServerUrl = new Text(container, SWT.BORDER | SWT.READ_ONLY);
txtLoginServerUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
txtLoginServerUrl.setText(LOADING);
new Label(container, SWT.NONE);
new Label(container, SWT.NONE);
label = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL);
label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));
sashForm = new SashForm(container, SWT.NONE);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 4, 1));
cmpoRepo = new Composite(sashForm, SWT.BORDER);
cmpoRepo.setLayout(new GridLayout(2, false));
Label lblRepo = new Label(cmpoRepo, SWT.NONE);
lblRepo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
lblRepo.setText(LABEL_REPOSITORY);
repoRefreshToolBar = new ToolBar(cmpoRepo, SWT.FLAT | SWT.RIGHT);
tltmRefreshRepo = new ToolItem(repoRefreshToolBar, SWT.NONE);
tltmRefreshRepo.setImage(imgRefreshEnable);
tltmRefreshRepo.setToolTipText(TLTM_REFRESH);
tltmRefreshRepo.setText(TLTM_REFRESH);
tltmRefreshRepo.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "tltmRefreshRepo", null) {
@Override
protected void handleEventFunc(Event event) {
disableWidgets(true, true);
containerExplorerPresenter.onRefreshRepositories(subscriptionId, registryId, true /* isNextPage */);
}
});
lstRepo = new org.eclipse.swt.widgets.List(cmpoRepo, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
lstRepo.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
lstRepo.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "lstRepo", null) {
@Override
protected void handleEventFunc(Event event) {
int index = lstRepo.getSelectionIndex();
if (index < 0 || index >= lstRepo.getItemCount()) {
return;
}
String selectedRepo = lstRepo.getItem(index);
if (Utils.isEmptyString(selectedRepo) || selectedRepo.equals(currentRepo)) {
return;
}
currentRepo = selectedRepo;
disableWidgets(false, true);
containerExplorerPresenter.onListTags(subscriptionId, registryId, currentRepo, true /* isNextPage */);
}
});
repoToolBar = new ToolBar(cmpoRepo, SWT.FLAT | SWT.RIGHT);
repoToolBar.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));
tltmRepoPreviousPage = new ToolItem(repoToolBar, SWT.NONE);
tltmRepoPreviousPage.setToolTipText(TLTM_PREVIOUS);
tltmRepoPreviousPage.setText(TLTM_PREVIOUS);;
tltmRepoPreviousPage.setText("Previous");
tltmRepoPreviousPage
.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_BACK));
tltmRepoPreviousPage.addListener(SWT.Selection,
new AzureListenerWrapper(INSIGHT_NAME, "tltmRepoPreviousPage", null) {
@Override
protected void handleEventFunc(Event event) {
disableWidgets(true, true);
containerExplorerPresenter.onListRepositories(subscriptionId, registryId,
false /* isNextPage */);
}
});
tltmRepoNextPage = new ToolItem(repoToolBar, SWT.NONE);
tltmRepoNextPage.setToolTipText(TLTM_NEXT);
tltmRepoNextPage.setText(TLTM_NEXT);
tltmRepoNextPage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_FORWARD));
tltmRepoNextPage.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "tltmRepoNextPage", null) {
@Override
protected void handleEventFunc(Event event) {
disableWidgets(true, true);
containerExplorerPresenter.onListRepositories(subscriptionId, registryId, true /* isNextPage */);
}
});
cmpoTag = new Composite(sashForm, SWT.BORDER);
cmpoTag.setLayout(new GridLayout(2, false));
lblTag = new Label(cmpoTag, SWT.NONE);
lblTag.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
lblTag.setText(LABEL_TAG);
tagRefreshToolBar = new ToolBar(cmpoTag, SWT.FLAT | SWT.RIGHT);
tltmRefreshTag = new ToolItem(tagRefreshToolBar, SWT.NONE);
tltmRefreshTag.setImage(imgRefreshEnable);
tltmRefreshTag.setToolTipText(TLTM_REFRESH);
tltmRefreshTag.setText(TLTM_REFRESH);
tltmRefreshTag.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "tltmRefreshTag", null) {
@Override
protected void handleEventFunc(Event event) {
if (Utils.isEmptyString(currentRepo)) {
return;
}
disableWidgets(false, true);
containerExplorerPresenter.onListTags(subscriptionId, registryId, currentRepo, true /* isNextPage */);
}
});
lstTag = new org.eclipse.swt.widgets.List(cmpoTag, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
lstTag.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
lstTag.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "lstTag", null) {
@Override
protected void handleEventFunc(Event event) {
int index = lstTag.getSelectionIndex();
if (index < 0 || index >= lstTag.getItemCount()) {
return;
}
String selectedTag = lstTag.getItem(index);
if (Utils.isEmptyString(selectedTag) || selectedTag.equals(currentTag)) {
return;
}
currentTag = selectedTag;
}
});
popupMenu = new Menu(lstTag);
MenuItem pullImage = new MenuItem(popupMenu, SWT.NONE);
pullImage.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "menuItem", null) {
@Override
protected void handleEventFunc(Event event) {
pullImage();
}
});
pullImage.setText(PULL_IMAGE);
lstTag.setMenu(popupMenu);
lstTag.addListener(SWT.MenuDetect, new Listener() {
@Override
public void handleEvent(Event event) {
int index = lstTag.getSelectionIndex();
if (index == -1) {
event.doit = false;
}
}
});
tagToolBar = new ToolBar(cmpoTag, SWT.FLAT | SWT.RIGHT);
tagToolBar.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, false, 2, 1));
tltmTagPreviousPage = new ToolItem(tagToolBar, SWT.NONE);
tltmTagPreviousPage.setToolTipText(TLTM_PREVIOUS);
tltmTagPreviousPage.setText(TLTM_PREVIOUS);
tltmTagPreviousPage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_BACK));
tltmTagPreviousPage.addListener(SWT.Selection,
new AzureListenerWrapper(INSIGHT_NAME, "tltmTagPreviousPage", null) {
@Override
protected void handleEventFunc(Event event) {
if (Utils.isEmptyString(currentRepo)) {
return;
}
disableWidgets(false, true);
containerExplorerPresenter.onListTags(subscriptionId, registryId, currentRepo,
false /* isNextPage */);
}
});
tltmTagNextPage = new ToolItem(tagToolBar, SWT.NONE);
tltmTagNextPage.setToolTipText(TLTM_NEXT);
tltmTagNextPage.setText(TLTM_NEXT);
tltmTagNextPage.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_TOOL_FORWARD));
tltmTagNextPage.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "tltmTagNextPage", null) {
@Override
protected void handleEventFunc(Event event) {
if (Utils.isEmptyString(currentRepo)) {
return;
}
disableWidgets(false, true);
containerExplorerPresenter.onListTags(subscriptionId, registryId, currentRepo, true /* isNextPage */);
}
});
sashForm.setWeights(new int[] { 1, 1 });
btnEnable.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "btnEnable", null) {
@Override
protected void handleEventFunc(Event event) {
disableWidgets(true, true);
onAdminUserBtnClick();
}
});
btnDisable.addListener(SWT.Selection, new AzureListenerWrapper(INSIGHT_NAME, "btnDisable", null) {
@Override
protected void handleEventFunc(Event event) {
disableWidgets(false, false);
onAdminUserBtnClick();
}
});
disableWidgets(true, true);
setScrolledCompositeContent();
setChildrenTransparent(panelHolder);
setChildrenTransparent(container);
txtRegistryName.setFocus();
}