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.custom.dialog.MonitorStringCustomDialog.java
License:Open Source License
/** * ???<br/>//from w ww. j a v a 2 s . c om * * @param parent ??? */ @Override protected void customizeDialog(Composite parent) { // Local Variables Label label = null; // ???? GridData gridData = null; // ???? // MAIN super.customizeDialog(parent); // ? shell.setText(Messages.getString("dialog.monitor.custom.edit")); // ?? Group groupCheckRule = new Group(groupRule, SWT.NONE); WidgetTestUtil.setTestId(this, "checkrule", groupCheckRule); groupCheckRule.setText(Messages.getString("check.rule")); GridLayout layout = new GridLayout(15, true); layout.marginWidth = HALF_MARGIN; layout.marginHeight = HALF_MARGIN; groupCheckRule.setLayout(layout); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = BASIC_UNIT; groupCheckRule.setLayoutData(gridData); // checkbox?(???) this.checkSelected = new Button(groupCheckRule, SWT.CHECK); WidgetTestUtil.setTestId(this, "selectedCheck", checkSelected); this.checkSelected.setText(Messages.getString("monitor.custom.type.selected")); this.checkSelected.setToolTipText(Messages.getString("monitor.custom.type.selected.tips")); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = 8; checkSelected.setLayoutData(gridData); checkSelected.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Button button = (Button) e.getSource(); if (button.getSelection()) { textNode.setEnabled(true); buttonNode.setEnabled(true); } else { textNode.setEnabled(false); buttonNode.setEnabled(false); } update(); } }); // ??? this.textNode = new Text(groupCheckRule, SWT.BORDER | SWT.CENTER | SWT.READ_ONLY); WidgetTestUtil.setTestId(this, "nodetext", textNode); this.textNode.setText(""); this.textNode.setMessage(Messages.getString("monitor.custom.node.selected")); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = 5; this.textNode.setLayoutData(gridData); this.textNode.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); ; this.buttonNode = new Button(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "node", buttonNode); this.buttonNode.setText(Messages.getString("refer")); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = 2; this.buttonNode.setLayoutData(gridData); this.buttonNode.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); String managerName = getMonitorBasicScope().getManagerListComposite().getText(); ScopeTreeDialog dialog = new ScopeTreeDialog(shell, managerName, getMonitorBasicScope().getOwnerRoleId(), false, false); dialog.setSelectNodeOnly(true); if (dialog.open() == IDialogConstants.OK_ID) { FacilityTreeItem item = dialog.getSelectItem(); FacilityInfo info = item.getData(); nodeFacilityId = info.getFacilityId(); if (info.getFacilityType() == FacilityConstant.TYPE_NODE) { textNode.setText(info.getFacilityName()); } else { FacilityPath path = new FacilityPath(ClusterControlPlugin.getDefault().getSeparator()); textNode.setText(path.getPath(item)); } } } }); // ?? Group groupEffectiveUser = new Group(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "effectiveuser", groupEffectiveUser); groupEffectiveUser.setText(Messages.getString("effective.user")); layout = new GridLayout(15, true); layout.marginWidth = HALF_MARGIN; layout.marginHeight = HALF_MARGIN; groupEffectiveUser.setLayout(layout); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = 15; groupEffectiveUser.setLayoutData(gridData); this.buttonAgentUser = new Button(groupEffectiveUser, SWT.RADIO); WidgetTestUtil.setTestId(this, "agentuser", buttonAgentUser); this.buttonAgentUser.setText(Messages.getString("agent.user")); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = SMALL_UNIT; this.buttonAgentUser.setLayoutData(gridData); this.buttonAgentUser.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); if (check.getSelection()) { buttonSpecifyUser.setSelection(false); textEffectiveUser.setEnabled(false); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); this.buttonSpecifyUser = new Button(groupEffectiveUser, SWT.RADIO); WidgetTestUtil.setTestId(this, "specifyuser", buttonSpecifyUser); this.buttonSpecifyUser.setText(Messages.getString("specified.user")); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = WIDTH_TEXT_SHORT; this.buttonSpecifyUser.setLayoutData(gridData); this.buttonSpecifyUser.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Button check = (Button) e.getSource(); if (check.getSelection()) { buttonAgentUser.setSelection(false); textEffectiveUser.setEnabled(true); } update(); } @Override public void widgetDefaultSelected(SelectionEvent e) { } }); this.textEffectiveUser = new Text(groupEffectiveUser, SWT.BORDER | SWT.LEFT); WidgetTestUtil.setTestId(this, "effectiveuser", textEffectiveUser); this.textEffectiveUser.setText(""); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = HALF_UNIT - (SMALL_UNIT + WIDTH_TEXT_SHORT); this.textEffectiveUser.setLayoutData(gridData); this.textEffectiveUser.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "customcommand", label); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); label.setText(Messages.getString("monitor.custom.command") + " : "); gridData.horizontalSpan = WIDTH_TITLE; label.setLayoutData(gridData); this.textCommand = new TextWithParameterComposite(groupCheckRule, SWT.BORDER | SWT.LEFT | SWT.SINGLE); WidgetTestUtil.setTestId(this, "commnad", textCommand); this.textCommand.setText(""); this.textCommand.setToolTipText(Messages.getString("monitor.custom.commandline.tips")); this.textCommand.setColor(new Color(parent.getDisplay(), new RGB(0, 0, 255))); gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); gridData.horizontalSpan = 11; this.textCommand.setLayoutData(gridData); this.textCommand.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); ; /* * */ // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "timeout", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_TITLE; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("time.out") + " : "); // this.m_textTimeout = new Text(groupCheckRule, SWT.BORDER); WidgetTestUtil.setTestId(this, "timeout", m_textTimeout); gridData = new GridData(); gridData.horizontalSpan = 4; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; this.m_textTimeout.setLayoutData(gridData); this.m_textTimeout.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // ?? label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "millisec", label); gridData = new GridData(); gridData.horizontalSpan = WIDTH_VALUE; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); label.setText(Messages.getString("milli.sec")); // label = new Label(groupCheckRule, SWT.NONE); WidgetTestUtil.setTestId(this, "blank", label); gridData = new GridData(); gridData.horizontalSpan = 5; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; label.setLayoutData(gridData); // ??? this.adjustDialog(); // ? MonitorInfo info = null; if (this.monitorId == null) { // ???? info = new MonitorInfo(); this.setInfoInitialValue(info); } else { // ?? try { MonitorSettingEndpointWrapper wrapper = MonitorSettingEndpointWrapper.getWrapper(managerName); info = wrapper.getMonitor(this.monitorId); } catch (InvalidRole_Exception e) { // ?????? MessageDialog.openInformation(null, Messages.getString("message"), Messages.getString("message.accesscontrol.16")); return; } catch (Exception e) { // ? m_log.warn("customizeDialog() getMonitor, " + HinemosMessage.replace(e.getMessage()), e); MessageDialog.openError(null, Messages.getString("failed"), Messages.getString("message.hinemos.failure.unexpected") + ", " + HinemosMessage.replace(e.getMessage())); return; } } this.setInputData(info); update(); }
From source file:com.clustercontrol.dialog.CommonDialog.java
License:Open Source License
@Override protected Control createContents(Composite parent) { Composite composite = (Composite) super.createContents(parent); WidgetTestUtil.setTestId(this, null, composite); m_areaComposite = (Composite) this.getDialogArea(); WidgetTestUtil.setTestId(this, "area", m_areaComposite); m_areaComposite.setLayout(new FillLayout(SWT.DEFAULT)); m_scrolledComposite = new ScrolledComposite(m_areaComposite, SWT.V_SCROLL | SWT.H_SCROLL); WidgetTestUtil.setTestId(this, "scrolled", m_scrolledComposite); Composite childComposite = new Composite(m_scrolledComposite, SWT.NONE); WidgetTestUtil.setTestId(this, "child", childComposite); m_scrolledComposite.setExpandHorizontal(true); m_scrolledComposite.setExpandVertical(true); m_scrolledComposite.setContent(childComposite); // ?/*w w w.j a v a2 s . c om*/ this.customizeDialog(childComposite); if (m_areaComposite.getSize().x > 0 && m_areaComposite.getSize().y > 0) { // ???pack????? m_scrolledComposite.setMinSize(m_areaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); // ????????????????? // ????????????? m_scrolledComposite.setMinWidth(m_areaComposite.getSize().x - 20); } else { //???pack??????? /* ????????????????? scrolledComposite.setMinSize(areaComposite.getShell().getSize().x, areaComposite.getShell().getSize().y); */ } // ? String okText = this.getOkButtonText(); if (okText != null) { Button okButton = this.getButton(IDialogConstants.OK_ID); if (okButton != null) { WidgetTestUtil.setTestId(this, "ok", okButton); okButton.setText(okText); } } // ? String cancelText = this.getCancelButtonText(); if (cancelText != null) { Button cancelButton = this.getButton(IDialogConstants.CANCEL_ID); if (cancelButton != null) { WidgetTestUtil.setTestId(this, "cancel", cancelButton); cancelButton.setText(cancelText); } } return composite; }
From source file:com.clustercontrol.hub.composite.LogFormatComposite.java
License:Open Source License
/** * ??<BR>//from w w w .j a va 2 s. c o m * */ private void initialize() { GridLayout layout = new GridLayout(1, true); this.setLayout(layout); layout.marginHeight = 0; layout.marginWidth = 0; //? logFormatListTable = new Table(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); WidgetTestUtil.setTestId(this, null, logFormatListTable); logFormatListTable.setHeaderVisible(true); logFormatListTable.setLinesVisible(true); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 1; logFormatListTable.setLayoutData(gridData); m_labelCount = new Label(this, SWT.RIGHT); WidgetTestUtil.setTestId(this, "count", m_labelCount); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; m_labelCount.setLayoutData(gridData); m_viewer = new CommonTableViewer(logFormatListTable); m_viewer.createTableColumn(GetLogFormatTableDefine.get(), GetLogFormatTableDefine.SORT_COLUMN_INDEX1, GetLogFormatTableDefine.SORT_COLUMN_INDEX2, GetLogFormatTableDefine.SORT_ORDER); for (int i = 0; i < logFormatListTable.getColumnCount(); i++) { logFormatListTable.getColumn(i).setMoveable(true); } m_viewer.addSelectionChangedListener(new ISelectionChangedListener() { /** * ??????<BR> * ?????????<BR> * ?????????? * * @param event ? * * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ @Override public void selectionChanged(SelectionChangedEvent event) { String id = null; //[]?? IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart viewPart = page.findView(LogFormatView.ID); //?? StructuredSelection selection = (StructuredSelection) event.getSelection(); if (viewPart != null && selection != null) { if (selection.getFirstElement() != null) { ArrayList<?> info = (ArrayList<?>) selection.getFirstElement(); id = (String) info.get(GetLogFormatTableDefine.FORMAT_ID); //?ID LogFormatComposite.this.setFormatId(id); } LogFormatView view = (LogFormatView) viewPart.getAdapter(LogFormatView.class); if (view == null) { m_log.info("selection changed: view is null"); return; } //???/??? view.setEnabledAction(selection.size(), event.getSelection()); } } }); // ? m_viewer.addDoubleClickListener(new IDoubleClickListener() { /** * * @param event */ @Override public void doubleClick(DoubleClickEvent event) { String managerName = ""; String formatId = ""; if (((StructuredSelection) event.getSelection()).getFirstElement() != null) { ArrayList<?> info = (ArrayList<?>) ((StructuredSelection) event.getSelection()) .getFirstElement(); managerName = (String) info.get(GetLogFormatTableDefine.MANAGER_NAME); formatId = (String) info.get(GetLogFormatTableDefine.FORMAT_ID); } if (formatId != null) { // ??? LogFormatDialog dialog = new LogFormatDialog(LogFormatComposite.this.getShell(), managerName, formatId, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { LogFormatComposite.this.update(); } } } }); }
From source file:com.clustercontrol.hub.composite.LogFormatKeyListComposite.java
License:Open Source License
/** * ?????/* w ww . j a va 2 s . co m*/ */ private void initialize() { /* * []? */ GridLayout layout = new GridLayout(1, true); this.setLayout(layout); layout.marginHeight = 0; layout.marginWidth = 0; Table tblLogFormatKeyList = new Table(this, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); WidgetTestUtil.setTestId(this, null, tblLogFormatKeyList); tblLogFormatKeyList.setHeaderVisible(true); tblLogFormatKeyList.setLinesVisible(true); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; tblLogFormatKeyList.setLayoutData(gridData); // ?? m_tableViewer = new CommonTableViewer(tblLogFormatKeyList); m_tableViewer.createTableColumn(getTableColumnInfoList(), SORT_COLUMN_INDEX, SORT_ORDER); m_tableViewer.addDoubleClickListener(new IDoubleClickListener() { @Override public void doubleClick(DoubleClickEvent event) { //????? String order = getSelectionLogFormatKey(); // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); //???LogFormatKey???? LogFormatKey logFormatKey = getLogFormatKeyListByKey(order); if (logFormatKey != null) { LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_MODIFY, m_keyList, logFormatKey); if (dialog.open() == IDialogConstants.OK_ID) { getLogFormatKeyList().remove(logFormatKey); addLogFormatKeyList(dialog.getLogFormatKey()); update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); }
From source file:com.clustercontrol.hub.composite.TransferComposite.java
License:Open Source License
/** * ??<BR>/*from w w w . j ava 2s. co m*/ * */ private void initialize() { GridLayout layout = new GridLayout(1, true); this.setLayout(layout); layout.marginHeight = 0; layout.marginWidth = 0; //??[?]? m_transferListTable = new Table(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); WidgetTestUtil.setTestId(this, null, m_transferListTable); m_transferListTable.setHeaderVisible(true); m_transferListTable.setLinesVisible(true); GridData gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalSpan = 1; m_transferListTable.setLayoutData(gridData); m_labelCount = new Label(this, SWT.RIGHT); WidgetTestUtil.setTestId(this, "count", m_labelCount); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.FILL; m_labelCount.setLayoutData(gridData); m_viewer = new CommonTableViewer(m_transferListTable); m_viewer.createTableColumn(GetTransferTableDefine.get(), GetTransferTableDefine.SORT_COLUMN_INDEX1, GetTransferTableDefine.SORT_COLUMN_INDEX2, GetTransferTableDefine.SORT_ORDER); for (int i = 0; i < m_transferListTable.getColumnCount(); i++) { m_transferListTable.getColumn(i).setMoveable(true); } m_viewer.addSelectionChangedListener(new ISelectionChangedListener() { /** * ??????<BR> * ???????<BR> * ?????????? * * @param event ? * * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ @Override public void selectionChanged(SelectionChangedEvent event) { String id = null; //??[?]?? IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IViewPart viewPart = page.findView(TransferView.ID); //?? StructuredSelection selection = (StructuredSelection) event.getSelection(); if (viewPart != null && selection != null) { if (selection.getFirstElement() != null) { ArrayList<?> info = (ArrayList<?>) selection.getFirstElement(); id = (String) info.get(GetTransferTableDefine.TRANSFER_ID); //ID TransferComposite.this.setTransferId(id); } TransferView view = (TransferView) viewPart.getAdapter(TransferView.class); //???/??? view.setEnabledAction(selection.size(), event.getSelection()); } } }); // ? m_viewer.addDoubleClickListener(new IDoubleClickListener() { /** * * @param event */ @Override public void doubleClick(DoubleClickEvent event) { String managerName = ""; String exportId = ""; if (((StructuredSelection) event.getSelection()).getFirstElement() != null) { ArrayList<?> info = (ArrayList<?>) ((StructuredSelection) event.getSelection()) .getFirstElement(); managerName = (String) info.get(GetTransferTableDefine.MANAGER_NAME); exportId = (String) info.get(GetTransferTableDefine.TRANSFER_ID); } if (exportId != null) { // ??? TransferInfoDialog dialog = new TransferInfoDialog(TransferComposite.this.getShell(), managerName, exportId, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { TransferComposite.this.update(); } } } }); }
From source file:com.clustercontrol.hub.dialog.LogFormatDialog.java
License:Open Source License
/** * ????/*from w ww . ja v a2s . co m*/ * * @param parent ? */ @Override protected void customizeDialog(final Composite parent) { shell = this.getShell(); parent.getShell().setText(Messages.getString("dialog.hub.log.format")); /** * * ????? */ GridLayout baseLayout = new GridLayout(1, true); baseLayout.marginWidth = 10; baseLayout.marginHeight = 10; //? parent.setLayout(baseLayout); Composite logFormatComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(1, true); layout.marginWidth = 5; layout.marginHeight = 5; logFormatComposite.setLayout(layout); GridData gridData = new GridData(); gridData.verticalAlignment = SWT.FILL; // gridData.heightHint = 664; gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; logFormatComposite.setLayoutData(gridData); /** TOP Composite */ Composite topComposite = new Composite(logFormatComposite, SWT.NONE); GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_composite.heightHint = 121; topComposite.setLayoutData(gd_composite); topComposite.setLayout(new GridLayout(2, false)); //? Label label = new Label(topComposite, SWT.LEFT); label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); label.setText(Messages.getString("facility.manager")); if (mode == PropertyDefineConstant.MODE_MODIFY) { managerListComposite = new ManagerListComposite(topComposite, SWT.NONE, false); } else { managerListComposite = new ManagerListComposite(topComposite, SWT.NONE, true); managerListComposite.getComboManagerName().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // Update String managerName = managerListComposite.getText(); roleIdListComposite.createRoleIdList(managerName); } }); } gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; managerListComposite.setLayoutData(gridData); if (null != managerName) { managerListComposite.setText(managerName); } //ID Label labelFormatId = new Label(topComposite, SWT.LEFT); GridData gd_labelFormatId = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_labelFormatId.widthHint = 136; labelFormatId.setLayoutData(gd_labelFormatId); labelFormatId.setText(Messages.getString("hub.log.format.id")); txtFormatId = new Text(topComposite, SWT.BORDER); txtFormatId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); txtFormatId.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent arg0) { update(); } }); // Label lblDescription = new Label(topComposite, SWT.LEFT); lblDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); lblDescription.setText(Messages.getString("description")); txtDescription = new Text(topComposite, SWT.BORDER); txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); // ID Label labelRoleId = new Label(topComposite, SWT.LEFT); labelRoleId.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); labelRoleId.setText(Messages.getString("owner.role.id")); if (this.mode == PropertyDefineConstant.MODE_MODIFY) { roleIdListComposite = new RoleIdListComposite(topComposite, SWT.NONE, this.managerListComposite.getText(), false, Mode.OWNER_ROLE); } else { roleIdListComposite = new RoleIdListComposite(topComposite, SWT.NONE, this.managerListComposite.getText(), true, Mode.OWNER_ROLE); } gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.grabExcessHorizontalSpace = true; roleIdListComposite.setLayoutData(gridData); // Group timestampLayout = new Group(logFormatComposite, SWT.NONE); GridData gd_timestampLayout = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_timestampLayout.heightHint = 58; timestampLayout.setLayoutData(gd_timestampLayout); timestampLayout.setText(Messages.getString("dialog.hub.log.format.date.extraction")); timestampLayout.setLayout(new GridLayout(2, false)); Label lblTimestampRegex = new Label(timestampLayout, SWT.NONE); GridData gd_lblTimestampRegex = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_lblTimestampRegex.widthHint = 144; lblTimestampRegex.setLayoutData(gd_lblTimestampRegex); lblTimestampRegex.setText(Messages.getString("dialog.hub.log.format.date.extraction.pattern")); txtTimestampRegex = new Text(timestampLayout, SWT.BORDER); GridData gd_txtTimestampRegex = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_txtTimestampRegex.widthHint = 237; txtTimestampRegex.setLayoutData(gd_txtTimestampRegex); Label lblTimestampFormat = new Label(timestampLayout, SWT.NONE); GridData gd_lblTimestampFormat = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_lblTimestampFormat.widthHint = 113; lblTimestampFormat.setLayoutData(gd_lblTimestampFormat); lblTimestampFormat.setText(Messages.getString("dialog.hub.log.format.date.extraction.format")); txtTimestampFormat = new Text(timestampLayout, SWT.BORDER); GridData gd_txtTimestampFormat = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_txtTimestampFormat.widthHint = 296; txtTimestampFormat.setLayoutData(gd_txtTimestampFormat); txtTimestampFormat.setMessage("ex. yyyy-MM-dd HH:mm:ss"); // Group keypatLayout = new Group(logFormatComposite, SWT.NONE); keypatLayout.setLayout(new GridLayout(2, false)); GridData gridData_1 = new GridData(); gridData_1.grabExcessHorizontalSpace = true; gridData_1.horizontalAlignment = GridData.FILL; keypatLayout.setLayoutData(gridData_1); keypatLayout.setText(Messages.getString("hub.log.format.key.pattern")); logFormatKeyListComposite = new LogFormatKeyListComposite(keypatLayout, SWT.BORDER, managerName); GridData gd_logFormatKeyListComposite = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); gd_logFormatKeyListComposite.heightHint = 217; gd_logFormatKeyListComposite.widthHint = 393; logFormatKeyListComposite.setLayoutData(gd_logFormatKeyListComposite); Composite composite = new Composite(keypatLayout, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); composite.setLayout(new GridLayout(1, false)); btnAddKeyPattern = new Button(composite, SWT.NONE); GridData gd_btnAddKeyPattern = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_btnAddKeyPattern.widthHint = 75; btnAddKeyPattern.setLayoutData(gd_btnAddKeyPattern); btnAddKeyPattern.setText(Messages.getString("add")); btnAddKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_ADD, logFormatKeyListComposite.getLogFormatKeyList()); if (dialog.open() == IDialogConstants.OK_ID) { logFormatKeyListComposite.addLogFormatKeyList(dialog.getLogFormatKey()); logFormatKeyListComposite.update(); } } }); btnModifyKeyPattern = new Button(composite, SWT.NONE); btnModifyKeyPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnModifyKeyPattern.setText(Messages.getString("modify")); btnModifyKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //????? String order = logFormatKeyListComposite.getSelectionLogFormatKey(); // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); //???LogFormatKey???? LogFormatKey logFormatKey = logFormatKeyListComposite.getLogFormatKeyListByKey(order); if (logFormatKey != null) { LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_MODIFY, logFormatKeyListComposite.getLogFormatKeyList(), logFormatKey); if (dialog.open() == IDialogConstants.OK_ID) { logFormatKeyListComposite.getLogFormatKeyList().remove(logFormatKey); logFormatKeyListComposite.addLogFormatKeyList(dialog.getLogFormatKey()); logFormatKeyListComposite.update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); btnDelKeyPattern = new Button(composite, SWT.NONE); btnDelKeyPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnDelKeyPattern.setText(Messages.getString("delete")); btnDelKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //????? String order = logFormatKeyListComposite.getSelectionLogFormatKey(); //???LogFormatKey???? LogFormatKey logFormatKey = logFormatKeyListComposite.getLogFormatKeyListByKey(order); String[] args = new String[1]; args[0] = order; if (logFormatKey != null) { if (MessageDialog.openConfirm(null, Messages.getString("confirmed"), Messages.getString("message.hub.log.format.pattern.delete", args))) { logFormatKeyListComposite.getLogFormatKeyList().remove(logFormatKey); logFormatKeyListComposite.update(); } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); btnCopyKeyPattern = new Button(composite, SWT.NONE); btnCopyKeyPattern.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); btnCopyKeyPattern.setText(Messages.getString("copy")); btnCopyKeyPattern.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { //????? String order = logFormatKeyListComposite.getSelectionLogFormatKey(); if (order != null) { // ? Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); //???LogFormatKey???? LogFormatKey logFormatKey = logFormatKeyListComposite.getLogFormatKeyListByKey(order); if (logFormatKey != null) { LogKeyPatternDialog dialog = new LogKeyPatternDialog(shell, PropertyDefineConstant.MODE_COPY, logFormatKeyListComposite.getLogFormatKeyList(), logFormatKey); if (dialog.open() == IDialogConstants.OK_ID) { logFormatKeyListComposite.addLogFormatKeyList(dialog.getLogFormatKey()); logFormatKeyListComposite.update(); //logFormatKeyListComposite.setSelection(); } } } else { MessageDialog.openWarning(null, Messages.getString("warning"), Messages.getString("message.monitor.30")); } } }); this.reflectLogFormat(); update(); }
From source file:com.clustercontrol.hub.view.action.LogFormatCopyAction.java
License:Open Source License
/** * Handler execution//w w w .j av a2 s .com */ @Override public Object execute(final 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); // []??????ID? LogFormatView view = (LogFormatView) this.viewPart.getAdapter(LogFormatView.class); if (view == null) { m_log.info("execute: view is null"); return null; } String managerName = view.getSelectedManagerNameList().get(0); String id = view.getSelectedIdList().get(0); if (id != null) { // ? LogFormatDialog dialog = new LogFormatDialog(this.viewPart.getSite().getShell(), managerName, id, PropertyDefineConstant.MODE_COPY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { view.update(); } } return null; }
From source file:com.clustercontrol.hub.view.action.LogFormatModifyAction.java
License:Open Source License
/** * Handler execution/* w w w . ja va 2 s . c o m*/ */ @Override public Object execute(final 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); // []??????ID? LogFormatView view = (LogFormatView) this.viewPart.getAdapter(LogFormatView.class); if (view == null) { m_log.info("execute: view is null"); return null; } String managerName = view.getSelectedManagerNameList().get(0); String id = view.getSelectedIdList().get(0); if (id != null) { // ? LogFormatDialog dialog = new LogFormatDialog(this.viewPart.getSite().getShell(), managerName, id, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { view.update(); } } return null; }
From source file:com.clustercontrol.hub.view.action.LogTransferCopyAction.java
License:Open Source License
/** * Handler execution// w ww .ja v a 2s.com */ @Override public Object execute(final 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); // ??[?]?????????ID? TransferView view = (TransferView) this.viewPart.getAdapter(TransferView.class); String managerName = view.getSelectedManagerNameList().get(0); String id = view.getSelectedIdList().get(0); if (id != null) { // ? TransferInfoDialog dialog = new TransferInfoDialog(this.viewPart.getSite().getShell(), managerName, id, PropertyDefineConstant.MODE_COPY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { view.update(); } } return null; }
From source file:com.clustercontrol.hub.view.action.LogTransferModifyAction.java
License:Open Source License
/** * Handler execution/*from w w w .ja va2s . co m*/ */ @Override public Object execute(final 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); // ??[?]??????ID? TransferView view = (TransferView) this.viewPart.getAdapter(TransferView.class); String managerName = view.getSelectedManagerNameList().get(0); String id = view.getSelectedIdList().get(0); if (id != null) { // ? TransferInfoDialog dialog = new TransferInfoDialog(this.viewPart.getSite().getShell(), managerName, id, PropertyDefineConstant.MODE_MODIFY); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { view.update(); } } return null; }