List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm
public static boolean openConfirm(Shell parent, String title, String message)
From source file:com.clustercontrol.jobmanagement.composite.JobKickParamComposite.java
License:Open Source License
/** * ????// w w w . j av a2s . com */ private void initialize() { m_shell = this.getShell(); this.setLayout(JobDialogUtil.getParentLayout()); // Composite Composite composite = new Composite(this, SWT.NONE); composite.setLayout(new GridLayout(4, false)); composite.setLayoutData(new RowData()); ((RowData) composite.getLayoutData()).width = 525; // Table table = new Table(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); WidgetTestUtil.setTestId(this, "table", table); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(new GridData(465, 150)); ((GridData) table.getLayoutData()).horizontalSpan = 4; // dummy new Label(composite, SWT.NONE).setLayoutData(new GridData(325, SizeConstant.SIZE_LABEL_HEIGHT)); // this.m_btnAdd = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnAdd", this.m_btnAdd); this.m_btnAdd.setText(Messages.getString("add")); this.m_btnAdd.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnAdd.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { RuntimeParameterDialog dialog = new RuntimeParameterDialog(m_shell, m_jobRuntimeParamMap); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParamMap.put(dialog.getInputData().getParamId(), dialog.getInputData()); reflectParamInfo(); } } }); // this.m_btnModify = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnModify", this.m_btnModify); this.m_btnModify.setText(Messages.getString("modify")); this.m_btnModify.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_viewer.getTable().getSelectionIndex(); if (order >= 0) { String paramId = (String) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()) .get(0); RuntimeParameterDialog dialog = new RuntimeParameterDialog(m_shell, m_jobRuntimeParamMap, m_jobRuntimeParamMap.get(paramId)); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParamMap.remove(paramId); m_jobRuntimeParamMap.put(dialog.getInputData().getParamId(), dialog.getInputData()); reflectParamInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // this.m_btnDelete = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnDelete", this.m_btnDelete); this.m_btnDelete.setText(Messages.getString("delete")); this.m_btnDelete.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_viewer.getTable().getSelectionIndex(); if (order >= 0) { String paramId = (String) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()) .get(0); if (paramId == null) { paramId = ""; } String[] args = { paramId }; if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.130", args))) { m_jobRuntimeParamMap.remove(paramId); reflectParamInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); this.m_viewer = new CommonTableViewer(table); this.m_viewer.createTableColumn(GetJobKickParameterTableDefine.get(), GetJobKickParameterTableDefine.SORT_COLUMN_INDEX, GetJobKickParameterTableDefine.SORT_ORDER); this.m_viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { int order = m_viewer.getTable().getSelectionIndex(); if (order >= 0) { String paramId = (String) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()) .get(0); RuntimeParameterDialog dialog = new RuntimeParameterDialog(m_shell, m_jobRuntimeParamMap, m_jobRuntimeParamMap.get(paramId)); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParamMap.remove(paramId); m_jobRuntimeParamMap.put(dialog.getInputData().getParamId(), dialog.getInputData()); reflectParamInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); }
From source file:com.clustercontrol.jobmanagement.dialog.RuntimeParameterDialog.java
License:Open Source License
/** * ????//from ww w . j av a2s . c o m * * @param parent ? */ @Override protected void customizeDialog(Composite parent) { m_shell = this.getShell(); parent.getShell().setText(Messages.getString("dialog.job.add.modify.manual.param")); Label label = null; /** * * ????? */ RowLayout layout = new RowLayout(); layout.type = SWT.VERTICAL; layout.spacing = 0; layout.marginWidth = 10; layout.marginHeight = 10; layout.marginBottom = 0; layout.fill = true; parent.setLayout(layout); // Composite Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(3, false)); // ??? label = new Label(composite, SWT.LEFT); label.setText(Messages.getString("name") + " : "); label.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // ??? this.m_txtParamId = new Text(composite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_txtParamId", this.m_txtParamId); this.m_txtParamId.setLayoutData(new GridData(220, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_txtParamId.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_64)); this.m_txtParamId.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // dummy new Label(composite, SWT.NONE); // label = new Label(composite, SWT.LEFT); label.setText(Messages.getString("description") + " : "); label.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // this.m_txtDescription = new Text(composite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_txtDescription", this.m_txtDescription); this.m_txtDescription.setLayoutData(new GridData(220, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_txtDescription.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_256)); this.m_txtDescription.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // dummy new Label(composite, SWT.NONE); // label = new Label(composite, SWT.LEFT); label.setText(Messages.getString("type") + " : "); label.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // this.m_cmbType = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "m_cmbType", this.m_cmbType); this.m_cmbType.setLayoutData(new GridData(200, SizeConstant.SIZE_COMBO_HEIGHT)); this.m_cmbType.add(Messages.getString("job.manual.type.input")); this.m_cmbType.add(Messages.getString("job.manual.type.radio")); this.m_cmbType.add(Messages.getString("job.manual.type.combo")); this.m_cmbType.add(Messages.getString("job.manual.type.fixed")); this.m_cmbType.select(0); this.m_cmbType.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Combo combo = (Combo) e.getSource(); WidgetTestUtil.setTestId(this, null, combo); Integer type = JobRuntimeParamTypeMessage.stringToType(combo.getText()); if (type == JobRuntimeParamTypeConstant.TYPE_INPUT) { m_txtDefaultValue.setEditable(true); } else if (type == JobRuntimeParamTypeConstant.TYPE_RADIO) { m_txtDefaultValue.setEditable(false); } else if (type == JobRuntimeParamTypeConstant.TYPE_COMBO) { m_txtDefaultValue.setEditable(false); } else if (type == JobRuntimeParamTypeConstant.TYPE_FIXED) { m_txtDefaultValue.setEditable(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // dummy new Label(composite, SWT.NONE); // label = new Label(composite, SWT.LEFT); label.setText(Messages.getString("default.value") + " : "); label.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // this.m_txtDefaultValue = new Text(composite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_txtDefaultValue", this.m_txtDefaultValue); this.m_txtDefaultValue.setLayoutData(new GridData(220, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_txtDefaultValue.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_1024)); this.m_txtDefaultValue.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // dummy new Label(composite, SWT.NONE); // ? label = new Label(composite, SWT.LEFT); label.setText(Messages.getString("job.manual.select.item") + " : "); label.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); ((GridData) label.getLayoutData()).verticalSpan = 6; ((GridData) label.getLayoutData()).verticalAlignment = SWT.BEGINNING; // ? Table table = new Table(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); WidgetTestUtil.setTestId(this, "table", table); table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(new GridData(210, 135)); ((GridData) table.getLayoutData()).verticalSpan = 6; // ? this.m_btnSelectAdd = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnSelectAdd", this.m_btnSelectAdd); this.m_btnSelectAdd.setText(Messages.getString("add")); this.m_btnSelectAdd.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnSelectAdd.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { RuntimeParameterSelectionDialog dialog = new RuntimeParameterSelectionDialog(m_shell, m_jobRuntimeParam.getJobRuntimeParamDetailList(), new JobRuntimeParamDetail()); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParam.getJobRuntimeParamDetailList().add(dialog.getInputData()); if (dialog.getDefaultValueSelection()) { m_jobRuntimeParam.setValue(dialog.getInputData().getParamValue()); } reflectParamDetailInfo(); } } }); // ? this.m_btnSelectModify = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnSelectModify", this.m_btnSelectModify); this.m_btnSelectModify.setText(Messages.getString("modify")); this.m_btnSelectModify.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnSelectModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (m_viewer.getTable().getSelectionIndex() >= 0) { int orderNo = (Integer) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()).get(1) - 1; RuntimeParameterSelectionDialog dialog = new RuntimeParameterSelectionDialog(m_shell, m_jobRuntimeParam.getJobRuntimeParamDetailList(), m_jobRuntimeParam.getJobRuntimeParamDetailList().get(orderNo), (m_jobRuntimeParam.getValue() == null ? false : m_jobRuntimeParam.getValue().equals(m_jobRuntimeParam .getJobRuntimeParamDetailList().get(orderNo).getParamValue()))); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParam.getJobRuntimeParamDetailList().remove(orderNo); m_jobRuntimeParam.getJobRuntimeParamDetailList().add(orderNo, dialog.getInputData()); if (dialog.getDefaultValueSelection()) { m_jobRuntimeParam.setValue(dialog.getInputData().getParamValue()); } else { if (m_jobRuntimeParam.getValue() != null && m_jobRuntimeParam.getValue().equals(dialog.getInputData().getParamValue())) { m_jobRuntimeParam.setValue(null); } } reflectParamDetailInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // ? this.m_btnSelectDelete = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnSelectDelete", this.m_btnSelectDelete); this.m_btnSelectDelete.setText(Messages.getString("delete")); this.m_btnSelectDelete.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnSelectDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (m_viewer.getTable().getSelectionIndex() >= 0) { int orderNo = (Integer) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()).get(1) - 1; String detail = m_jobRuntimeParam.getJobRuntimeParamDetailList().get(orderNo).getDescription(); if (detail == null) { detail = ""; } String[] args = { detail }; if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.130", args))) { if (m_jobRuntimeParam.getValue() != null && m_jobRuntimeParam.getValue().equals( m_jobRuntimeParam.getJobRuntimeParamDetailList().get(orderNo).getParamValue())) { m_jobRuntimeParam.setValue(null); } m_jobRuntimeParam.getJobRuntimeParamDetailList().remove(orderNo); reflectParamDetailInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // ? this.m_btnSelectCopy = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnSelectCopy", this.m_btnSelectCopy); this.m_btnSelectCopy.setText(Messages.getString("copy")); this.m_btnSelectCopy.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnSelectCopy.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (m_viewer.getTable().getSelectionIndex() >= 0) { int orderNo = (Integer) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()).get(1) - 1; // ? JobRuntimeParamDetail paramDetail = new JobRuntimeParamDetail(); paramDetail.setDescription( m_jobRuntimeParam.getJobRuntimeParamDetailList().get(orderNo).getDescription()); paramDetail.setParamValue( m_jobRuntimeParam.getJobRuntimeParamDetailList().get(orderNo).getParamValue()); RuntimeParameterSelectionDialog dialog = new RuntimeParameterSelectionDialog(m_shell, m_jobRuntimeParam.getJobRuntimeParamDetailList(), paramDetail); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParam.getJobRuntimeParamDetailList().add(dialog.getInputData()); if (dialog.getDefaultValueSelection()) { m_jobRuntimeParam.setValue(dialog.getInputData().getParamValue()); } reflectParamDetailInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // ?? this.m_btnSelectUp = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnSelectUp", this.m_btnSelectUp); this.m_btnSelectUp.setText(Messages.getString("up")); this.m_btnSelectUp.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnSelectUp.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (m_viewer.getTable().getSelectionIndex() >= 0) { int orderNo = (Integer) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()).get(1) - 1; if (orderNo > 0) { JobRuntimeParamDetail jobRuntimeParamDetail = m_jobRuntimeParam .getJobRuntimeParamDetailList().get(orderNo); m_jobRuntimeParam.getJobRuntimeParamDetailList().remove(orderNo); m_jobRuntimeParam.getJobRuntimeParamDetailList().add(orderNo - 1, jobRuntimeParamDetail); reflectParamDetailInfo(); m_viewer.getTable().setSelection(orderNo - 1); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // ?? this.m_btnSelectDown = new Button(composite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_btnSelectDown", this.m_btnSelectDown); this.m_btnSelectDown.setText(Messages.getString("down")); this.m_btnSelectDown.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_btnSelectDown.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (m_viewer.getTable().getSelectionIndex() >= 0) { int orderNo = (Integer) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()).get(1) - 1; if (orderNo < m_jobRuntimeParam.getJobRuntimeParamDetailList().size() - 1) { JobRuntimeParamDetail jobRuntimeParamDetail = m_jobRuntimeParam .getJobRuntimeParamDetailList().get(orderNo); m_jobRuntimeParam.getJobRuntimeParamDetailList().remove(orderNo); m_jobRuntimeParam.getJobRuntimeParamDetailList().add(orderNo + 1, jobRuntimeParamDetail); reflectParamDetailInfo(); m_viewer.getTable().setSelection(orderNo + 1); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // label = new Label(composite, SWT.LEFT); label.setText(Messages.getString("job.manual.required") + " : "); label.setLayoutData(new GridData(60, SizeConstant.SIZE_LABEL_HEIGHT)); // ? this.m_chkRequiredFlg = new Button(composite, SWT.CHECK); WidgetTestUtil.setTestId(this, "m_chkRequiredFlg", this.m_chkRequiredFlg); this.m_btnSelectDown.setLayoutData(new GridData(50, SizeConstant.SIZE_BUTTON_HEIGHT)); // dummy new Label(composite, SWT.NONE); this.m_viewer = new CommonTableViewer(table); this.m_viewer.createTableColumn(GetRuntimeParameterTableDefine.get(), GetRuntimeParameterTableDefine.SORT_COLUMN_INDEX, GetRuntimeParameterTableDefine.SORT_ORDER); this.m_viewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { if (m_viewer.getTable().getSelectionIndex() >= 0) { int orderNo = (Integer) ((ArrayList<?>) m_viewer.getTable().getSelection()[0].getData()).get(1) - 1; RuntimeParameterSelectionDialog dialog = new RuntimeParameterSelectionDialog(m_shell, m_jobRuntimeParam.getJobRuntimeParamDetailList(), m_jobRuntimeParam.getJobRuntimeParamDetailList().get(orderNo), (m_jobRuntimeParam.getValue() == null ? false : m_jobRuntimeParam.getValue().equals(m_jobRuntimeParam .getJobRuntimeParamDetailList().get(orderNo).getParamValue()))); if (dialog.open() == IDialogConstants.OK_ID) { m_jobRuntimeParam.getJobRuntimeParamDetailList().remove(orderNo); m_jobRuntimeParam.getJobRuntimeParamDetailList().add(orderNo, dialog.getInputData()); if (dialog.getDefaultValueSelection()) { m_jobRuntimeParam.setValue(dialog.getInputData().getParamValue()); } else { if (m_jobRuntimeParam.getValue().equals(dialog.getInputData().getParamValue())) { m_jobRuntimeParam.setValue(null); } } reflectParamDetailInfo(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.job.129")); } } }); // ?? reflectParamInfo(); // ? update(); }
From source file:com.clustercontrol.jobmanagement.view.action.DisableJobKickAction.java
License:Open Source License
/** * ?/*from w w w .j a va2 s . c om*/ */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.window = HandlerUtil.getActiveWorkbenchWindow(event); // In case this action has been disposed if (null == this.window || !isEnabled()) { return null; } // ??? this.viewPart = HandlerUtil.getActivePart(event); // ??? JobKickListView view = null; try { view = (JobKickListView) this.viewPart.getAdapter(JobKickListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } JobKickListComposite composite = view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); String[] args; Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); StringBuffer targetList = new StringBuffer();//?() StringBuffer successList = new StringBuffer();//?(?) StringBuffer failureList = new StringBuffer();//?() for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.MANAGER_NAME); String jobkickId = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.JOBKICK_ID); Integer type = JobKickTypeMessage .stringToType((String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.TYPE)); if (type == JobKickConstant.TYPE_MANUAL) { // ? continue; } if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } map.get(managerName).add(jobkickId); targetList.append(jobkickId + "\n"); } // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.24")); return null; } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.71", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName); for (String targetId : entry.getValue()) { try { wrapper.setJobKickStatus(targetId, false); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.job.72", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.job.73", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.jobmanagement.view.action.EnableJobKickAction.java
License:Open Source License
/** * ?/*from w w w . j av a2s . c om*/ */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.window = HandlerUtil.getActiveWorkbenchWindow(event); // In case this action has been disposed if (null == this.window || !isEnabled()) { return null; } // ??? this.viewPart = HandlerUtil.getActivePart(event); // ??? JobKickListView view = null; try { view = (JobKickListView) this.viewPart.getAdapter(JobKickListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } JobKickListComposite composite = view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); String[] args; Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); StringBuffer targetList = new StringBuffer();//?() StringBuffer successList = new StringBuffer();//?(?) StringBuffer failureList = new StringBuffer();//?() for (int i = 0; i < objs.length; i++) { String managerName = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.MANAGER_NAME); String jobkickId = (String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.JOBKICK_ID); Integer type = JobKickTypeMessage .stringToType((String) ((ArrayList<?>) objs[i]).get(GetJobKickTableDefine.TYPE)); if (type == JobKickConstant.TYPE_MANUAL) { // ? continue; } if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } map.get(managerName).add(jobkickId); targetList.append(jobkickId + "\n"); } // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.24")); return null; } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.68", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName); for (String targetId : entry.getValue()) { try { wrapper.setJobKickStatus(targetId, true); successList.append(targetId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(targetId + "\n"); m_log.warn("run() setJobKickStatus jobkickId=" + targetId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.job.69", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.job.70", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.jobmanagement.view.action.RunJobKickAction.java
License:Open Source License
/** * []???????????/*from w w w. j a v a2 s . c o m*/ * <p> * <ol> * <li>[]????????</li> * <li>?????</li> * <li>???</li> * </ol> * * @see org.eclipse.core.commands.IHandler#execute * @see com.clustercontrol.jobmanagement.view.JobListView * @see com.clustercontrol.jobmanagement.action.RunJob#runJob(String) */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.window = HandlerUtil.getActiveWorkbenchWindow(event); // In case this action has been disposed if (null == this.window || !isEnabled()) { return null; } // ??? this.viewPart = HandlerUtil.getActivePart(event); // ??? JobKickListView view = null; try { view = (JobKickListView) this.viewPart.getAdapter(JobKickListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } JobKickListComposite composite = view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.job.24")); return null; } // ??? StringBuffer jobListMessage = new StringBuffer(); jobListMessage.append(Messages.getString("message.job.125")); jobListMessage.append("\n"); // 1????????? String managerName = (String) ((ArrayList<?>) objs[0]).get(GetJobKickTableDefine.MANAGER_NAME); String jobkickId = (String) ((ArrayList<?>) objs[0]).get(GetJobKickTableDefine.JOBKICK_ID); String jobunitId = (String) ((ArrayList<?>) objs[0]).get(GetJobKickTableDefine.JOBUNIT_ID); String jobId = (String) ((ArrayList<?>) objs[0]).get(GetJobKickTableDefine.JOB_ID); String jobName = (String) ((ArrayList<?>) objs[0]).get(GetJobKickTableDefine.JOB_NAME); // ??() Object[] args1 = { jobName, managerName, jobId, jobunitId }; jobListMessage.append(Messages.getString(Messages.getString("message.job.32"), args1)); jobListMessage.append("\n"); // ?? JobKickRunConfirm dialog = new JobKickRunConfirm(null, managerName, jobkickId); dialog.setMessageText(jobListMessage.toString()); if (dialog.open() == IDialogConstants.OK_ID) { m_trigger = dialog.getInputData(); try { // JobTriggerInfo triggerInfo = new JobTriggerInfo(); triggerInfo.setTriggerType(JobTriggerTypeConstant.TYPE_MANUAL); triggerInfo.setJobWaitTime(m_trigger.isJobWaitTime()); triggerInfo.setJobWaitMinute(m_trigger.isJobWaitMinute()); triggerInfo.setJobCommand(m_trigger.isJobCommand()); triggerInfo.setJobCommandText(m_trigger.getJobCommandText()); // if (m_trigger.getJobRuntimeParamList() != null) { triggerInfo.getJobRuntimeParamList().addAll(m_trigger.getJobRuntimeParamList()); } JobEndpointWrapper wrapper = JobEndpointWrapper.getWrapper(managerName); wrapper.runJob(jobunitId, jobId, null, triggerInfo); } catch (InvalidRole_Exception e) { MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("run(), " + e.getMessage(), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); } } return null; }
From source file:com.clustercontrol.maintenance.view.action.HinemosPropertyDeleteAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???/*from w ww .j a v a 2 s .co m*/ this.viewPart = HandlerUtil.getActivePart(event); HinemosPropertyView view = null; try { view = (HinemosPropertyView) this.viewPart.getAdapter(HinemosPropertyView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } HinemosPropertyComposite composite = (HinemosPropertyComposite) view.getComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); List<?> list = (List<?>) selection.toList(); Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); for (Object obj : list) { List<?> objList = (List<?>) obj; String managerName = (String) objList.get(GetHinemosPropertyTableDefine.MANAGER_NAME); if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } } int size = 0; StringBuilder key = new StringBuilder(); for (Object obj : list) { List<?> objList = (List<?>) obj; String managerName = (String) objList.get(GetHinemosPropertyTableDefine.MANAGER_NAME); String k = (String) objList.get(GetHinemosPropertyTableDefine.KEY); map.get(managerName).add(k); if (size > 0) { key.append(", "); } key.append(k + "(" + managerName + ")"); size++; } // ????????? if (map.isEmpty()) { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.maintenance.9")); return null; } String[] args = { key.toString() }; if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.maintenance.7", args)) == false) { return null; } // ????????? Map<String, String> errorMsgs = new ConcurrentHashMap<>(); for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); HinemosPropertyEndpointWrapper wrapper = HinemosPropertyEndpointWrapper.getWrapper(managerName); for (String val : entry.getValue()) { try { wrapper.deleteHinemosProperty(val); } catch (InvalidRole_Exception e) { errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("run(), " + e.getMessage(), e); errorMsgs.put(managerName, Messages.getString("message.hinemos.failure.unexpected") + HinemosMessage.replace(e.getMessage())); } } } // if (0 < errorMsgs.size()) { UIManager.showMessageBox(errorMsgs, true); } else { MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.hinemos.property.6", args)); } composite.update(); return null; }
From source file:com.clustercontrol.maintenance.view.action.MaintenanceDeleteAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???/*from w ww. j a v a 2s .c o m*/ this.viewPart = HandlerUtil.getActivePart(event); MaintenanceListView view = null; try { view = (MaintenanceListView) this.viewPart.getAdapter(MaintenanceListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } MaintenanceListComposite composite = (MaintenanceListComposite) view.getListComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); List<?> list = (List<?>) selection.toList(); Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); for (Object obj : list) { List<?> objList = (List<?>) obj; String managerName = (String) objList.get(GetMaintenanceListTableDefine.MANAGER_NAME); if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } } StringBuffer maintenanceId = new StringBuffer(); for (Object obj : list) { List<?> objList = (List<?>) obj; String managerName = (String) objList.get(GetMaintenanceListTableDefine.MANAGER_NAME); String id = (String) objList.get(GetMaintenanceListTableDefine.MAINTENANCE_ID); map.get(managerName).add(id); if (maintenanceId.length() > 0) { maintenanceId.append(", "); } maintenanceId.append(id + "(" + managerName + ")"); } // ????????? if (map.isEmpty()) { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.maintenance.9")); return null; } String[] args = { maintenanceId.toString() }; if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.maintenance.7", args)) == false) { return null; } Map<String, String> errorMsgs = new ConcurrentHashMap<>(); for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); MaintenanceEndpointWrapper wrapper = MaintenanceEndpointWrapper.getWrapper(managerName); for (String val : entry.getValue()) { try { wrapper.deleteMaintenance(val); } catch (InvalidRole_Exception e) { errorMsgs.put(managerName, Messages.getString("message.accesscontrol.16")); } catch (Exception e) { m_log.warn("run(), " + e.getMessage(), e); errorMsgs.put(managerName, Messages.getString("message.hinemos.failure.unexpected") + HinemosMessage.replace(e.getMessage())); } } } // if (0 < errorMsgs.size()) { UIManager.showMessageBox(errorMsgs, true); } else { MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.maintenance.5", args)); } composite.update(); return null; }
From source file:com.clustercontrol.maintenance.view.action.MaintenanceDisableAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???/*from w ww .j a v a 2 s. co m*/ this.viewPart = HandlerUtil.getActivePart(event); MaintenanceListView view = null; try { view = (MaintenanceListView) this.viewPart.getAdapter(MaintenanceListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } MaintenanceListComposite composite = (MaintenanceListComposite) view.getListComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.maintenance.9")); return null; } // 1?????? String[] args; StringBuffer targetList = new StringBuffer(); StringBuffer successList = new StringBuffer(); StringBuffer failureList = new StringBuffer(); Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); for (Object o : objs) { if (targetList.length() != 0) { targetList.append(", "); } String managerName = (String) ((ArrayList<?>) o).get(GetMaintenanceListTableDefine.MANAGER_NAME); if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } } for (Object o : objs) { if (targetList.length() != 0) { targetList.append(", "); } String managerName = (String) ((ArrayList<?>) o).get(GetMaintenanceListTableDefine.MANAGER_NAME); String maintenanceId = (String) ((ArrayList<?>) o).get(GetMaintenanceListTableDefine.MAINTENANCE_ID); targetList.append(maintenanceId); map.get(managerName).add(maintenanceId); } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.maintenance.15", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); MaintenanceEndpointWrapper wrapper = MaintenanceEndpointWrapper.getWrapper(managerName); for (String maintenanceId : entry.getValue()) { try { wrapper.setMaintenanceStatus(maintenanceId, false); successList.append(maintenanceId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(maintenanceId + "\n"); m_log.warn("run() setNotifyStatus targetId=" + maintenanceId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(maintenanceId + "\n"); m_log.warn("run() setMaintenanceStatus maintenanceId=" + maintenanceId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.maintenance.20", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.maintenance.21", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.maintenance.view.action.MaintenanceEnableAction.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // ???//from w w w .j av a 2 s .c om this.viewPart = HandlerUtil.getActivePart(event); MaintenanceListView view = null; try { view = (MaintenanceListView) this.viewPart.getAdapter(MaintenanceListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } MaintenanceListComposite composite = (MaintenanceListComposite) view.getListComposite(); StructuredSelection selection = (StructuredSelection) composite.getTableViewer().getSelection(); Object[] objs = selection.toArray(); // 1???????? if (objs.length == 0) { MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.maintenance.9")); return null; } // 1?????? String[] args; StringBuffer targetList = new StringBuffer(); StringBuffer successList = new StringBuffer(); StringBuffer failureList = new StringBuffer(); Map<String, List<String>> map = new ConcurrentHashMap<String, List<String>>(); for (Object o : objs) { if (targetList.length() != 0) { targetList.append(", "); } String managerName = (String) ((ArrayList<?>) o).get(GetMaintenanceListTableDefine.MANAGER_NAME); if (map.get(managerName) == null) { map.put(managerName, new ArrayList<String>()); } } for (Object o : objs) { if (targetList.length() != 0) { targetList.append(", "); } String managerName = (String) ((ArrayList<?>) o).get(GetMaintenanceListTableDefine.MANAGER_NAME); String maintenanceId = (String) ((ArrayList<?>) o).get(GetMaintenanceListTableDefine.MAINTENANCE_ID); targetList.append(maintenanceId); map.get(managerName).add(maintenanceId); } // ?(NG) args = new String[] { targetList.toString() }; if (!MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.maintenance.14", args))) { return null; } boolean hasRole = true; // for (Map.Entry<String, List<String>> entry : map.entrySet()) { String managerName = entry.getKey(); MaintenanceEndpointWrapper wrapper = MaintenanceEndpointWrapper.getWrapper(managerName); for (String maintenanceId : entry.getValue()) { try { wrapper.setMaintenanceStatus(maintenanceId, true); successList.append(maintenanceId + "(" + managerName + ")" + "\n"); } catch (InvalidRole_Exception e) { failureList.append(maintenanceId + "\n"); m_log.warn("run() setMaintenanceStatus maintenanceId=" + maintenanceId + ", " + e.getMessage(), e); hasRole = false; } catch (Exception e) { failureList.append(maintenanceId + "\n"); m_log.warn("run() setMaintenanceStatus maintenanceId=" + maintenanceId + ", " + e.getMessage(), e); } } } if (!hasRole) { // ???????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); } // ? if (successList.length() != 0) { args = new String[] { successList.toString() }; MessageDialog.openInformation(null, Messages.getString("successful"), Messages.getString("message.maintenance.18", args)); } // if (failureList.length() != 0) { args = new String[] { failureList.toString() }; MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.maintenance.19", args)); } // ? composite.update(); return null; }
From source file:com.clustercontrol.monitor.run.composite.StringValueInfoComposite.java
License:Open Source License
/** * ?????/*from ww w . j av a 2s . co m*/ */ private void initialize(ArrayList<TableColumnInfo> tableDefine) { // ???? GridData gridData = null; GridLayout layout = new GridLayout(1, true); layout.marginHeight = 0; layout.marginWidth = 0; layout.numColumns = CommonMonitorDialog.BASIC_UNIT; this.setLayout(layout); /* * */ this.m_infoList = new StringValueListComposite(this, SWT.BORDER, tableDefine); WidgetTestUtil.setTestId(this, "stringvaluelist", m_infoList); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = CommonMonitorDialog.LONG_UNIT; this.m_infoList.setLayoutData(gridData); /* * ? */ Composite composite = new Composite(this, SWT.NONE); WidgetTestUtil.setTestId(this, "button", composite); layout = new GridLayout(1, true); layout.numColumns = 1; composite.setLayout(layout); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = CommonMonitorDialog.SHORT_UNIT; composite.setLayoutData(gridData); // this.m_buttonAdd = this.createButton(composite, Messages.getString("add")); WidgetTestUtil.setTestId(this, "add", m_buttonAdd); this.m_buttonAdd.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); StringValueInfoCreateDialog dialog = new StringValueInfoCreateDialog(shell, logLineFlag); if (dialog.open() == IDialogConstants.OK_ID) { m_infoList.getMonitorStringValueInfoList().add(dialog.getInputData()); m_infoList.update(); } } }); // this.m_buttonModify = this.createButton(composite, Messages.getString("modify")); WidgetTestUtil.setTestId(this, "modify", m_buttonModify); this.m_buttonModify.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_infoList.getTableViewer().getTable().getSelectionIndex(); if (order >= 0) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); StringValueInfoCreateDialog dialog = new StringValueInfoCreateDialog(shell, m_infoList.getMonitorStringValueInfoList().get(order)); if (dialog.open() == IDialogConstants.OK_ID) { m_infoList.getMonitorStringValueInfoList().remove(order); m_infoList.getMonitorStringValueInfoList().add(order, dialog.getInputData()); m_infoList.setSelection(); m_infoList.update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); // this.m_buttonDelete = this.createButton(composite, Messages.getString("delete")); WidgetTestUtil.setTestId(this, "delete", m_buttonDelete); this.m_buttonDelete.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_infoList.getTableViewer().getTable().getSelectionIndex(); if (order >= 0) { String detail = m_infoList.getFilterItem().getDescription(); if (detail == null) { detail = ""; } String[] args = { detail }; if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.monitor.31", args))) { m_infoList.getMonitorStringValueInfoList().remove(order); m_infoList.update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); // this.m_buttonCopy = this.createButton(composite, Messages.getString("copy")); WidgetTestUtil.setTestId(this, "copy", m_buttonCopy); this.m_buttonCopy.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_infoList.getTableViewer().getTable().getSelectionIndex(); if (order >= 0) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); StringValueInfoCreateDialog dialog = new StringValueInfoCreateDialog(shell, m_infoList.getMonitorStringValueInfoList().get(order)); if (dialog.open() == IDialogConstants.OK_ID) { Table table = m_infoList.getTableViewer().getTable(); WidgetTestUtil.setTestId(this, "modify", table); int selectIndex = table.getSelectionIndex(); m_infoList.getMonitorStringValueInfoList().add(dialog.getInputData()); m_infoList.update(); table.setSelection(selectIndex); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); // ? Label label = new Label(composite, SWT.NONE); // WidgetTestUtil.setTestId(this, "up", label); this.m_buttonUp = this.createButton(composite, Messages.getString("up")); WidgetTestUtil.setTestId(this, "up", m_buttonUp); this.m_buttonUp.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_infoList.getTableViewer().getTable().getSelectionIndex(); if (order >= 0) { m_infoList.up(); m_infoList.update(); } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); // ? this.m_buttonDown = this.createButton(composite, Messages.getString("down")); WidgetTestUtil.setTestId(this, "down", m_buttonDown); this.m_buttonDown.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { int order = m_infoList.getTableViewer().getTable().getSelectionIndex(); if (order >= 0) { m_infoList.down(); m_infoList.update(); } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); }