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:net.bioclipse.cdk.ui.periodictable.PeriodicTableView.java

License:Open Source License

private void initSelection() {

    canvas.addMouseListener(new MouseAdapter() {
        @Override//w w w.j  av  a 2s  . c  o  m
        public void mouseDown(MouseEvent e) {

            String s = checkHit(new Point(e.x, e.y));
            if (s != null) {

                PeriodicTableElement element = new PeriodicTableElement(s);
                element.setProperty(CDKConstants.TITLE, PeriodicTable.getName(s));
                if (eptf != null) {
                    try {
                        eptf.configure(element);
                    } catch (CDKException e1) {
                        // if we cant configer ignore it
                    }
                }
                selection = new CDKChemObject<PeriodicTableElement>(element);
                setSelection(new StructuredSelection(selection));
            } else {
                selection = null;
                setSelection(StructuredSelection.EMPTY);
            }
            canvas.redraw();
        }
    });

}

From source file:net.bioclipse.cdk.ui.sdfeditor.editor.MoleculesEditor.java

License:Open Source License

private ISelection getSelectedRows() {
    //        viewer.getSelection();
    //        viewer.getTopRow();

    return StructuredSelection.EMPTY;

}

From source file:net.bioclipse.cdk.ui.sdfeditor.editor.MoleculeTableViewer.java

License:Open Source License

@Override
public ISelection getSelection() {

    if (getContentProvider() instanceof MoleculeTableContentProvider) {

        int[] selected = table.getSelectionModel().getSelectedRows();
        int max = getDataProvider().getRowCount();

        if (selected.length == 0) {
            currentSelected = -1;//from   w  w w.jav a 2  s  .  c om
            return StructuredSelection.EMPTY;
        }
        currentSelected = selected[0];

        IMoleculesEditorModel model;
        if (getInput() instanceof IMoleculesEditorModel) {
            model = (IMoleculesEditorModel) getInput();
            if (selected.length == 1) {
                return new StructuredSelection(new MolTableElement(selected[0], model));
            } else {

                return new StructuredSelection(new MolTableSelection(selected, model));
            }
        }
    }

    return StructuredSelection.EMPTY;
}

From source file:net.bioclipse.cdk.ui.sdfeditor.MoleculesOutlinePage.java

License:Open Source License

public ISelection getSelection() {
    if (viewer == null) {
        return StructuredSelection.EMPTY;
    }
    return viewer.getSelection();
}

From source file:net.bioclipse.cdk.ui.wizards.NewSdfWizard.java

License:Open Source License

/**
 * Adding the pages to the wizard.//from  w w w .  ja va  2 s . com
 */
public void addPages() {
    ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    if (sel instanceof IStructuredSelection) {
        newsdPage = new WizardNewFileCreationPage("newFilePage1", (IStructuredSelection) sel);
        newsdPage.setFileName(WizardHelper.findUnusedFileName((IStructuredSelection) sel, "unnamed", ".sdf"));
    } else {
        newsdPage = new WizardNewFileCreationPage("newFilePage1", StructuredSelection.EMPTY);
    }
    newsdPage.setTitle("Choose name and location for new file");
    newsdPage.setDescription("Extension will be .sdf if none is given");
    addPage(newsdPage);
    specPage = new SelectFilesWizardPage(true, sel);
    addPage(specPage);

}

From source file:net.bioclipse.chembl.moss.ui.wizard.ChemblMossWizard.java

License:Open Source License

public void addPages() {
    firstpage = new ChemblMossWizardPage1("ChEMBL MoSS page");
    addPage(firstpage);/*from w  w  w  .  j av a  2  s .  c  o m*/

    secondpage = new ChemblMossWizardPage2("ChEMBL MoSS page 2");
    addPage(secondpage);

    //      thirdpage = new ChemblMossWizardPage3("ChEMBL MoSS page 3");
    //      addPage(thirdpage);

    ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    if (sel instanceof IStructuredSelection) {
        filePage = new WizardNewFileCreationPage("newFilePage", (IStructuredSelection) sel);
        filePage.setFileName(WizardHelper.findUnusedFileName((IStructuredSelection) sel, "chemblMoss", ".txt"));
        //         queryfile = new WizardNewFileCreationPage("newFilePage", (IStructuredSelection) sel);
        //         queryfile.setFileName(WizardHelper.findUnusedFileName((IStructuredSelection)sel, "chemblMoss", ".sparql") );
    } else {
        filePage = new WizardNewFileCreationPage("newFilePage", StructuredSelection.EMPTY);
    }
    filePage.setTitle("Choose location and add a file name to create a new file");
    filePage.setDescription("Extension will be .txt if none is given");
    addPage(filePage);
}

From source file:net.bioclipse.chembl.ui.wizard.ChemblWizard.java

License:Open Source License

public void addPages() {
    firstpage = new ChemblWizardPage("ChEMBL page");
    addPage(firstpage);/* w w w  .  j av a  2  s.c  o m*/
    //        secondpage = new ChemblWizardPage2("ChEMBL page");
    //        addPage(secondpage);

    ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    if (sel instanceof IStructuredSelection) {
        filePage = new WizardNewFileCreationPage("newFilePage", (IStructuredSelection) sel);

        filePage.setFileName(WizardHelper.findUnusedFileName((IStructuredSelection) sel, "chembl", ".txt"));
    } else {
        filePage = new WizardNewFileCreationPage("newFilePage", StructuredSelection.EMPTY);
    }
    filePage.setTitle("Choose location and add a file name to create a new file");
    filePage.setDescription("Extension will be .txt if none is given");
    addPage(filePage);
}

From source file:net.bioclipse.qsar.ui.editors.QsarEditor.java

License:Open Source License

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

        updateProblemIndication = false;

        try {
            Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
        } catch (OperationCanceledException e1) {
            e1.printStackTrace();
        } catch (InterruptedException e1) {
            e1.printStackTrace();
        }

        try {
            ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
                public void run(IProgressMonitor monitor) throws CoreException {
                    for (Resource resource : changedResources) {
                        if (resource.isLoaded()) {
                            resource.unload();
                            try {
                                resource.load(Collections.EMPTY_MAP);
                                //                                                                       getQsarModel( resource );

                                QsarHelper.updateTransientProperties(getQsarModel(), getActiveProject());

                                //Force a page change to pick up model reload on page
                                setActivePage(getActivePage());
                            } catch (IOException exception) {
                                if (!resourceToDiagnosticMap.containsKey(resource)) {
                                    resourceToDiagnosticMap.put(resource,
                                            analyzeResourceProblems(resource, exception));
                                }
                            }
                        }
                    }
                }
            },
                    //                                               getProject(),
                    //                                               IWorkspace.AVOID_UPDATE,
                    new NullProgressMonitor());
        } catch (CoreException e) {
            e.printStackTrace();
        }

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

        updateProblemIndication = true;
        updateProblemIndication();
    }
}

From source file:net.bioclipse.seneca.wizard.NewSenecaJobWizard.java

License:Open Source License

/**
* Adding the pages to the wizard./*from   www.  java  2s .c  o m*/
*/

public void addPages() {
    ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    if (sel instanceof IStructuredSelection) {
        selectFilePage = new WizardNewFileCreationPage("newfile", (IStructuredSelection) sel);
        selectFilePage.setFileName(WizardHelper.findUnusedFileName((IStructuredSelection) sel, "unnamed", ""));
    } else {
        selectFilePage = new WizardNewFileCreationPage("newfile", StructuredSelection.EMPTY);
    }
    selectFilePage.setTitle("Choose name and location for new CASE project");
    selectFilePage.setDescription("Extension will be set to .sjs");
    addPage(selectFilePage);
}

From source file:net.certiv.fluentmark.outline.FluentOutlinePage.java

License:Open Source License

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