List of usage examples for org.eclipse.jface.viewers StructuredSelection size
@Override public int size()
From source file:com.clustercontrol.infra.view.action.CheckInfraModuleAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraModuleView) { InfraModuleView view = (InfraModuleView) part.getAdapter(InfraModuleView.class); if (view == null) { m_log.info("execute: view is null"); return; }// www .j a v a 2 s . c o m // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && selection.size() > 0) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.CopyInfraManagementAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraManagementView) { InfraManagementView view = (InfraManagementView) part; // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); }/*from www. ja v a 2 s. com*/ if (selection != null && selection.size() == 1) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.CopyInfraModuleAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraModuleView) { InfraModuleView view = (InfraModuleView) part.getAdapter(InfraModuleView.class); if (view == null) { m_log.info("execute: view is null"); return; }/* w ww . jav a 2s. c o m*/ // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && selection.size() == 1) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.DeleteInfraFileAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); boolean enable = false; if (part instanceof InfraFileManagerView) { InfraFileManagerView view = (InfraFileManagerView) part.getAdapter(InfraFileManagerView.class); if (view == null) { m_log.info("execute: view is null"); return; }//from w w w .j a v a 2s . c om StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && selection.size() >= 1) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.DeleteInfraManagementAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraManagementView) { InfraManagementView view = (InfraManagementView) part; // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); }//from w w w .j av a2s . com if (selection != null && selection.size() > 0) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.DownOrderInfraModuleAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraModuleView) { InfraModuleView view = (InfraModuleView) part.getAdapter(InfraModuleView.class); if (view == null) { m_log.info("execute: view is null"); return; }/* w w w.j ava 2 s . c o m*/ // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && selection.size() == 1 && view.getComposite().getTable().getItemCount() > 1 && (int) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraModuleTableDefine.ORDER_NO) < view.getComposite().getTable() .getItemCount()) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.ModifyInfraManagementAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraManagementView) { InfraManagementView view = (InfraManagementView) part.getAdapter(InfraManagementView.class); if (view == null) { m_log.info("execute: view is null"); return; }//from w ww . j a v a 2s.co m // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && selection.size() == 1) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.ReviewCheckStatusAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraModuleView) { InfraModuleView view = (InfraModuleView) part.getAdapter(InfraModuleView.class); if (view == null) { m_log.info("execute: view is null"); return; }//from w w w .j a v a 2 s . com // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && 1 == selection.size()) { // Only enable when result exists (= String length > 0 ) String result = (String) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraModuleTableDefine.CHECK_CONDITION); if (null != result) { enable = true; } } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.infra.view.action.UpOrderInfraModuleAction.java
License:Open Source License
@Override public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { boolean enable = false; IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); // page may not start at state restoring if (null != window) { IWorkbenchPage page = window.getActivePage(); if (null != page) { IWorkbenchPart part = page.getActivePart(); if (part instanceof InfraModuleView) { InfraModuleView view = (InfraModuleView) part.getAdapter(InfraModuleView.class); if (view == null) { m_log.info("execute: view is null"); return; }//from w w w . j a va2 s .c o m // Enable button when 1 item is selected StructuredSelection selection = null; if (view.getComposite().getTableViewer().getSelection() instanceof StructuredSelection) { selection = (StructuredSelection) view.getComposite().getTableViewer().getSelection(); } if (selection != null && selection.size() == 1 && view.getComposite().getTable().getItemCount() > 1 && (int) ((ArrayList<?>) selection.getFirstElement()) .get(GetInfraModuleTableDefine.ORDER_NO) > 1) { enable = true; } } this.setBaseEnabled(enable); } else { this.setBaseEnabled(false); } } }
From source file:com.clustercontrol.jobmanagement.composite.action.JobHistorySelectionChangedListener.java
License:Open Source License
/** * ??????<BR>/* w ww. j av a2s .com*/ * []??????<BR> * ?????????? * <P> * <ol> * <li>?????????????</li> * <li>?????[]?????</li> * </ol> * * @param event ? * * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) */ @Override public void selectionChanged(SelectionChangedEvent event) { //[]?? IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); IWorkbenchPart viewPart = page.getActivePart(); //?? StructuredSelection selection = (StructuredSelection) event.getSelection(); if (viewPart instanceof JobHistoryView && selection != null) { JobHistoryView view = (JobHistoryView) viewPart.getAdapter(JobHistoryView.class); if (view == null) { m_log.info("selection changed: view is null"); return; } //[]???/??? view.setEnabledAction(selection.size(), selection); } }