Example usage for org.eclipse.jface.viewers StructuredSelection EMPTY

List of usage examples for org.eclipse.jface.viewers StructuredSelection EMPTY

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers StructuredSelection EMPTY.

Prototype

StructuredSelection EMPTY

To view the source code for org.eclipse.jface.viewers StructuredSelection EMPTY.

Click Source Link

Document

The canonical empty selection.

Usage

From source file:bndtools.wizards.bndfile.NewBndFileWizardPage.java

License:Open Source License

public NewBndFileWizardPage(String pageName, IStructuredSelection selection) {
    super(pageName, selection != null ? selection : StructuredSelection.EMPTY);
    setTitle(Messages.NewBndFileWizardPage_title);
}

From source file:ca.uvic.chisel.diver.sequencediagrams.sc.java.editors.ThumbnailOutlinePage.java

License:Open Source License

public ISelection getSelection() {
    return StructuredSelection.EMPTY;
}

From source file:carisma.modeltype.bpmn2.extension.presentation.ExtensionEditor.java

License:Open Source License

/**
 * Handles what to do with changed resources on activation.
 * <!-- begin-user-doc -->/* w  w w.j  av a 2s  . c  om*/
 * <!-- end-user-doc -->
 * @generated
 */
protected void handleChangedResources() {
    if (!this.changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
        if (isDirty()) {
            this.changedResources.addAll(this.editingDomain.getResourceSet().getResources());
        }
        this.editingDomain.getCommandStack().flush();

        this.updateProblemIndication = false;
        for (Resource resource : this.changedResources) {
            if (resource.isLoaded()) {
                resource.unload();
                try {
                    resource.load(Collections.EMPTY_MAP);
                } catch (IOException exception) {
                    if (!this.resourceToDiagnosticMap.containsKey(resource)) {
                        this.resourceToDiagnosticMap.put(resource,
                                analyzeResourceProblems(resource, exception));
                    }
                }
            }
        }

        if (AdapterFactoryEditingDomain.isStale(this.editorSelection)) {
            setSelection(StructuredSelection.EMPTY);
        }

        this.updateProblemIndication = true;
        updateProblemIndication();
    }
}

From source file:carisma.modeltype.bpmn2.extension.presentation.ExtensionEditor.java

License:Open Source License

/**
 * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
 * is the current one.//from   w  ww  .  j  av  a2  s. c  o  m
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public void setCurrentViewer(Viewer viewer) {
    // If it is changing...
    //
    if (this.currentViewer != viewer) {
        if (this.selectionChangedListener == null) {
            // Create the listener on demand.
            //
            this.selectionChangedListener = new ISelectionChangedListener() {
                // This just notifies those things that are affected by the section.
                //
                @Override
                public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
                    setSelection(selectionChangedEvent.getSelection());
                }
            };
        }

        // Stop listening to the old one.
        //
        if (this.currentViewer != null) {
            this.currentViewer.removeSelectionChangedListener(this.selectionChangedListener);
        }

        // Start listening to the new one.
        //
        if (viewer != null) {
            viewer.addSelectionChangedListener(this.selectionChangedListener);
        }

        // Remember it.
        //
        this.currentViewer = viewer;

        // Set the editors selection based on the current viewer's selection.
        //
        setSelection(
                this.currentViewer == null ? StructuredSelection.EMPTY : this.currentViewer.getSelection());
    }
}

From source file:ccw.editors.outline.ClojureOutlinePage.java

License:Open Source License

/**
 * Find closest matching element to line
 * /*from w  w w .j  a va2  s . com*/
 * @param toFind
 *            line to find
 * @return
 */
protected StructuredSelection findClosest(int toFind) {
    Object selected = null;
    for (Object o : forms) {
        if (o instanceof Obj) {
            Obj obj = (Obj) o;
            int lineNr = getLineNr(obj);
            if (lineNr >= 0 && lineNr <= toFind) {
                selected = obj;
            }

        }
    }
    if (selected != null) {
        return new StructuredSelection(selected);
    }
    return StructuredSelection.EMPTY;
}

From source file:cg.editor.propertysheet.PropertySheetViewer.java

License:Open Source License

/**
 * The <code>PropertySheetViewer</code> implementation of this
 * <code>ISelectionProvider</code> method returns the result as a
 * <code>StructuredSelection</code>.
 * <p>//  ww w . j  av  a2 s .  c om
 * Note that this method only includes <code>IPropertySheetEntry</code> in
 * the selection (no categories).
 * </p>
 */
public ISelection getSelection() {
    if (tree.getSelectionCount() == 0) {
        return StructuredSelection.EMPTY;
    }
    TreeItem[] sel = tree.getSelection();
    List<IPropertySheetEntry> entries = new ArrayList<IPropertySheetEntry>(sel.length);
    for (int i = 0; i < sel.length; i++) {
        TreeItem ti = sel[i];
        Object data = ti.getData();
        if (data instanceof IPropertySheetEntry) {
            entries.add((IPropertySheetEntry) data);
        }
    }
    return new StructuredSelection(entries);
}

From source file:ch.elexis.core.findings.ui.views.nattable.NatTableWrapper.java

License:Open Source License

@Override
public ISelection getSelection() {
    if (!currentSelection.isEmpty()) {
        return new StructuredSelection(currentSelection);
    }//from   ww  w.j  ava  2  s . c om
    return StructuredSelection.EMPTY;
}

From source file:ch.elexis.core.ui.views.controls.DaysOrDateSelectionComposite.java

License:Open Source License

@Override
public ISelection getSelection() {
    if (dateValue != null) {
        return new StructuredSelection(dateValue);
    }//from  w w  w.  java 2  s  .  co m
    return StructuredSelection.EMPTY;
}

From source file:ch.elexis.core.ui.views.controls.GenericSelectionComposite.java

License:Open Source License

@Override
public ISelection getSelection() {
    if (selection != null) {
        return selection;
    }
    return StructuredSelection.EMPTY;
}

From source file:ch.elexis.core.ui.views.controls.TimeSpanSelectionComposite.java

License:Open Source License

@Override
public ISelection getSelection() {
    if (timeSpan != null) {
        return new StructuredSelection(timeSpan);
    }//  w w  w .  ja v  a 2  s.  c  o  m
    return StructuredSelection.EMPTY;
}