public ISelection getSelection() { IStructuredContentProvider cp = (IStructuredContentProvider) getContentProvider(); Integer value = (Integer) editor.getValue(); return value == null || value.intValue() == -1 ? new StructuredSelection() : new StructuredSelection(cp.getElements(getInput())[value.intValue()]); }
public void setSelection(ISelection selection, boolean reveal) { if (selection == null || selection.isEmpty() || !(selection instanceof IStructuredSelection)) { editor.setValue(new Integer(-1)); } IStructuredContentProvider cp = (IStructuredContentProvider) getContentProvider(); Object value = ((IStructuredSelection) selection).getFirstElement(); Integer index = find(cp.getElements(getInput()), value); editor.setValue(index); }
public void refresh() { IStructuredContentProvider cp = (IStructuredContentProvider) getContentProvider(); ILabelProvider lp = (ILabelProvider) getLabelProvider(); Object[] elements = cp.getElements(getInput()); String[] items = new String[elements.length]; for (int i = 0; i < items.length; i++) { items[i] = lp.getText(elements[i]); } editor.setItems(items); }
/* * (non-Javadoc) * * @see org.xmind.gef.part.Part#getModelChildren(java.lang.Object) */ @Override protected Object[] getModelChildren(Object model) { IStructuredContentProvider contentProvider = (IStructuredContentProvider) getSite().getViewer().getAdapter(IStructuredContentProvider.class); if (contentProvider != null) { return contentProvider.getElements(model); } return super.getModelChildren(model); }
/** Add the new exception in the content pane */ private void addCustomException() { String customException = addNewExceptionField.getText().trim(); Object[] currentElements = contentProvider.getElements(inputElement); ArrayList<Object> currentElementsList = new ArrayList<Object>(); for (int i = 0; i < currentElements.length; ++i) { Object element = currentElements[i]; currentElementsList.add(element); } if (customException.isEmpty()) { return; } if (!currentElementsList.contains(customException)) { getViewer().add(customException); addNewExceptionField.setText(""); ((PyExceptionListProvider) contentProvider).addUserConfiguredException(customException); } else { IStatus status = new Status( IStatus.WARNING, DebugUIPlugin.getUniqueIdentifier(), "Duplicate: This exception already exists"); DebugUIPlugin.errorDialog( getShell(), DebugUIPlugin.removeAccelerators("Add Custom User Exception"), "Error", status); } }
/** * Show the types which are available in the current workspace. This includes all the open * projects ... */ protected void refreshFromWorkspace() { if (fTreeViewer != null) { fTreeViewer.setInput(null); } if (fWorkspaceObjects == null) { fWorkspaceObjects = resourceContentProvider.getElements(ResourcesPlugin.getWorkspace().getRoot()); } if (fFilteredList != null) { fFilteredList.setEnabled(true); fFilteredList.setAllowDuplicates(showDuplicates); fFilteredList.setElements(contentProvider.getElements(fWorkspaceObjects)); } }
/** * Refresh the available types from the BPEL imports list. This is the list of types/elements * visible in the process so far (the working set so to speak). */ protected void refreshFromImports() { List<?> elements = collectItemsFromImports(); if (fFilteredList != null) { fFilteredList.setAllowDuplicates(showDuplicates); fFilteredList.setElements(contentProvider.getElements(elements)); fFilteredList.setEnabled(true); } }
private void createLinks() { if (contentProvider == null) return; Object[] objects = contentProvider.getElements(getManagedForm().getInput()); for (int i = 0; i < objects.length; i++) { if (i == linkNumberLimit) break; createLink(objects[i]); } if (objects.length > linkNumberLimit) getManagedForm().getToolkit().createLabel(linkContainer, "...", SWT.NULL); // $NON-NLS-1$ updateMoreState(objects.length > linkNumberLimit); }
/** Show the types which are available in the current project only. */ protected void refreshFromProject() { if (fTreeViewer != null) { fTreeViewer.setInput(null); } if (fProjectObjects == null) { Resource resource = modelObject.eResource(); IFile file = BPELUtil.getFileFromURI(resource.getURI()); fProjectObjects = resourceContentProvider.getElements(file.getProject()); } if (fFilteredList != null) { fFilteredList.setEnabled(true); fFilteredList.setAllowDuplicates(showDuplicates); fFilteredList.setElements(contentProvider.getElements(fProjectObjects)); if (contentProvider.getElements(fProjectObjects) != null && contentProvider.getElements(fProjectObjects).length > 0) { updateLowerViewWidget(fFilteredList.getSelection()); } } }
/** * The <code>ListSelectionDialog</code> implementation of this <code>Dialog</code> method builds a * list of the selected elements for later retrieval by the client and closes this dialog. */ @Override protected void okPressed() { // Get the input children. Object[] children = contentProvider.getElements(inputElement); // Build a list of selected children. if (children != null) { ArrayList<Object> list = new ArrayList<Object>(); for (int i = 0; i < children.length; ++i) { Object element = children[i]; if (listViewer.getChecked(element)) { list.add(element); } } // If filter is on and checkedElements are not in filtered list // then content provider.getElements doesn't fetch the same if (selectedElements != null) { for (Object selectedElement : selectedElements) { if (!list.contains(selectedElement)) { list.add(selectedElement); } } } setResult(list); } // Save whether to break debugger or not on caught / uncaught exceptions handleCaughtExceptions = caughtExceptionCheck.getSelection(); handleUncaughtExceptions = uncaughtExceptionCheck.getSelection(); stopOnExceptionsHandledInSameContext = stopOnExceptionsHandledInSameContextCheck.getSelection(); ignoreExceptionsThrownInLinesWithIgnoreException = ignoreExceptionsThrownInLinesWithIgnoreExceptionCheck.getSelection(); PydevPlugin.getDefault() .getPreferenceStore() .setValue( AbstractPydevPrefs.TRACE_DJANGO_TEMPLATE_RENDER_EXCEPTIONS, breakOnDjangoTemplateExceptionsCheck.getSelection()); super.okPressed(); }
public Integer findIndex(Object value) { IStructuredContentProvider cp = (IStructuredContentProvider) getContentProvider(); return find(cp.getElements(getInput()), value); }
public Object findObject(Integer index) { IStructuredContentProvider cp = (IStructuredContentProvider) getContentProvider(); return index == null || index.intValue() == -1 ? null : cp.getElements(getInput())[index.intValue()]; }
private Object[] getListElements(Object element) { return filter(fListViewer.getFilters(), fListContentProvider.getElements(element)); }