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.repository.dialog.NodeAssignDialog.java
License:Open Source License
/** * ???????/*from www. j a va 2 s . co m*/ * * @param parent * ?? */ @Override protected void createButtonsForButtonBar(Composite parent) { // this.createButton(parent, IDialogConstants.OPEN_ID, Messages.getString("filter"), false); this.getButton(IDialogConstants.OPEN_ID).addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // ? NodeFilterDialog dialog = new NodeFilterDialog(getShell()); if (dialog.open() == IDialogConstants.OK_ID) { nodeList.update(dialog.getInputData()); } } }); super.createButtonsForButtonBar(parent); }
From source file:com.clustercontrol.repository.view.action.NodeAddAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *//*ww w .j a va 2s.c o m*/ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); String managerName = EndpointManager.getActiveManagerNameList().get(0); // ? NodeCreateDialog dialog = new NodeCreateDialog(this.viewPart.getSite().getShell(), managerName, null, false); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { NodeListView view = null; try { view = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } view.update(); } return null; }
From source file:com.clustercontrol.repository.view.action.NodeAssignAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *///from www .j av a 2 s .c om @Override public Object execute(ExecutionEvent event) throws ExecutionException { // ?????? // ?????? this.viewPart = HandlerUtil.getActivePart(event); ScopeListView scopeListView = null; try { scopeListView = (ScopeListView) this.viewPart.getAdapter(ScopeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (scopeListView == null) { m_log.info("execute: view is null"); return null; } FacilityTreeItem item = scopeListView.getSelectedScopeItem(); // ?????? if (null == item) { return null; } // ???????? FacilityInfo info = item.getData(); if (info.getFacilityType() != FacilityConstant.TYPE_SCOPE) { return null; } FacilityTreeItem manager = ScopePropertyUtil.getManager(item); String managerName = manager.getData().getFacilityId(); // ? String facilityId = info.getFacilityId(); NodeAssignDialog dialog = new NodeAssignDialog(this.viewPart.getSite().getShell(), managerName, facilityId); // ??????? if (dialog.open() == IDialogConstants.OK_ID) { scopeListView.update(); } return null; }
From source file:com.clustercontrol.repository.view.action.NodeCopyAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *///from w ww . ja v a 2 s . com @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); // ??????ID? NodeListView view = null; try { view = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } StructuredSelection selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); List<?> list = (List<?>) selection.getFirstElement(); String managerName = null; String facilityId = null; if (list == null) { return null; } managerName = (String) list.get(GetNodeListTableDefine.MANAGER_NAME); facilityId = (String) list.get(GetNodeListTableDefine.FACILITY_ID); if (facilityId != null) { // ? NodeCreateDialog dialog = new NodeCreateDialog(this.viewPart.getSite().getShell(), managerName, facilityId, false); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { view.update(); // ?????????? CommonTableViewer viewer = view.getComposite().getTableViewer(); viewer.setSelection(viewer.getSelection()); } } return null; }
From source file:com.clustercontrol.repository.view.action.NodeFilterAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *//*from w ww.ja va 2 s. co m*/ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); this.window = HandlerUtil.getActiveWorkbenchWindow(event); // ??????ID? NodeListView view = null; try { view = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } ICommandService commandService = (ICommandService) window.getService(ICommandService.class); Command command = commandService.getCommand(ID); boolean isChecked = !HandlerUtil.toggleCommandState(command); if (isChecked) { // ? NodeFilterDialog dialog = new NodeFilterDialog(this.viewPart.getSite().getShell()); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { Property condition = dialog.getInputData(); view.update(condition); } else { State state = command.getState(RegistryToggleState.STATE_ID); state.setValue(false); } } else { view.update(null); } return null; }
From source file:com.clustercontrol.repository.view.action.NodeModifyAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *//*from w ww . j ava 2s. com*/ @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); // ??????ID? NodeListView nodeListView = null; try { nodeListView = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (nodeListView == null) { m_log.info("execute: view is null"); return null; } StructuredSelection selection = (StructuredSelection) nodeListView.getComposite().getTableViewer() .getSelection(); List<?> list = (List<?>) selection.getFirstElement(); if (list == null) { return null; } String managerName = (String) list.get(GetNodeListTableDefine.MANAGER_NAME); String facilityId = (String) list.get(GetNodeListTableDefine.FACILITY_ID); if (facilityId != null) { // ? NodeCreateDialog dialog = new NodeCreateDialog(this.viewPart.getSite().getShell(), managerName, facilityId, true); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { nodeListView.update(); // ?????????? CommonTableViewer viewer = nodeListView.getComposite().getTableViewer(); viewer.setSelection(viewer.getSelection()); } } return null; }
From source file:com.clustercontrol.repository.view.action.NodeReleaseAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *//*from w ww .ja va 2s. c o m*/ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // ?????? // ?????? this.viewPart = HandlerUtil.getActivePart(event); ScopeListView scopeListView = null; try { scopeListView = (ScopeListView) this.viewPart.getAdapter(ScopeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (scopeListView == null) { m_log.info("execute: view is null"); return null; } FacilityTreeItem item = scopeListView.getSelectedScopeItem(); // ?????? if (null == item) { return null; } // ???????? FacilityInfo info = item.getData(); if (info.getFacilityType() != FacilityConstant.TYPE_SCOPE) { return null; } FacilityTreeItem manager = ScopePropertyUtil.getManager(item); String managerName = manager.getData().getFacilityId(); // ? String facilityId = info.getFacilityId(); NodeReleaseDialog dialog = new NodeReleaseDialog(this.viewPart.getSite().getShell(), managerName, facilityId); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { scopeListView.update(); } return null; }
From source file:com.clustercontrol.repository.view.action.NodeSearchAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *///w w w. ja va2s . c o m @Override public Object execute(ExecutionEvent event) throws ExecutionException { this.viewPart = HandlerUtil.getActivePart(event); // ? NodeSearchDialog dialog = new NodeSearchDialog(this.viewPart.getSite().getShell()); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { NodeListView view = null; try { view = (NodeListView) this.viewPart.getAdapter(NodeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (view == null) { m_log.info("execute: view is null"); return null; } view.update(); ClientSession.doCheck(); } return null; }
From source file:com.clustercontrol.repository.view.action.ScopeAddAction.java
License:Open Source License
/** * @see org.eclipse.core.commands.IHandler#execute *///from www .jav a 2s.c o m @Override public Object execute(ExecutionEvent event) throws ExecutionException { // ?????? this.viewPart = HandlerUtil.getActivePart(event); ScopeListView scopeListView = null; try { scopeListView = (ScopeListView) this.viewPart.getAdapter(ScopeListView.class); } catch (Exception e) { m_log.info("execute " + e.getMessage()); return null; } if (scopeListView == null) { m_log.info("execute: view is null"); return null; } FacilityTreeItem item = scopeListView.getSelectedScopeItem(); // ????????????? if (null == item || item.getData().getFacilityType() == FacilityConstant.TYPE_NODE) { return null; } FacilityTreeItem manager = ScopePropertyUtil.getManager(item); String managerName = manager.getData().getFacilityId(); // ? ScopeCreateDialog dialog = new ScopeCreateDialog(this.viewPart.getSite().getShell(), managerName, null, false); String parentId = item.getData().getFacilityId(); if (managerName.equals(parentId)) { parentId = ""; } dialog.setParentFacilityId(parentId); // ??????????? if (dialog.open() == IDialogConstants.OK_ID) { scopeListView.update(); } return null; }