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:descent.internal.ui.wizards.buildpaths.newsourcepage.AddLibraryToBuildpathAction.java

License:Open Source License

public void selectionChanged(SelectionChangedEvent event) {
    ISelection selection = event.getSelection();
    if (selection instanceof IStructuredSelection) {
        setEnabled(canHandle((IStructuredSelection) selection));
    } else {//from ww  w . jav  a  2s . c o m
        setEnabled(canHandle(StructuredSelection.EMPTY));
    }
}

From source file:descent.internal.ui.wizards.buildpaths.newsourcepage.EditOutputFolderAction.java

License:Open Source License

public void selectionChanged(final SelectionChangedEvent event) {
    final ISelection selection = event.getSelection();
    if (selection instanceof IStructuredSelection) {
        setEnabled(canHandle((IStructuredSelection) selection));
    } else {/*from  w w  w. j  a va 2s. c o m*/
        setEnabled(canHandle(StructuredSelection.EMPTY));
    }
}

From source file:descent.ui.actions.AbstractOpenWizardAction.java

License:Open Source License

private IStructuredSelection evaluateCurrentSelection() {
    IWorkbenchWindow window = JavaPlugin.getActiveWorkbenchWindow();
    if (window != null) {
        ISelection selection = window.getSelectionService().getSelection();
        if (selection instanceof IStructuredSelection) {
            return (IStructuredSelection) selection;
        }/*w ww  . j a v  a2s  . c o m*/
    }
    return StructuredSelection.EMPTY;
}

From source file:distributed.plugin.ui.view.OverviewOutlinePage.java

License:Open Source License

/**
 * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
 */
public ISelection getSelection() {
    return StructuredSelection.EMPTY;
}

From source file:edu.duke.cs.ambient.internal.ui.actions.AmbientSelectionAction.java

License:Open Source License

/**
 * default constructor
 */
public AmbientSelectionAction() {
    fSelection = StructuredSelection.EMPTY;
}

From source file:edu.toronto.cs.se.mmint.mid.diagram.navigator.MIDNavigatorLinkHelper.java

License:Open Source License

/**
 * @generated/*from w  w  w  .  j av a 2s  .co  m*/
 */
public IStructuredSelection findSelection(IEditorInput anInput) {
    IDiagramDocument document = MIDDiagramEditorPlugin.getInstance().getDocumentProvider()
            .getDiagramDocument(anInput);
    if (document == null) {
        return StructuredSelection.EMPTY;
    }
    Diagram diagram = document.getDiagram();
    if (diagram == null || diagram.eResource() == null) {
        return StructuredSelection.EMPTY;
    }
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
        MIDNavigatorItem item = new MIDNavigatorItem(diagram, file, false);
        return new StructuredSelection(item);
    }
    return StructuredSelection.EMPTY;
}

From source file:edu.toronto.cs.se.mmint.mid.diagram.part.MIDDiagramEditor.java

License:Open Source License

/**
 * @generated/*from w w  w . ja  v a  2s .  co  m*/
 */
private ISelection getNavigatorSelection() {
    IDiagramDocument document = getDiagramDocument();
    if (document == null) {
        return StructuredSelection.EMPTY;
    }
    Diagram diagram = document.getDiagram();
    if (diagram == null || diagram.eResource() == null) {
        return StructuredSelection.EMPTY;
    }
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
        MIDNavigatorItem item = new MIDNavigatorItem(diagram, file, false);
        return new StructuredSelection(item);
    }
    return StructuredSelection.EMPTY;
}

From source file:edu.toronto.cs.se.mmint.mid.diagram.part.MIDNewDiagramFileWizard.java

License:Open Source License

/**
 * @generated/*from  www.j  a va 2  s .com*/
 */
public MIDNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot,
        TransactionalEditingDomain editingDomain) {
    assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$
    assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$
    assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$

    myFileCreationPage = new WizardNewFileCreationPage(Messages.MIDNewDiagramFileWizard_CreationPageName,
            StructuredSelection.EMPTY);
    myFileCreationPage.setTitle(Messages.MIDNewDiagramFileWizard_CreationPageTitle);
    myFileCreationPage.setDescription(
            NLS.bind(Messages.MIDNewDiagramFileWizard_CreationPageDescription, MIDEditPart.MODEL_ID));
    IPath filePath;
    String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment());
    if (domainModelURI.isPlatformResource()) {
        filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true));
    } else if (domainModelURI.isFile()) {
        filePath = new Path(domainModelURI.trimSegments(1).toFileString());
    } else {
        // TODO : use some default path
        throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
    }
    myFileCreationPage.setContainerFullPath(filePath);
    myFileCreationPage.setFileName(MIDDiagramEditorUtil.getUniqueFileName(filePath, fileName, "middiag")); //$NON-NLS-1$

    diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(
            Messages.MIDNewDiagramFileWizard_RootSelectionPageName);
    diagramRootElementSelectionPage.setTitle(Messages.MIDNewDiagramFileWizard_RootSelectionPageTitle);
    diagramRootElementSelectionPage
            .setDescription(Messages.MIDNewDiagramFileWizard_RootSelectionPageDescription);
    diagramRootElementSelectionPage.setModelElement(diagramRoot);

    myEditingDomain = editingDomain;
}

From source file:edu.toronto.cs.se.mmint.mid.relationship.diagram.part.MIDNewDiagramFileWizard.java

License:Open Source License

/**
* @generated/* w w  w.  j a  v  a 2 s  .  c om*/
*/
public MIDNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot,
        TransactionalEditingDomain editingDomain) {
    assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$
    assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$
    assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$

    myFileCreationPage = new WizardNewFileCreationPage(Messages.MIDNewDiagramFileWizard_CreationPageName,
            StructuredSelection.EMPTY);
    myFileCreationPage.setTitle(Messages.MIDNewDiagramFileWizard_CreationPageTitle);
    myFileCreationPage.setDescription(
            NLS.bind(Messages.MIDNewDiagramFileWizard_CreationPageDescription, ModelRelEditPart.MODEL_ID));
    IPath filePath;
    String fileName = URI.decode(domainModelURI.trimFileExtension().lastSegment());
    if (domainModelURI.isPlatformResource()) {
        filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true));
    } else if (domainModelURI.isFile()) {
        filePath = new Path(domainModelURI.trimSegments(1).toFileString());
    } else {
        // TODO : use some default path
        throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
    }
    myFileCreationPage.setContainerFullPath(filePath);
    myFileCreationPage
            .setFileName(MIDDiagramEditorUtil.getUniqueFileName(filePath, fileName, "relationshipdiag")); //$NON-NLS-1$

    diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(
            Messages.MIDNewDiagramFileWizard_RootSelectionPageName);
    diagramRootElementSelectionPage.setTitle(Messages.MIDNewDiagramFileWizard_RootSelectionPageTitle);
    diagramRootElementSelectionPage
            .setDescription(Messages.MIDNewDiagramFileWizard_RootSelectionPageDescription);
    diagramRootElementSelectionPage.setModelElement(diagramRoot);

    myEditingDomain = editingDomain;
}

From source file:edu.toronto.cs.se.modelepedia.classdiagram.diagram.navigator.ClassDiagramNavigatorLinkHelper.java

License:Open Source License

/**
* @generated//from   ww w. j  ava2 s . c  o m
*/
public IStructuredSelection findSelection(IEditorInput anInput) {
    IDiagramDocument document = ClassDiagramDiagramEditorPlugin.getInstance().getDocumentProvider()
            .getDiagramDocument(anInput);
    if (document == null) {
        return StructuredSelection.EMPTY;
    }
    Diagram diagram = document.getDiagram();
    if (diagram == null || diagram.eResource() == null) {
        return StructuredSelection.EMPTY;
    }
    IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
    if (file != null) {
        ClassDiagramNavigatorItem item = new ClassDiagramNavigatorItem(diagram, file, false);
        return new StructuredSelection(item);
    }
    return StructuredSelection.EMPTY;
}