List of usage examples for org.eclipse.jface.viewers IStructuredSelection isEmpty
public boolean isEmpty();
From source file:com.siteview.mde.internal.ui.shared.target.TargetLocationsGroup.java
License:Open Source License
private void updateButtons() { IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); fEditButton.setEnabled(!selection.isEmpty() && (selection.getFirstElement() instanceof IBundleContainer || selection.getFirstElement() instanceof IUWrapper)); // If any container is selected, allow the remove (the remove ignores non-container entries) boolean removeAllowed = false; boolean updateAllowed = false; Iterator iter = selection.iterator(); while (iter.hasNext()) { if (removeAllowed && updateAllowed) { break; }//ww w . j a v a 2 s . c om Object current = iter.next(); if (current instanceof IUBundleContainer) { updateAllowed = true; } if (current instanceof IBundleContainer) { removeAllowed = true; } if (current instanceof IUWrapper) { removeAllowed = true; updateAllowed = true; } } fRemoveButton.setEnabled(removeAllowed); fUpdateButton.setEnabled(updateAllowed); }
From source file:com.siteview.mde.internal.ui.views.dependencies.DependenciesViewPage.java
License:Open Source License
private Object getSelectedObject() { IStructuredSelection selection = getSelection(); if (selection.isEmpty() || selection.size() != 1) return null; return selection.getFirstElement(); }
From source file:com.siteview.mde.internal.ui.views.dependencies.DependenciesViewPage.java
License:Open Source License
protected void setSelection(IStructuredSelection selection) { if (selection != null && !selection.isEmpty()) fViewer.setSelection(selection, true); }
From source file:com.siteview.mde.internal.ui.views.plugins.CopyToClipboardAction.java
License:Open Source License
private boolean canCopy(IStructuredSelection selection) { if (selection.isEmpty()) return false; for (Iterator iter = selection.iterator(); iter.hasNext();) { Object obj = iter.next(); if (!(obj instanceof FileAdapter)) return false; }//from w ww . jav a 2s . c om return true; }
From source file:com.siteview.mde.internal.ui.views.plugins.PluginsView.java
License:Open Source License
private Object getSelectedObject() { IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); if (selection.isEmpty() || selection.size() != 1) return null; return selection.getFirstElement(); }
From source file:com.siteview.mde.internal.ui.views.plugins.PluginsView.java
License:Open Source License
public boolean isShowInApplicable() { IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); if (selection.isEmpty()) return false; for (Iterator iter = selection.iterator(); iter.hasNext();) { Object obj = iter.next(); if (!(obj instanceof IMonitorModelBase)) return false; if (((IMonitorModelBase) obj).getUnderlyingResource() == null) return false; }/*w ww. j av a 2s .co m*/ return true; }
From source file:com.siteview.mde.internal.ui.views.plugins.PluginsView.java
License:Open Source License
/** * Returns the <code>IShowInSource</code> for this view. * @return the <code>IShowInSource</code> *///from www.j a va2 s .c om protected IShowInSource getShowInSource() { return new IShowInSource() { public ShowInContext getShowInContext() { ArrayList resourceList = new ArrayList(); IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection(); IStructuredSelection resources; if (selection.isEmpty()) { resources = null; } else { for (Iterator iter = selection.iterator(); iter.hasNext();) { Object obj = iter.next(); if (obj instanceof IMonitorModelBase) { resourceList.add(((IMonitorModelBase) obj).getUnderlyingResource()); } } resources = new StructuredSelection(resourceList); } return new ShowInContext(fTreeViewer.getInput(), resources); } }; }
From source file:com.siteview.mde.internal.ui.wizards.extension.PointSelectionPage.java
License:Open Source License
public boolean canFinish() { if (fTemplateViewer != null) { ISelection selection = fTemplateViewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (!ssel.isEmpty()) return false; }/*from ww w . j a va 2s .co m*/ } if (fPointListViewer != null) { ISelection selection = fPointListViewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.isEmpty() == false) return true; } } return false; }
From source file:com.siteview.mde.internal.ui.wizards.extension.PointSelectionPage.java
License:Open Source License
public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel != null && !ssel.isEmpty()) { Object element = ssel.getFirstElement(); if (element instanceof WizardElement) handleTemplateSelection((WizardElement) element); else if (element instanceof IMonitorExtensionPoint) handlePointSelection((IMonitorExtensionPoint) element); } else {//from w ww.j a v a 2s .com setDescription(""); //$NON-NLS-1$ setDescriptionText(""); //$NON-NLS-1$ fTemplateLabel .setText(MDEUIMessages.NewExtensionWizard_PointSelectionPage_contributedTemplates_title); setPointDescriptionText(MDEUIMessages.PointSelectionPage_noDescAvailable); fDescLink.setText(NLS.bind(MDEUIMessages.PointSelectionPage_extPointDesc, "")); //$NON-NLS-1$ setSelectedNode(null); setPageComplete(false); } getContainer().updateButtons(); } }
From source file:com.siteview.mde.internal.ui.wizards.plugin.LibraryPluginJarsPage.java
License:Open Source License
private void handleRemove() { IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection(); if (!selection.isEmpty()) { for (Iterator it = selection.iterator(); it.hasNext();) { Object file = it.next(); fJarPaths.remove(file);/*from www . ja v a 2 s . c o m*/ fTableViewer.remove(file); } fRemove.setEnabled(fJarPaths.size() > 0); setPageComplete(fJarPaths.size() > 0); } }