Example usage for org.eclipse.jface.viewers IStructuredSelection size

List of usage examples for org.eclipse.jface.viewers IStructuredSelection size

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers IStructuredSelection size.

Prototype

public int size();

Source Link

Document

Returns the number of elements selected in this selection.

Usage

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean swingLaunchApplies(IStructuredSelection selection) {
    if (selection.size() == 1) {
        if (selection.getFirstElement() instanceof WorkflowProject)
            return true;
    }/*from   ww w .ja  v a 2  s  .c  o  m*/
    return false;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean newMenuApplies(IStructuredSelection selection) {
    if (selection.size() == 0) {
        return true; // need to be able to create new workflow projects
    } else if (selection.size() == 1 && selection.getFirstElement() instanceof WorkflowElement) {
        WorkflowElement element = (WorkflowElement) selection.getFirstElement();
        if (element.isArchived())
            return false;
        else if (element instanceof Folder)
            return false;
        else if (element instanceof AutomatedTestSuite)
            return false;
        else if (element instanceof AutomatedTestCase)
            return !((AutomatedTestCase) element).isLegacy();
        else if (element instanceof LegacyExpectedResults)
            return false;
        else if (element instanceof File)
            return false;
        else/*from   w  ww .j  a  v  a2  s  .co  m*/
            return true;
    }
    return false;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean importMenuApplies(IStructuredSelection selection) {
    if (selection.size() == 0) {
        return true; // need to be able to import workflow projects
    } else if (selection.size() == 1 && selection.getFirstElement() instanceof WorkflowElement) {
        WorkflowElement element = (WorkflowElement) selection.getFirstElement();
        if (element.isArchived())
            return false;
        else if (element instanceof Folder)
            return false;
        else if (element instanceof AutomatedTestSuite)
            return false;
        else if (element instanceof AutomatedTestCase)
            return !((AutomatedTestCase) element).isLegacy();
        else if (element instanceof LegacyExpectedResults)
            return false;
        else if (element instanceof File)
            return false;
        else// w w w .j ava  2s  .  c o  m
            return true;
    }
    return false;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean formatFunctionTestResultsApplies(IStructuredSelection selection) {
    // enablement is governed by existance of test results
    return selection.size() == 1 && selection.getFirstElement() instanceof WorkflowProject;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean formatLoadTestResultsApplies(IStructuredSelection selection) {
    // enablement is governed by existance of test results
    return selection.size() == 1 && selection.getFirstElement() instanceof WorkflowProject;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean testApplies(IStructuredSelection selection) {
    return selection.size() == 1 && selection.getFirstElement() instanceof WorkflowProject;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean compareResultsApplies(IStructuredSelection selection) {
    if (selection.size() == 1) {
        if (selection.getFirstElement() instanceof AutomatedTestResults) {
            AutomatedTestResults expectedResults = (AutomatedTestResults) selection.getFirstElement();
            return expectedResults.getActualResults().exists();
        } else if (selection.getFirstElement() instanceof LegacyExpectedResults) {
            LegacyExpectedResults expectedResult = (LegacyExpectedResults) selection.getFirstElement();
            return expectedResult.getActualResult().exists();
        }//from   w  w  w .  j a  v a 2 s  .  co m
    }
    return false;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean openInstanceApplies(IStructuredSelection selection) {
    if (selection.size() == 1) {
        if (selection.getFirstElement() instanceof AutomatedTestResults) {
            AutomatedTestResults expectedResults = (AutomatedTestResults) selection.getFirstElement();
            return expectedResults.getActualResults().exists();
        } else if (selection.getFirstElement() instanceof LegacyExpectedResults) {
            LegacyExpectedResults expectedResult = (LegacyExpectedResults) selection.getFirstElement();
            return expectedResult.getActualResult().exists();
        }/*from  ww  w  .j  a va2 s .  com*/
    }
    return false;
}

From source file:com.centurylink.mdw.plugin.designer.views.ProcessExplorerActionGroup.java

License:Apache License

public boolean unlockApplies(IStructuredSelection selection) {
    if (selection.size() == 1) {
        if (selection.getFirstElement() instanceof WorkflowProject) {
            WorkflowProject workflowProject = (WorkflowProject) selection.getFirstElement();
            return workflowProject.isFilePersist() && workflowProject.isRemote();
        }/*  w w  w  .ja v  a 2s . c om*/
    }
    return false;
}

From source file:com.cisco.yangide.editor.templates.YangEditorTemplatesPage.java

License:Open Source License

protected void updateViewerInput() {
    IStructuredSelection selection = (IStructuredSelection) getTableViewer().getSelection();
    SourceViewer viewer = getViewer();//from  w w  w  . j a v a 2  s.c  o  m

    if (selection.size() == 1 && selection.getFirstElement() instanceof TemplatePersistenceData) {
        TemplatePersistenceData data = (TemplatePersistenceData) selection.getFirstElement();
        Template template = data.getTemplate();
        viewer.getDocument().set(template.getPattern());

    } else {
        viewer.getDocument().set("");
    }
}