@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = (IFile) i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = (IFile) i.next(); } return result; } return null; }
@SuppressWarnings("unchecked") IFile[] getLocations(ISelection selection) { if (selection != null && (selection instanceof StructuredSelection)) { StructuredSelection ss = (StructuredSelection) selection; IFile[] result = new IFile[ss.size()]; int n = 0; for (Iterator<IFile> i = ss.iterator(); i.hasNext();) { result[n++] = i.next(); } return result; } return null; }
private int getSelectionCount() { return ((StructuredSelection)treeViewer.getSelection()).size(); }
/** * @return the index of the selection if a single item is * selected. If zero or multiple are selected, -1 is * returned */ private int getSingleSelectionIndex() { StructuredSelection sel = (StructuredSelection) treeViewer.getSelection(); if (sel.size() != 1) { return -1; } GroupLaunchElement el = ((GroupLaunchElement) sel .getFirstElement()); return input.indexOf(el); }
@Override protected void updateButtonsEnableState(IStatus status) { super.updateButtonsEnableState(status); if (showInButton != null && !showInButton.isDisposed() && openWithButton != null && !openWithButton.isDisposed()) { openWithButton.setEnabled(!status.matches(IStatus.ERROR) && getSelectedItems().size() == 1); showInButton.setEnabled(!status.matches(IStatus.ERROR) && getSelectedItems().size() > 0); } }
public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) DriverPreferences.this.mTreeViewer .getSelection(); if (selection != null && selection.size() > 0 && selection.getFirstElement() != null) updateButtons (selection.getFirstElement()); else updateButtons ( null ); }
protected void handleSelected(StructuredSelection selection) { super.handleSelected(selection); if (selection.size() == 0 && fTypeWizardPage.getSuperInterfaces().size() > fOldContent.size()) { // overrides updateStatus() from handleSelected() if // list of super interfaces was modified // the <code>super.handleSelected(selection)</code> has to be // called, because superclass implementation of this class updates // state of the table. updateStatus(new Status(IStatus.OK, JavaPlugin.getPluginId(), IStatus.OK, "", null)); //$NON-NLS-1$ getButton(ADD_ID).setEnabled(false); } else { // if selection isn't empty, the add button should be enabled in // exactly the same scenarios as the OK button getButton(ADD_ID).setEnabled(getButton(OK).isEnabled()); } }
protected void handleDoubleClick() { StructuredSelection selection = (StructuredSelection) fTreeViewer.getSelection(); if (selection.size() == 1) { BundleDescription desc = getBundleDescription(selection.getFirstElement()); if (desc != null) ManifestEditor.openPluginEditor(desc); } }
@Override protected void handleSelected(StructuredSelection selection) { super.handleSelected(selection); if (selection.size() == 0 && getSuperTypeCount(this.typeWizardPage) > this.oldContent.size()) { // overrides updateStatus() from handleSelected() if // list of super interfaces was modified // the <code>super.handleSelected(selection)</code> has to be // called, because superclass implementation of this class updates // state of the table. updateStatus(Status.OK_STATUS); getButton(ADD_ID).setEnabled(false); } else { // if selection isn't empty, the add button should be enabled in // exactly the same scenarios as the OK button getButton(ADD_ID).setEnabled(getButton(OK).isEnabled()); } }
@Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); if (selection.size() > 1) { m_cursorManager.getCursor().setVisible(false); } else { m_cursorManager.getCursor().setVisible(true); } } });
private void reactOnSelection(ISelection selection) { if (selection instanceof StructuredSelection) { StructuredSelection ssel = (StructuredSelection) selection; if (ssel.size() != 1) return; if (ssel.getFirstElement() instanceof IResource) showResource((IResource) ssel.getFirstElement()); if (ssel.getFirstElement() instanceof IAdaptable) { IResource adapted = (IResource) ((IAdaptable) ssel .getFirstElement()).getAdapter(IResource.class); if (adapted != null) showResource(adapted); } } }
public void run(IAction action) { if (selection instanceof StructuredSelection) { StructuredSelection struct = (StructuredSelection)selection; if (struct.size() > 0) { Object o = struct.getFirstElement(); if (o instanceof IAdaptable) { IProject project = (IProject)((IAdaptable)o).getAdapter(IProject.class); if(project != null) { RenameFileExtensionsDialog dialog = new RenameFileExtensionsDialog(AspectJUIPlugin.getDefault().getDisplay().getActiveShell(), project); dialog.open(); } } } } }