use of org.eclipse.core.runtime.Status in project ACS by ACS-Community.
the class ApplicationWorkbenchWindowAdvisor method postWindowOpen.
public void postWindowOpen() {
final IStatusLineManager status = getWindowConfigurer().getActionBarConfigurer().getStatusLineManager();
status.setMessage("Application starting...");
final Display display = getWindowConfigurer().getWindow().getShell().getDisplay();
// Disables the initial view
IViewReference[] views = getWindowConfigurer().getWindow().getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
for (int i = 0; i < views.length; i++) {
if (views[i].getId().compareTo(AlarmSystemView.ID) == 0)
((IMyViewPart) views[i].getView(false)).setEnabled(false);
}
boolean authenticated = false;
AuthenticationDialog d = new AuthenticationDialog(ApplicationWorkbenchWindowAdvisor.this.getWindowConfigurer().getWindow().getShell());
UserAuthenticator.Role role = null;
while (!authenticated) {
d.open();
UserAuthenticator userAuth = new UserAuthenticator();
try {
role = userAuth.authenticate(d.getUser(), d.getPassword());
} catch (UserAuthenticatorException e) {
d.setErrorMessage("Authentication unsuccessful");
continue;
} catch (IllegalArgumentException e) {
d.setErrorMessage("Please authenticate yourselve");
continue;
} finally {
status.setMessage("Authentication successful");
}
authenticated = true;
}
final UserAuthenticator.Role finalRole = role;
new Thread(new Runnable() {
@Override
public void run() {
AlarmSystemManager asm = AlarmSystemManager.getInstance(finalRole);
try {
display.asyncExec(new Runnable() {
public void run() {
status.setMessage("Connecting to Manager");
}
});
asm.connectToManager();
display.asyncExec(new Runnable() {
public void run() {
status.setMessage("Connecting to CDB DAL");
}
});
asm.connectToDAL();
display.asyncExec(new Runnable() {
public void run() {
status.setMessage("Loading contents from the CDB");
}
});
asm.loadFromCDB();
final String error = asm.checkCDB();
if (error.compareTo("") != 0) {
display.asyncExec(new Runnable() {
public void run() {
ErrorDialog edialog = new ErrorDialog(getWindowConfigurer().getWindow().getShell(), "CDB Error", "Error while checking CDB integrity", new Status(IStatus.ERROR, "cl.utfsm.acs.acg", error), IStatus.ERROR);
edialog.setBlockOnOpen(true);
edialog.open();
}
});
}
} catch (Exception e) {
e.printStackTrace();
display.asyncExec(new Runnable() {
public void run() {
status.setErrorMessage("Couldn't successfully connect to AS configuation");
}
});
return;
}
/* If everything went OK:
* Show the other views
* Enable the widgets and inform the user */
display.asyncExec(new Runnable() {
public void run() {
IWorkbenchPage page = getWindowConfigurer().getWindow().getActivePage();
try {
if (finalRole == Role.Administrator || finalRole == Role.Operator) {
page.showView(SourcesView.ID, null, IWorkbenchPage.VIEW_VISIBLE);
page.showView(CategoriesView.ID, null, IWorkbenchPage.VIEW_VISIBLE);
page.showView(AlarmsView.ID, null, IWorkbenchPage.VIEW_VISIBLE);
page.showView(ReductionsView.ID, null, IWorkbenchPage.VIEW_VISIBLE);
page.showView("org.eclipse.pde.runtime.LogView", null, IWorkbenchPage.VIEW_VISIBLE);
}
} catch (PartInitException e) {
status.setErrorMessage("Cannot open other views");
}
IViewReference[] views = page.getViewReferences();
for (int i = 0; i < views.length; i++) {
if (views[i].getId().compareTo(AlarmSystemView.ID) == 0)
((IMyViewPart) views[i].getView(false)).setEnabled(true);
if (finalRole == Role.Operator)
if (views[i].getView(false) instanceof IMyViewPart)
((IMyViewPart) views[i].getView(false)).setReadOnly(true);
}
status.setMessage("Application started successfully");
}
});
}
}).start();
}
use of org.eclipse.core.runtime.Status in project translationstudio8 by heartsome.
the class ConverterViewModel method convert.
/**
* 正向转换
* @param sourceItem
* @param monitor
* @return ;
*/
private Map<String, String> convert(final IConversionItem sourceItem, IProgressMonitor monitor) throws ConverterException {
Map<String, String> result = null;
boolean convertFlg = false;
String xliffDir = ConverterUtil.toLocalPath(configBean.getXliffDir());
String targetFile = ConverterUtil.toLocalPath(configBean.getTarget());
String skeletonFile = ConverterUtil.toLocalPath(configBean.getSkeleton());
// 转换前的准备
ConverterContext converterContext = new ConverterContext(configBean);
final Map<String, String> configuration = converterContext.getConvertConfiguration();
// 转换前,生成临时的XLIFF文件,用此文件生成指定目标语言的XLIFF文件
File targetTempFile = null;
try {
targetTempFile = File.createTempFile("tempxlf", "xlf");
} catch (IOException e) {
LOGGER.error(Messages.getString("model.ConverterViewModel.msg10"), e);
}
configuration.put(Converter.ATTR_XLIFF_FILE, targetTempFile.getAbsolutePath());
if (configBean.getFileType().equals(FileFormatUtils.MS)) {
IPreferenceStore ps = net.heartsome.cat.ts.ui.Activator.getDefault().getPreferenceStore();
String path = ps.getString(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE);
String port = ps.getString(ITranslationPreferenceConstants.PORT_OF_OPENOFFICE);
configuration.put("ooPath", path);
configuration.put("ooPort", port);
}
// 创建skeleton文件
File skeleton = new File(skeletonFile);
if (!skeleton.exists()) {
try {
File parent = skeleton.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
skeleton.createNewFile();
} catch (IOException e) {
String message = MessageFormat.format(Messages.getString("model.ConverterViewModel.msg11"), skeletonFile);
LOGGER.error(message, e);
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message + "\n" + e.getMessage());
throw new ConverterException(status);
}
}
try {
// 执行转换
Converter converter = getConverter();
if (converter == null) {
// Build a message
String message = Messages.getString("model.ConverterViewModel.msg2") + configBean.getFileType();
// Build a new IStatus
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message);
throw new ConverterException(status);
}
result = converter.convert(configuration, monitor);
final String alert = result.get("ttx2xlfAlert39238409230481092830");
if (result.containsKey("ttx2xlfAlert39238409230481092830")) {
//ttx 转 xlf 时,提示含有未预翻译,不推荐,但没办法。
Display.getDefault().syncExec(new Runnable() {
public void run() {
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), Messages.getString("handler.PreviewTranslationHandler.msgTitle"), alert);
}
});
}
// 处理骨架文件,将骨架文件路径修改为项目相对路径,此路径写入external-file节点的href属性
String projectPath = sourceItem.getProject().getLocation().toOSString();
String sklPath = skeletonFile.replace(projectPath, "");
// 处理目标语言, 创建多个目标语言的文件
List<Language> tgtLang = configBean.getHasSelTgtLangList();
if (tgtLang != null && tgtLang.size() > 0) {
// 解析XLIFF文件
File f = new File(targetTempFile.getAbsolutePath());
FileInputStream is = null;
byte[] b = new byte[(int) f.length()];
try {
is = new FileInputStream(f);
is.read(b);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
VTDGen vg = new VTDGen();
vg.setDoc(b);
try {
vg.parse(true);
} catch (VTDException e) {
String message = Messages.getString("model.ConverterViewModel.msg12");
LOGGER.error(message, e);
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message + "\n" + e.getMessage());
throw new ConverterException(status);
}
VTDNav vn = vg.getNav();
VTDUtils vu = new VTDUtils();
// 生成多个XLIFF文件,只是修改目标语言和骨架文件路径
for (Language lang : tgtLang) {
// 修复 bug 2949 ,当文件名中出现 XLIFF 时,文件名获取失败,下面注释代码为之前的代码。 --robert 2013-04-01
// String[] pathArray = targetFile.split(Constant.FOLDER_XLIFF);
// StringBuffer xlffPath = new StringBuffer(pathArray[0]);
// xlffPath.append(Constant.FOLDER_XLIFF).append(File.separator).append(lang.getCode())
// .append(pathArray[1]);
String fileName = targetFile.substring(xliffDir.length());
StringBuffer xlfPahtSB = new StringBuffer();
xlfPahtSB.append(xliffDir);
xlfPahtSB.append(File.separator);
xlfPahtSB.append(lang.getCode());
xlfPahtSB.append(fileName);
File tmpFile = new File(xlfPahtSB.toString());
generateTgtFileList.add(tmpFile);
if (!tmpFile.exists()) {
File parent = tmpFile.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
try {
tmpFile.createNewFile();
} catch (IOException e) {
String message = Messages.getString("model.ConverterViewModel.msg13");
LOGGER.error(message, e);
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message + "\n" + e.getMessage());
throw new ConverterException(status);
}
}
try {
vu.bind(vn.duplicateNav());
} catch (NavException e) {
LOGGER.error("", e);
}
XMLModifier xm = vu.update("/xliff/file/@target-language", lang.getCode(), VTDUtils.CREATE_IF_NOT_EXIST);
xm = vu.update(null, xm, "/xliff/file/header/skl/external-file/@href", TextUtil.cleanString(sklPath));
FileOutputStream fos = null;
try {
fos = new FileOutputStream(tmpFile);
// 写入文件
xm.output(fos);
} catch (Exception e) {
String message = Messages.getString("model.ConverterViewModel.msg13");
LOGGER.error(message, e);
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message + "\n" + e.getMessage());
throw new ConverterNotFoundException(status);
} finally {
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
LOGGER.error("", e);
}
}
}
}
vg.clear();
}
convertFlg = true;
} catch (OperationCanceledException e) {
LOGGER.info("ConverterViewerModel: 取消转换");
} finally {
if (!convertFlg) {
for (File f : generateTgtFileList) {
if (f != null && f.exists()) {
f.delete();
}
}
if (skeleton != null && skeleton.exists()) {
skeleton.delete();
}
}
targetTempFile.delete();
sourceItem.refresh();
}
return result;
}
use of org.eclipse.core.runtime.Status in project translationstudio8 by heartsome.
the class ConverterViewModel method reverseConvert.
/**
* 逆向转换
* @param sourceItem
* @param monitor
* @return ;
*/
private Map<String, String> reverseConvert(IConversionItem sourceItem, IProgressMonitor monitor) throws ConverterException {
Map<String, String> result = null;
String sourcePathStr = configBean.getSource();
String targetFile = ConverterUtil.toLocalPath(configBean.getTarget());
boolean convertSuccessful = false;
File target = null;
try {
target = new File(targetFile);
if (!target.exists()) {
try {
File parent = target.getParentFile();
if (!parent.exists()) {
parent.mkdirs();
}
target.createNewFile();
} catch (IOException e) {
if (LOGGER.isErrorEnabled()) {
String msg = Messages.getString("model.ConverterViewModel.logger4");
Object[] args = { targetFile };
LOGGER.error(new MessageFormat(msg).format(args), e);
}
}
}
Converter converter = getConverter();
if (converter == null) {
// Build a message
String message = Messages.getString("model.ConverterViewModel.msg3") + configBean.getFileType();
// Build a new IStatus
IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message);
throw new ConverterNotFoundException(status);
}
ConverterContext converterContext = new ConverterContext(configBean);
final Map<String, String> configuration = converterContext.getReverseConvertConfiguraion();
if (configBean.getFileType().equals("x-msoffice2003")) {
IPreferenceStore ps = net.heartsome.cat.ts.ui.Activator.getDefault().getPreferenceStore();
String path = ps.getString(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE);
String port = ps.getString(ITranslationPreferenceConstants.PORT_OF_OPENOFFICE);
configuration.put("ooPath", path);
configuration.put("ooPort", port);
}
result = converter.convert(configuration, monitor);
convertSuccessful = true;
} catch (OperationCanceledException e) {
// 捕获用户取消操作的异常
LOGGER.info(Messages.getString("model.ConverterViewModel.logger2"), e);
throw e;
} catch (ConverterNotFoundException e) {
// Let the StatusManager handle the Status and provide a hint
StatusManager.getManager().handle(e.getStatus(), StatusManager.LOG | StatusManager.SHOW);
if (LOGGER.isErrorEnabled()) {
LOGGER.error(e.getMessage(), e);
}
throw e;
} catch (ConverterException e) {
if (LOGGER.isErrorEnabled()) {
LOGGER.error(MessageFormat.format(Messages.getString("model.ConverterViewModel.logger3"), sourcePathStr), e);
}
throw e;
} finally {
if (!convertSuccessful) {
// 在转换失败或用户取消转换时,清除目标文件和骨架文件
if (target != null && target.exists()) {
target.delete();
}
}
sourceItem.refresh();
}
return result;
}
use of org.eclipse.core.runtime.Status in project cubrid-manager by CUBRID.
the class CommonTaskJobExec method exec.
/**
* Execute the task
*
* @param monitor the monitor
* @return <code>true</code>if success;<code>false</code> otherwise
*/
public IStatus exec(IProgressMonitor monitor) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
setDialogVisible(false);
}
});
if (monitor.isCanceled()) {
cancel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
closeDialog();
}
});
return Status.CANCEL_STATUS;
}
for (final ITask task : taskList) {
if (task instanceof AbstractUITask) {
((AbstractUITask) task).execute(monitor);
} else {
task.execute();
}
final String msg = task.getErrorMsg();
if (msg != null && msg.length() > 0 && !monitor.isCanceled() && !isCanceled()) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
setDialogVisible(true);
}
});
return new Status(IStatus.ERROR, CommonUIPlugin.PLUGIN_ID, msg);
} else {
Display.getDefault().syncExec(new Runnable() {
public void run() {
taskExeStatus = refresh(task);
}
});
}
if (taskExeStatus != Status.OK_STATUS) {
Display.getDefault().syncExec(new Runnable() {
public void run() {
setDialogVisible(true);
}
});
return taskExeStatus;
}
if (monitor.isCanceled()) {
cancel();
Display.getDefault().syncExec(new Runnable() {
public void run() {
closeDialog();
}
});
return Status.CANCEL_STATUS;
}
}
return Status.OK_STATUS;
}
use of org.eclipse.core.runtime.Status in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
setMessage("Create Azure App Service");
setTitle("Create App Service");
Composite area = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(area, SWT.NONE);
composite.setLayout(new GridLayout(1, false));
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
Group grpAppService = new Group(composite, SWT.NONE);
grpAppService.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
grpAppService.setLayout(new GridLayout(3, false));
Label lblAppName = new Label(grpAppService, SWT.NONE);
lblAppName.setText("Enter name");
textAppName = new Text(grpAppService, SWT.BORDER);
textAppName.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
cleanError();
}
});
textAppName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textAppName.setMessage("<enter name>");
dec_textAppName = decorateContorolAndRegister(textAppName);
Label lblazurewebsitescom = new Label(grpAppService, SWT.NONE);
lblazurewebsitescom.setText(".azurewebsites.net");
Label lblWebContainer = new Label(grpAppService, SWT.NONE);
lblWebContainer.setText("Web container");
comboWebContainer = new Combo(grpAppService, SWT.READ_ONLY);
comboWebContainer.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
dec_comboWebContainer = decorateContorolAndRegister(comboWebContainer);
Label lblSubscription = new Label(grpAppService, SWT.NONE);
lblSubscription.setText("Subscription");
comboSubscription = new Combo(grpAppService, SWT.READ_ONLY);
comboSubscription.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fillResourceGroups();
fillAppServicePlans();
fillAppServicePlansDetails();
fillAppServicePlanLocations();
}
});
dec_comboSubscription = decorateContorolAndRegister(comboSubscription);
comboSubscription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
// ====
tabFolder = new TabFolder(composite, SWT.NONE);
tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
tabItemAppServicePlan = new TabItem(tabFolder, SWT.NONE);
tabItemAppServicePlan.setText("App service plan");
compositeAppServicePlan = new Composite(tabFolder, SWT.NONE);
tabItemAppServicePlan.setControl(compositeAppServicePlan);
compositeAppServicePlan.setLayout(new GridLayout(2, false));
btnAppServiceCreateNew = new Button(compositeAppServicePlan, SWT.RADIO);
btnAppServiceCreateNew.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioAppServicePlanLogic();
}
});
btnAppServiceCreateNew.setSelection(true);
btnAppServiceCreateNew.setBounds(0, 0, 90, 16);
btnAppServiceCreateNew.setText("Create new");
textAppSevicePlanName = new Text(compositeAppServicePlan, SWT.BORDER);
textAppSevicePlanName.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
cleanError();
}
});
textAppSevicePlanName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textAppSevicePlanName.setMessage("<enter name>");
dec_textAppSevicePlanName = decorateContorolAndRegister(textAppSevicePlanName);
lblAppServiceCreateNewLocation = new Label(compositeAppServicePlan, SWT.NONE);
GridData gd_lblAppServiceCreateNewLocation = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblAppServiceCreateNewLocation.horizontalIndent = 15;
lblAppServiceCreateNewLocation.setLayoutData(gd_lblAppServiceCreateNewLocation);
lblAppServiceCreateNewLocation.setText("Location");
comboAppServicePlanLocation = new Combo(compositeAppServicePlan, SWT.READ_ONLY);
comboAppServicePlanLocation.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
cleanError();
}
});
comboAppServicePlanLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
dec_comboAppServicePlanLocation = decorateContorolAndRegister(comboAppServicePlanLocation);
lblAppServiceCreateNewPricingTier = new Label(compositeAppServicePlan, SWT.NONE);
GridData gd_lblAppServiceCreateNewPricingTier = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblAppServiceCreateNewPricingTier.horizontalIndent = 15;
lblAppServiceCreateNewPricingTier.setLayoutData(gd_lblAppServiceCreateNewPricingTier);
lblAppServiceCreateNewPricingTier.setText("Pricing tier");
comboAppServicePlanPricingTier = new Combo(compositeAppServicePlan, SWT.READ_ONLY);
comboAppServicePlanPricingTier.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
btnAppServiceUseExisting = new Button(compositeAppServicePlan, SWT.RADIO);
btnAppServiceUseExisting.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioAppServicePlanLogic();
}
});
btnAppServiceUseExisting.setText("Use existing");
comboAppServicePlan = new Combo(compositeAppServicePlan, SWT.READ_ONLY);
comboAppServicePlan.setEnabled(false);
comboAppServicePlan.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
comboAppServicePlan.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
fillAppServicePlansDetails();
}
});
comboAppServicePlan.setBounds(0, 0, 26, 22);
dec_comboAppServicePlan = decorateContorolAndRegister(comboAppServicePlan);
lblAppServiceUseExictingLocation = new Label(compositeAppServicePlan, SWT.NONE);
lblAppServiceUseExictingLocation.setEnabled(false);
GridData gd_lblAppServiceUseExictingLocation = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblAppServiceUseExictingLocation.horizontalIndent = 15;
lblAppServiceUseExictingLocation.setLayoutData(gd_lblAppServiceUseExictingLocation);
lblAppServiceUseExictingLocation.setText("Location");
lblAppSevicePlanLocation = new Label(compositeAppServicePlan, SWT.NONE);
lblAppSevicePlanLocation.setEnabled(false);
lblAppSevicePlanLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblAppSevicePlanLocation.setText("N/A");
lblAppServiceUseExistiogPrisingTier = new Label(compositeAppServicePlan, SWT.NONE);
lblAppServiceUseExistiogPrisingTier.setEnabled(false);
GridData gd_lblAppServiceUseExistiogPrisingTier = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblAppServiceUseExistiogPrisingTier.horizontalIndent = 15;
lblAppServiceUseExistiogPrisingTier.setLayoutData(gd_lblAppServiceUseExistiogPrisingTier);
lblAppServiceUseExistiogPrisingTier.setText("Pricing tier");
lblAppServicePlanPricingTier = new Label(compositeAppServicePlan, SWT.NONE);
lblAppServicePlanPricingTier.setEnabled(false);
lblAppServicePlanPricingTier.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblAppServicePlanPricingTier.setText("N/A");
new Label(compositeAppServicePlan, SWT.NONE);
//dec_comboAppServicePlanPricingTier = decorateContorolAndRegister(comboAppServicePlanPricingTier);
linkAppServicePricing = new Link(compositeAppServicePlan, SWT.NONE);
linkAppServicePricing.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
linkAppServicePricing.setText("<a>App service pricing details</a>");
linkAppServicePricing.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
try {
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("https://azure.microsoft.com/en-us/pricing/details/app-service/"));
} catch (PartInitException | MalformedURLException ex) {
LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "widgetSelected@SelectionAdapter@linkAppServicePricing@AppServiceCreateDialog", ex));
}
}
});
tabItemResourceGroup = new TabItem(tabFolder, SWT.NONE);
tabItemResourceGroup.setText("Resource group");
compositeResourceGroup = new Composite(tabFolder, SWT.NONE);
tabItemResourceGroup.setControl(compositeResourceGroup);
compositeResourceGroup.setLayout(new GridLayout(2, false));
btnResourceGroupCreateNew = new Button(compositeResourceGroup, SWT.RADIO);
btnResourceGroupCreateNew.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioResourceGroupLogic();
}
});
btnResourceGroupCreateNew.setSelection(true);
btnResourceGroupCreateNew.setText("Create new");
textResourceGroupName = new Text(compositeResourceGroup, SWT.BORDER);
textResourceGroupName.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
cleanError();
}
});
textResourceGroupName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textResourceGroupName.setBounds(0, 0, 64, 19);
textResourceGroupName.setMessage("<enter name>");
dec_textNewResGrName = decorateContorolAndRegister(textResourceGroupName);
btnResourceGroupUseExisting = new Button(compositeResourceGroup, SWT.RADIO);
btnResourceGroupUseExisting.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioResourceGroupLogic();
}
});
btnResourceGroupUseExisting.setText("Use existing");
comboResourceGroup = new Combo(compositeResourceGroup, SWT.READ_ONLY);
comboResourceGroup.setEnabled(false);
comboResourceGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
comboResourceGroup.setBounds(0, 0, 26, 22);
dec_comboSelectResGr = decorateContorolAndRegister(comboResourceGroup);
tabItemJDK = new TabItem(tabFolder, SWT.NONE);
tabItemJDK.setText("JDK");
compositeJDK = new Composite(tabFolder, SWT.NONE);
tabItemJDK.setControl(compositeJDK);
compositeJDK.setLayout(new GridLayout(3, false));
btnJdkDefault = new Button(compositeJDK, SWT.RADIO);
btnJdkDefault.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioJdkLogic();
}
});
btnJdkDefault.setSelection(true);
btnJdkDefault.setText("Default");
lblJdkDefaultComment = new Label(compositeJDK, SWT.NONE);
lblJdkDefaultComment.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblJdkDefaultComment.setText("Deploy the default JDK (JDK 8)");
new Label(compositeJDK, SWT.NONE);
btnJdk3rdParty = new Button(compositeJDK, SWT.RADIO);
btnJdk3rdParty.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioJdkLogic();
}
});
btnJdk3rdParty.setText("3rd party");
comboJdk3Party = new Combo(compositeJDK, SWT.READ_ONLY);
comboJdk3Party.setEnabled(false);
comboJdk3Party.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
dec_comboJdk3Party = decorateContorolAndRegister(comboJdk3Party);
linkJdkLicense = new Link(compositeJDK, SWT.NONE);
linkJdkLicense.setEnabled(false);
linkJdkLicense.setText("<a>License</a>");
linkJdkLicense.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
try {
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(AzulZuluModel.getLicenseUrl()));
} catch (Exception ex) {
LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "widgetSelected@SelectionAdapter@AppServiceCreateDialo", ex));
}
}
});
btnJdkOwnDownloadUrl = new Button(compositeJDK, SWT.RADIO);
btnJdkOwnDownloadUrl.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
radioJdkLogic();
}
});
btnJdkOwnDownloadUrl.setText("Download URL");
textJdkOwnUrl = new Text(compositeJDK, SWT.BORDER);
textJdkOwnUrl.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
cleanError();
}
});
textJdkOwnUrl.setEnabled(false);
textJdkOwnUrl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textJdkOwnUrl.setMessage("<enter url>");
dec_textJdkOwnUrl = decorateContorolAndRegister(textJdkOwnUrl);
new Label(compositeJDK, SWT.NONE);
lblJdkOwnSrorageAccountKey = new Label(compositeJDK, SWT.NONE);
GridData gd_lblJdkOwnSrorageAccountKey = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_lblJdkOwnSrorageAccountKey.horizontalIndent = 15;
lblJdkOwnSrorageAccountKey.setLayoutData(gd_lblJdkOwnSrorageAccountKey);
lblJdkOwnSrorageAccountKey.setText("Storage account key");
textJdkOwnStorageAccountKey = new Text(compositeJDK, SWT.BORDER);
textJdkOwnStorageAccountKey.setEnabled(false);
textJdkOwnStorageAccountKey.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
textJdkOwnStorageAccountKey.setMessage("<enter storage account key>");
decorateContorolAndRegister(textJdkOwnStorageAccountKey);
new Label(compositeJDK, SWT.NONE);
new Label(compositeJDK, SWT.NONE);
lblJdkOwnComment = new Label(compositeJDK, SWT.NONE);
lblJdkOwnComment.setEnabled(false);
lblJdkOwnComment.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
lblJdkOwnComment.setText("(If the URL above is a private blob)");
new Label(compositeJDK, SWT.NONE);
DateFormat df = new SimpleDateFormat("yyMMddHHmmss");
String date = df.format(new Date());
textAppName.setText("webapp-" + date);
textAppSevicePlanName.setText("asp-" + date);
textResourceGroupName.setText("rg-webapp-" + date);
fillWebContainers();
fillSubscriptions();
fillResourceGroups();
fillAppServicePlans();
fillAppServicePlansDetails();
fillAppServicePlanLocations();
fillAppServicePlanPricingTiers();
fill3PartyJdk();
return area;
}
Aggregations