List of usage examples for org.eclipse.jface.dialogs IDialogConstants OK_ID
int OK_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants OK_ID.
Click Source Link
From source file:com.clustercontrol.infra.composite.action.InfraManagementDoubleClickListener.java
License:Open Source License
/** * ?????<BR>/* w ww . ja va 2 s.c om*/ * [?]? * [] * ????????????? * <P> * <ol> * <li>???????ID????</li> * <li>ID????????</li> * </ol> * * @param event * * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ @Override public void doubleClick(DoubleClickEvent event) { if (((StructuredSelection) event.getSelection()).getFirstElement() != null) { String managerName = (String) ((ArrayList<?>) ((StructuredSelection) event.getSelection()) .getFirstElement()).get(GetInfraManagementTableDefine.MANAGER_NAME); String managementId = (String) ((ArrayList<?>) ((StructuredSelection) event.getSelection()) .getFirstElement()).get(GetInfraManagementTableDefine.MANAGEMENT_ID); if (managementId != null) { // [???]?? InfraManagementDialog dialog = new InfraManagementDialog(m_composite.getShell(), managerName, managementId, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { m_composite.update(); } } } }
From source file:com.clustercontrol.infra.composite.FileReplaceSettingComposite.java
License:Open Source License
/** * ????/*ww w . ja va 2 s. c om*/ */ private void initialize() { // ???? GridData gridData = null; GridLayout layout = new GridLayout(1, true); layout.marginHeight = 0; layout.marginWidth = 0; layout.numColumns = 12; this.setLayout(layout); Table table = new Table(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.SINGLE); gridData = new GridData(); gridData.horizontalSpan = 12; gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; gridData.heightHint = 100; table.setHeaderVisible(true); table.setLinesVisible(true); table.setLayoutData(gridData); // Label label = new Label(this, SWT.NONE); gridData = new GridData(); gridData.horizontalSpan = 6; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); m_createCondition = new Button(this, SWT.NONE); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; m_createCondition.setText(Messages.getString("add")); m_createCondition.setLayoutData(gridData); m_createCondition.addSelectionListener(new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { ReplaceTextDialog dialog = new ReplaceTextDialog(m_shell); if (dialog.open() == IDialogConstants.OK_ID) { List<?> info = dialog.getInputData(); List<Object> list = (ArrayList<Object>) m_viewer.getInput(); if (list == null) { list = new ArrayList<Object>(); } list.add(info); m_viewer.setInput(list); } } }); //? m_modifyCondition = new Button(this, SWT.NONE); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; WidgetTestUtil.setTestId(this, "modifycondition", m_modifyCondition); m_modifyCondition.setText(Messages.getString("modify")); m_modifyCondition.setLayoutData(gridData); m_modifyCondition.addSelectionListener(new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { StructuredSelection selection = (StructuredSelection) m_viewer.getSelection(); if (selection != null && selection.size() > 0) { m_selectItem = (List<Object>) selection.getFirstElement(); } else { m_selectItem = null; } if (m_selectItem != null) { ReplaceTextDialog dialog = new ReplaceTextDialog(m_shell, m_selectItem); if (dialog.open() == IDialogConstants.OK_ID) { List<?> info = dialog.getInputData(); List<Object> list = (ArrayList<Object>) m_viewer.getInput(); list.remove(m_selectItem); list.add(info); m_selectItem = null; m_viewer.setInput(list); } } else { } } }); //? m_deleteCondition = new Button(this, SWT.NONE); gridData = new GridData(); gridData.horizontalSpan = 2; gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; m_deleteCondition.setText(Messages.getString("delete")); m_deleteCondition.setLayoutData(gridData); m_deleteCondition.addSelectionListener(new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { StructuredSelection selection = (StructuredSelection) m_viewer.getSelection(); if (selection != null && selection.size() > 0) { m_selectItem = (List<Object>) selection.getFirstElement(); } else { m_selectItem = null; } if (m_selectItem != null) { List<Object> list = (ArrayList<Object>) m_viewer.getInput(); boolean b = list.remove(m_selectItem); m_log.debug("remove " + b); m_selectItem = null; m_viewer.setInput(list); } else { m_log.debug("m_selectItem is null."); } } }); m_viewer = new CommonTableViewer(table); m_viewer.createTableColumn(GetInfraFileReplaceSettingTableDefine.get(), GetInfraFileReplaceSettingTableDefine.SORT_COLUMN_INDEX, GetInfraFileReplaceSettingTableDefine.SORT_ORDER); }
From source file:com.clustercontrol.infra.composite.InfraScopeComposite.java
License:Open Source License
/** * ?????/*w w w . j a va 2 s.co m*/ */ private void initialize() { GridLayout layout = new GridLayout(3, false); layout.marginHeight = 0; layout.marginWidth = 0; this.setLayout(layout); // ???? GridData gridData = null; m_scopeParam = new Button(this, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_scopeParam", this.m_scopeParam); this.m_scopeParam.setText(Messages.getString("infra.parameter") + " : "); this.m_scopeParam.setLayoutData(new GridData(100, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_scopeParam.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_scopeFixedValue.setSelection(false); btnRefer.setEnabled(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // Label scopeJobParamLabel = new Label(this, SWT.LEFT); scopeJobParamLabel.setText("#[FACILITY_ID]"); scopeJobParamLabel.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); //dummy new Label(this, SWT.LEFT); m_scopeFixedValue = new Button(this, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_scopeFixedValue", this.m_scopeFixedValue); this.m_scopeFixedValue.setText(Messages.getString("fixed.value") + " : "); this.m_scopeFixedValue.setLayoutData(new GridData(100, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_scopeFixedValue.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_scopeFixedValue.setSelection(true); btnRefer.setEnabled(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); this.m_scope = new Text(this, SWT.BORDER | SWT.LEFT | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "scope", m_scope); gridData = new GridData(GridData.FILL_HORIZONTAL); gridData.horizontalAlignment = GridData.FILL; this.m_scope.setLayoutData(gridData); this.m_scope.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { update(); } }); // ? btnRefer = new Button(this, SWT.NONE); WidgetTestUtil.setTestId(this, "refer", btnRefer); btnRefer.setText(Messages.getString("refer")); btnRefer.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScopeTreeDialog dialog = new ScopeTreeDialog(null, m_managerName, m_ownerRoleId, false, m_unregistered); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem item = dialog.getSelectItem(); FacilityInfo info = item.getData(); if (!info.getFacilityId().equals(InfraScopeComposite.this.m_facilityId)) { InfraScopeComposite.this.m_facilityId = info.getFacilityId(); if (info.getFacilityType() == FacilityConstant.TYPE_NODE) { m_scope.setText(info.getFacilityName()); } else { FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); m_scope.setText(path.getPath(item)); } } } } }); update(); }
From source file:com.clustercontrol.infra.view.action.CopyInfraManagementAction.java
License:Open Source License
@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; }/* w w w.j ava 2 s . c o m*/ this.viewPart = HandlerUtil.getActivePart(event); InfraManagementView view = null; if (viewPart instanceof InfraManagementView) { view = (InfraManagementView) viewPart; } if (view == null) { m_log.info("execute: view is null"); return null; } // view??????? StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } String managerName = null; String managementId = null; if (selection != null) { managerName = (String) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraManagementTableDefine.MANAGER_NAME); managementId = (String) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraManagementTableDefine.MANAGEMENT_ID); } if (managementId != null) { // [???]?? InfraManagementDialog dialog = new InfraManagementDialog(this.viewPart.getSite().getShell(), managerName, managementId, PropertyDefineConstant.MODE_COPY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { view.update(); } } return null; }
From source file:com.clustercontrol.infra.view.action.ModifyInfraManagementAction.java
License:Open Source License
@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; }/*from w w w.j a v a 2 s . c o m*/ this.viewPart = HandlerUtil.getActivePart(event); if (!(viewPart instanceof InfraManagementView)) { return null; } InfraManagementView infraManagementView = null; try { infraManagementView = (InfraManagementView) viewPart; } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } StructuredSelection selection = null; if (infraManagementView.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) infraManagementView.getComposite().getTableViewer().getSelection(); } String managerName = null; String managementId = null; if (selection != null) { managerName = (String) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraManagementTableDefine.MANAGER_NAME); managementId = (String) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraManagementTableDefine.MANAGEMENT_ID); } if (managementId != null) { // [???]?? InfraManagementDialog dialog = new InfraManagementDialog(this.viewPart.getSite().getShell(), managerName, managementId, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { infraManagementView.update(); } } return null; }
From source file:com.clustercontrol.jobmanagement.composite.action.JobDoubleClickListener.java
License:Open Source License
/** * ?????<BR>/*from w ww . j a va 2 s . c o m*/ * []????????????? * <P> * <ol> * <li>???????ID????</li> * <li>[]???????</li> * <li>?????ID??????</li> * <li>[]????ID?????</li> * <li>ID????????</li> * </ol> * * @param event * * @see com.clustercontrol.jobmanagement.dialog.JobDialog * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) */ @Override public void doubleClick(DoubleClickEvent event) { JobTreeItem selectJobTreeItem = null; //[]?? IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart viewPart = page.findView(JobListView.ID); //?? StructuredSelection selection = (StructuredSelection) event.getSelection(); if (viewPart != null && selection != null) { ArrayList<?> item = (ArrayList<?>) selection.getFirstElement(); JobListView view = (JobListView) viewPart.getAdapter(JobListView.class); if (view == null) { m_log.info("selection changed: job list view is null"); return; } if (item != null) { String jobId = (String) item.get(GetJobTableDefine.JOB_ID); if (m_composite.getJobTreeItem() != null) { List<JobTreeItem> items = m_composite.getJobTreeItem().getChildren(); for (int i = 0; i < items.size(); i++) { if (jobId.equals(items.get(i).getData().getId())) { selectJobTreeItem = items.get(i); break; } } } } if (selectJobTreeItem != null) { //? List<JobTreeItem> list = new ArrayList<JobTreeItem>(); list.add(selectJobTreeItem); m_composite.setSelectJobTreeItemList(list); String managerName = null; JobTreeItem mgrTree = JobTreeItemUtil.getManager(selectJobTreeItem); if (mgrTree == null) { managerName = selectJobTreeItem.getChildren().get(0).getData().getId(); } else { managerName = mgrTree.getData().getId(); } JobEditState jobEditState = JobEditStateUtil.getJobEditState(managerName); boolean readOnly = !jobEditState.isLockedJobunitId(selectJobTreeItem.getData().getJobunitId()); // ? JobDialog dialog = new JobDialog(view.getJobTreeComposite(), m_composite.getShell(), managerName, readOnly); // ??????????? dialog.setJobTreeItem(selectJobTreeItem); m_log.info("jobDialog " + selectJobTreeItem.getData().getId()); // if (dialog.open() == IDialogConstants.OK_ID) { m_composite.update(selectJobTreeItem.getParent()); if (jobEditState.isLockedJobunitId(selectJobTreeItem.getData().getJobunitId())) { // ?????(??????? jobEditState.addEditedJobunit(selectJobTreeItem); if (selectJobTreeItem.getData().getType() == JobConstant.TYPE_JOBUNIT) { JobUtil.setJobunitIdAll(selectJobTreeItem, selectJobTreeItem.getData().getJobunitId()); } } // Refresh after modified // @see ModifyJobAction#run() JobTreeItem parent = selectJobTreeItem.getParent(); JobTreeComposite tree = view.getJobTreeComposite(); tree.getTreeViewer().sort(parent); tree.refresh(item); // Also fresh parent in case of selecting from list tree.refresh(parent); } } } }
From source file:com.clustercontrol.jobmanagement.composite.action.JobIdSelectionListener.java
License:Open Source License
@Override public void widgetSelected(SelectionEvent e) { String managerName = managerListComposite.getText(); if (null != managerName) { // //from w w w .j a v a 2 s . c o m JobTreeDialog dialog = new JobTreeDialog(shell, managerName, this.m_ownerRoleId.getText(), false); if (dialog.open() == IDialogConstants.OK_ID) { JobTreeItem selectItem = dialog.getSelectItem().get(0); if (selectItem.getData().getType() != JobConstant.TYPE_COMPOSITE) { m_textJobId.setText(selectItem.getData().getId()); m_textJobunitId.setText(selectItem.getData().getJobunitId()); } else { m_textJobId.setText(""); m_textJobunitId.setText(""); } } } else { MessageDialog.openInformation(shell, Messages.getString("message"), Messages.getString("multimanager.managername.required.message")); } }
From source file:com.clustercontrol.jobmanagement.composite.CommandComposite.java
License:Open Source License
/** * ?????//from w w w .ja va 2 s .c om */ private void initialize() { this.setLayout(JobDialogUtil.getParentLayout()); // Group cmdScopeGroup = new Group(this, SWT.NONE); cmdScopeGroup.setText(Messages.getString("scope")); cmdScopeGroup.setLayout(new GridLayout(3, false)); // this.m_scopeJobParam = new Button(cmdScopeGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_scopeJobParam", this.m_scopeJobParam); this.m_scopeJobParam.setText(Messages.getString("job.parameter") + " : "); this.m_scopeJobParam.setLayoutData(new GridData(120, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_scopeJobParam.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_scopeFixedValue.setSelection(false); m_scopeSelect.setEnabled(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // Label scopeJobParamLabel = new Label(cmdScopeGroup, SWT.LEFT); scopeJobParamLabel.setText(SystemParameterConstant.getParamText(SystemParameterConstant.FACILITY_ID)); scopeJobParamLabel.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); //dummy new Label(cmdScopeGroup, SWT.LEFT); // this.m_scopeFixedValue = new Button(cmdScopeGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_scopeFixedValue", this.m_scopeFixedValue); this.m_scopeFixedValue.setText(Messages.getString("fixed.value") + " : "); this.m_scopeFixedValue.setLayoutData(new GridData(120, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_scopeFixedValue.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_scopeJobParam.setSelection(false); m_scopeSelect.setEnabled(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // this.m_scope = new Text(cmdScopeGroup, SWT.BORDER | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "m_scope", this.m_scope); this.m_scope.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_scope.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ? this.m_scopeSelect = new Button(cmdScopeGroup, SWT.NONE); WidgetTestUtil.setTestId(this, "m_scopeSelect", this.m_scopeSelect); this.m_scopeSelect.setText(Messages.getString("refer")); this.m_scopeSelect.setLayoutData(new GridData(80, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_scopeSelect.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScopeTreeDialog dialog = new ScopeTreeDialog(m_shell, m_managerName, m_ownerRoleId); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem selectItem = dialog.getSelectItem(); FacilityInfo info = selectItem.getData(); FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); m_facilityPath = path.getPath(selectItem); m_facilityId = info.getFacilityId(); m_scope.setText(m_facilityPath); update(); } } }); // ? Group cmdScopeProcGroup = new Group(this, SWT.NONE); cmdScopeProcGroup.setText(Messages.getString("scope.process")); cmdScopeProcGroup.setLayout(new RowLayout()); // ??? this.m_allNode = new Button(cmdScopeProcGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_allNode", this.m_allNode); this.m_allNode.setText(Messages.getString("scope.process.all.nodes")); this.m_allNode.setLayoutData(new RowData(150, SizeConstant.SIZE_BUTTON_HEIGHT)); // ???? this.m_retry = new Button(cmdScopeProcGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_retry", this.m_retry); this.m_retry.setText(Messages.getString("scope.process.retry.nodes")); this.m_retry.setLayoutData(new RowData(350, SizeConstant.SIZE_BUTTON_HEIGHT)); // ? Composite scriptDistributionComposite = new Composite(this, SWT.NONE); scriptDistributionComposite.setLayout(new GridLayout(2, false)); // ???? Label scriptDistributionLabel = new Label(scriptDistributionComposite, SWT.NONE); scriptDistributionLabel.setText(Messages.getString("job.script.distribution") + ":"); scriptDistributionLabel.setLayoutData(new GridData(150, SizeConstant.SIZE_LABEL_HEIGHT)); //???? this.m_managerDistributionBtn = new Button(scriptDistributionComposite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_managerDistributionBtn", this.m_managerDistributionBtn); this.m_managerDistributionBtn.setText(Messages.getString("job.script.distribution")); this.m_managerDistributionBtn.setLayoutData(new GridData(140, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_managerDistributionBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ManagerDistributionDialog dialog = new ManagerDistributionDialog(m_shell, m_readOnly); dialog.setManagerDistribution(m_managerDistribution); dialog.setScriptName(m_scriptName); dialog.setScriptEncoding(m_scriptEncoding); dialog.setScriptContent(m_scriptContent); dialog.setManager(m_managerName); if (dialog.open() == IDialogConstants.OK_ID) { m_managerDistribution = dialog.getManagerDistribution(); m_scriptName = dialog.getScriptName(); m_scriptEncoding = dialog.getScriptEncoding(); m_scriptContent = dialog.getScriptContent(); } } }); // Composite Composite startCommandComposite = new Composite(this, SWT.NONE); startCommandComposite.setLayout(new RowLayout()); // Label startCommandLabel = new Label(startCommandComposite, SWT.NONE); startCommandLabel.setText(Messages.getString("start.command") + " : "); startCommandLabel.setLayoutData(new RowData(150, SizeConstant.SIZE_LABEL_HEIGHT)); // this.m_startCommand = new Text(startCommandComposite, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_startCommand", this.m_startCommand); this.m_startCommand.setLayoutData(new RowData(400, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_startCommand.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_1024)); this.m_startCommand.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ? Group cmdStopGroup = new Group(this, SWT.NONE); cmdStopGroup.setText(Messages.getString("stop")); cmdStopGroup.setLayout(new RowLayout()); // ?? this.m_destroyProcess = new Button(cmdStopGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_destroyProcess", this.m_destroyProcess); this.m_destroyProcess.setText(Messages.getString("shutdown.process")); this.m_destroyProcess.setLayoutData(new RowData(190, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_destroyProcess.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_executeStopCommand.setSelection(false); m_stopCommand.setEditable(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // ?? this.m_executeStopCommand = new Button(cmdStopGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_executeStopCommand", this.m_executeStopCommand); this.m_executeStopCommand.setText(Messages.getString("stop.command")); this.m_executeStopCommand.setLayoutData(new RowData(120, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_executeStopCommand.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_destroyProcess.setSelection(false); m_stopCommand.setEditable(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // ?? this.m_stopCommand = new Text(cmdStopGroup, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_stopCommand", this.m_stopCommand); this.m_stopCommand.setLayoutData(new RowData(160, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_stopCommand.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_1024)); this.m_stopCommand.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // Group cmdExeUserGroup = new Group(this, SWT.NONE); cmdExeUserGroup.setText(Messages.getString("effective.user")); cmdExeUserGroup.setLayout(new RowLayout()); // this.m_agentUser = new Button(cmdExeUserGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_agentUser", this.m_agentUser); this.m_agentUser.setText(Messages.getString("agent.user")); this.m_agentUser.setLayoutData(new RowData(190, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_agentUser.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_specifyUser.setSelection(false); m_user.setEditable(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // ? this.m_specifyUser = new Button(cmdExeUserGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_specifyUser", this.m_specifyUser); this.m_specifyUser.setText(Messages.getString("specified.user")); this.m_specifyUser.setLayoutData(new RowData(120, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_specifyUser.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_agentUser.setSelection(false); m_user.setEditable(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // ? this.m_user = new Text(cmdExeUserGroup, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_user", this.m_user); this.m_user.setLayoutData(new RowData(160, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_user.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_64)); this.m_user.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // Composite Composite cmdJobParameter = new Composite(this, SWT.NONE); cmdJobParameter.setLayout(new GridLayout(2, false)); // m_jobCommandParamBtn = new Button(cmdJobParameter, SWT.NONE); WidgetTestUtil.setTestId(this, "m_jobCommandParamBtn", this.m_jobCommandParamBtn); m_jobCommandParamBtn.setText(Messages.getString("job.command.result.parameter")); m_jobCommandParamBtn.setLayoutData(new GridData(180, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_jobCommandParamBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { JobCommandParameterCompositeDialog dialog = new JobCommandParameterCompositeDialog(m_shell, m_readOnly); dialog.setJobCommandParamMap(m_jobCommandParamMap); if (dialog.open() == IDialogConstants.OK_ID) { m_jobCommandParamMap = dialog.getJobCommandParamMap(); } } }); // m_envVariableBtn = new Button(cmdJobParameter, SWT.NONE); WidgetTestUtil.setTestId(this, "m_envVariableBtn", this.m_envVariableBtn); m_envVariableBtn.setText(Messages.getString("job.environment.variable")); m_envVariableBtn.setLayoutData(new GridData(150, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_envVariableBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { EnvVariableCompositeDialog dialog = new EnvVariableCompositeDialog(m_shell, m_readOnly); dialog.setJobEnvVariableInfo(m_jobEnvVariableInfo); if (dialog.open() == IDialogConstants.OK_ID) { m_jobEnvVariableInfo = dialog.getJobEnvVariableInfo(); } } }); }
From source file:com.clustercontrol.jobmanagement.composite.EnvVariableComposite.java
License:Open Source License
/** * ????/*from w w w. ja v a 2s . c o m*/ */ private void initialize() { this.setLayout(JobDialogUtil.getParentLayout()); // Table table = new Table(this, 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 RowData(430, 75)); // Composite Composite buttonComposite = new Composite(this, SWT.NONE); buttonComposite.setLayout(new RowLayout()); // dummy new Label(buttonComposite, SWT.NONE).setLayoutData(new RowData(190, SizeConstant.SIZE_LABEL_HEIGHT)); // this.m_createCondition = new Button(buttonComposite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_createCondition", this.m_createCondition); this.m_createCondition.setText(Messages.getString("add")); this.m_createCondition.setLayoutData(new RowData(80, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_createCondition.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { EnvVariableDialog dialog = new EnvVariableDialog(m_shell); if (dialog.open() == IDialogConstants.OK_ID) { ArrayList<?> info = dialog.getInputData(); @SuppressWarnings("unchecked") ArrayList<Object> list = (ArrayList<Object>) m_viewer.getInput(); if (list == null) { list = new ArrayList<Object>(); } else { // Check if environment variable name already exists for (Object one : list) { @SuppressWarnings("unchecked") String name = (String) ((ArrayList<Object>) one).get(0); if (name.equals(info.get(0))) { MessageDialog.openError(null, Messages.getString("message.hinemos.1"), Messages.getString("message.hinemos.10", new Object[] { Messages.getString("job.environment.variable"), name })); return; } } } // Finally, add it list.add(info); m_viewer.setInput(list); } } }); // this.m_modifyCondition = new Button(buttonComposite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_modifyCondition", this.m_modifyCondition); this.m_modifyCondition.setText(Messages.getString("modify")); this.m_modifyCondition.setLayoutData(new RowData(80, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_modifyCondition.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { EnvVariableDialog dialog = new EnvVariableDialog(m_shell); @SuppressWarnings("unchecked") ArrayList<Object> objList = m_selectItem.isEmpty() ? null : (ArrayList<Object>) m_selectItem.get(0); if (objList != null) { dialog.setInputData(objList); if (dialog.open() == IDialogConstants.OK_ID) { ArrayList<?> info = dialog.getInputData(); @SuppressWarnings("unchecked") ArrayList<Object> list = (ArrayList<Object>) m_viewer.getInput(); list.remove(objList); list.add(info); m_selectItem = null; m_viewer.setInput(list); } } } }); // this.m_deleteCondition = new Button(buttonComposite, SWT.NONE); WidgetTestUtil.setTestId(this, "m_deleteCondition", this.m_deleteCondition); this.m_deleteCondition.setText(Messages.getString("delete")); this.m_deleteCondition.setLayoutData(new RowData(80, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_deleteCondition.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ArrayList<?> list = (ArrayList<?>) m_viewer.getInput(); for (Object obj : m_selectItem) { if (obj instanceof ArrayList) { @SuppressWarnings("unchecked") ArrayList<Object> objList = (ArrayList<Object>) obj; list.remove(objList); m_selectItem = new ArrayList<Object>(); m_viewer.setInput(list); } } } }); this.m_viewer = new CommonTableViewer(table); this.m_viewer.createTableColumn(GetEnvVariableTableDefine.get(), GetEnvVariableTableDefine.SORT_COLUMN_INDEX, GetEnvVariableTableDefine.SORT_ORDER); this.m_viewer.addSelectionChangedListener(new EnvVariableSelectionChangedListener(this)); }
From source file:com.clustercontrol.jobmanagement.composite.FileComposite.java
License:Open Source License
/** * ?????//from w w w . ja v a 2s .c o m */ private void initialize() { this.setLayout(JobDialogUtil.getParentLayout()); // ? Group fileTransferFromgroup = new Group(this, SWT.NONE); fileTransferFromgroup.setText(Messages.getString("forward.source")); fileTransferFromgroup.setLayout(new GridLayout(3, false)); // ? Label srcScopeTitle = new Label(fileTransferFromgroup, SWT.NONE); srcScopeTitle.setText(Messages.getString("scope") + " : "); srcScopeTitle.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // ? this.m_srcScope = new Text(fileTransferFromgroup, SWT.BORDER | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "m_srcScope", this.m_srcScope); this.m_srcScope.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_srcScope.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ?? this.m_srcScopeSelect = new Button(fileTransferFromgroup, SWT.NONE); WidgetTestUtil.setTestId(this, "m_srcScopeSelect", this.m_srcScopeSelect); this.m_srcScopeSelect.setText(Messages.getString("refer")); this.m_srcScopeSelect.setLayoutData(new GridData(80, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_srcScopeSelect.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScopeTreeDialog dialog = new ScopeTreeDialog(m_shell, m_managerName, m_ownerRoleId); // ?????? dialog.setSelectNodeOnly(true); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem selectItem = dialog.getSelectItem(); FacilityInfo info = selectItem.getData(); FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); m_srcFacilityPath = path.getPath(selectItem); m_srcFacilityId = info.getFacilityId(); m_srcScope.setText(m_srcFacilityPath); } } }); // ? Label fileTitle = new Label(fileTransferFromgroup, SWT.NONE); fileTitle.setText(Messages.getString("file") + " : "); fileTitle.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // ? this.m_srcFile = new Text(fileTransferFromgroup, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_srcFile", this.m_srcFile); this.m_srcFile.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_srcFile.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_4096)); this.m_srcFile.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ? Group fileTransferTogroup = new Group(this, SWT.NONE); fileTransferTogroup.setText(Messages.getString("forward.destination")); fileTransferTogroup.setLayout(new GridLayout(3, false)); // ? Label destScopeTitle = new Label(fileTransferTogroup, SWT.NONE); destScopeTitle.setText(Messages.getString("scope") + " : "); destScopeTitle.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // ? this.m_destScope = new Text(fileTransferTogroup, SWT.BORDER | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "m_destScope", m_destScope); this.m_destScope.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_destScope.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ?? m_destScopeSelect = new Button(fileTransferTogroup, SWT.NONE); WidgetTestUtil.setTestId(this, "m_destScopeSelect", m_destScopeSelect); m_destScopeSelect.setText(Messages.getString("refer")); m_destScopeSelect.setLayoutData(new GridData(80, SizeConstant.SIZE_BUTTON_HEIGHT)); m_destScopeSelect.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { ScopeTreeDialog dialog = new ScopeTreeDialog(m_shell, m_managerName, m_ownerRoleId); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem selectItem = dialog.getSelectItem(); FacilityInfo info = selectItem.getData(); FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); m_destFacilityPath = path.getPath(selectItem); m_destFacilityId = info.getFacilityId(); m_destScope.setText(m_destFacilityPath); } } }); // ?? Group methodGroup = new Group(fileTransferTogroup, SWT.NONE); methodGroup.setText(Messages.getString("process.method")); methodGroup.setLayout(new RowLayout()); methodGroup.setLayoutData(new GridData()); ((GridData) methodGroup.getLayoutData()).horizontalSpan = 3; // ???? m_allNode = new Button(methodGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_allNode", m_allNode); m_allNode.setText(Messages.getString("forward.all.nodes")); m_allNode.setLayoutData(new RowData(220, SizeConstant.SIZE_BUTTON_HEIGHT)); // ?? m_oneNode = new Button(methodGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_oneNode", m_oneNode); m_oneNode.setText(Messages.getString("forward.one.node")); m_oneNode.setLayoutData(new RowData(250, SizeConstant.SIZE_BUTTON_HEIGHT)); // ? Label forwardDirTitle = new Label(fileTransferTogroup, SWT.NONE); forwardDirTitle.setText(Messages.getString("directory") + " : "); forwardDirTitle.setLayoutData(new GridData(100, SizeConstant.SIZE_LABEL_HEIGHT)); // ? this.m_destDirectory = new Text(fileTransferTogroup, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_destDirectory", m_destDirectory); this.m_destDirectory.setLayoutData(new GridData(200, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_destDirectory.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_4096)); this.m_destDirectory.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // dummy new Label(fileTransferTogroup, SWT.NONE); // ?Composite Composite fileTransfarComposite = new Composite(this, SWT.NONE); fileTransfarComposite.setLayout(new RowLayout()); // ???? this.m_compressionCondition = new Button(fileTransfarComposite, SWT.CHECK); WidgetTestUtil.setTestId(this, "m_compressionCondition", this.m_compressionCondition); this.m_compressionCondition.setText(Messages.getString("forward.compression.file")); this.m_compressionCondition.setLayoutData(new RowData(220, SizeConstant.SIZE_BUTTON_HEIGHT)); // ????? this.m_checkFileCondition = new Button(fileTransfarComposite, SWT.CHECK); WidgetTestUtil.setTestId(this, "m_checkFileCondition", this.m_checkFileCondition); this.m_checkFileCondition.setText(Messages.getString("forward.file.check")); this.m_checkFileCondition.setLayoutData(new RowData(220, SizeConstant.SIZE_BUTTON_HEIGHT)); // Group fileEffectiveUserGroup = new Group(this, SWT.NONE); fileEffectiveUserGroup.setText(Messages.getString("effective.user")); fileEffectiveUserGroup.setLayout(new GridLayout(2, false)); // this.m_agentUser = new Button(fileEffectiveUserGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_agentUser", this.m_agentUser); this.m_agentUser.setText(Messages.getString("agent.user")); this.m_agentUser.setLayoutData(new GridData(200, SizeConstant.SIZE_BUTTON_HEIGHT)); ((GridData) this.m_agentUser.getLayoutData()).horizontalSpan = 2; this.m_agentUser.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_specifyUser.setSelection(false); m_user.setEditable(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // ? this.m_specifyUser = new Button(fileEffectiveUserGroup, SWT.RADIO); WidgetTestUtil.setTestId(this, "m_specifyUser", this.m_specifyUser); this.m_specifyUser.setText(Messages.getString("specified.user")); this.m_specifyUser.setLayoutData(new GridData(200, SizeConstant.SIZE_BUTTON_HEIGHT)); this.m_specifyUser.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); WidgetTestUtil.setTestId(this, null, check); if (check.getSelection()) { m_agentUser.setSelection(false); m_user.setEditable(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); // ? this.m_user = new Text(fileEffectiveUserGroup, SWT.BORDER); WidgetTestUtil.setTestId(this, "m_user", this.m_user); this.m_user.setLayoutData(new GridData(250, SizeConstant.SIZE_TEXT_HEIGHT)); this.m_user.addVerifyListener(new StringVerifyListener(DataRangeConstant.VARCHAR_64)); this.m_user.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); }