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:com.dubture.twig.ui.preferences.TwigSyntaxColoringPage.java

License:Open Source License

@Override
protected void performDefaults() {
    super.performDefaults();
    getOverlayStore().loadDefaults();//from www  . j  a  va  2 s.co  m
    applyStyles();
    fStylesViewer.setSelection(StructuredSelection.EMPTY);
    activate(null);
    fText.redraw();
}

From source file:com.dubture.twig.ui.preferences.TwigSyntaxColoringPage.java

License:Open Source License

private void selectColorAtOffset(int offset) {
    String namedStyle = getNamedStyleAtOffset(offset);
    if (namedStyle != null) {
        fStylesViewer.setSelection(new StructuredSelection(namedStyle));
        fStylesViewer.reveal(namedStyle);
    } else {/*from   w ww  . java2 s  . c om*/
        fStylesViewer.setSelection(StructuredSelection.EMPTY);
    }
    activate(namedStyle);
}

From source file:com.ebmwebsourcing.petals.common.internal.projectscnf.PetalsProjectNavigator.java

License:Open Source License

/**
 * Copies from {@link CommonNavigator}.//from   ww  w.j  a v a 2s  .  c o m
 * @param context
 * @return
 */
private IStructuredSelection getSelection(ShowInContext context) {

    if (context == null)
        return StructuredSelection.EMPTY;

    ISelection selection = context.getSelection();
    if (selection instanceof IStructuredSelection && !selection.isEmpty())
        return (IStructuredSelection) selection;

    Object input = context.getInput();
    if (input instanceof IEditorInput) {
        LinkHelperService lhs = getLinkHelperService();
        return lhs.getSelectionFor((IEditorInput) input);
    }

    if (input != null)
        return new StructuredSelection(input);

    return StructuredSelection.EMPTY;
}

From source file:com.github.jknack.antlr4ide.ui.railroad.RailroadSelectionProvider.java

License:Open Source License

@Override
public ISelection getSelection() {
    if (currentSelectedFigure != null) {
        return new StructuredSelection(currentSelectedFigure);
    } else {//from w w w  .  ja  va2 s. c om
        return StructuredSelection.EMPTY;
    }
}

From source file:com.google.code.t4eclipse.core.eclipse.helper.EclipseWizardHelper.java

License:Open Source License

/**
 * creates and opens a wizard/*ww  w  .j a v a 2  s  .c  o  m*/
 *
 * @param wizardID
 *            the ID of the wizard to create and open
 * @param selection
 *            the selection which is used to initialize the wizard
 * @param block
 *            true if it opens a model dialog
 */
@SuppressWarnings("null")
public IWorkbenchWizard openWizard(String wizardID, IStructuredSelection selection, final boolean block) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWizardDescriptor wizDesc = workbench.getNewWizardRegistry().findWizard(wizardID);
    //Assert.assertNotNull("wizard " + wizardID + " not found", wizDesc);

    IWorkbenchWizard wizard = null;
    try {
        wizard = wizDesc.createWizard();
    } catch (CoreException e) {
        e.printStackTrace();
    }
    // Assert.assertNotNull(wizard);
    //bugfix 02-11-2007
    if (selection == null)
        selection = StructuredSelection.EMPTY;

    wizard.init(workbench, selection);
    final WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
    dialog.create();

    final Semaphore sem = new Semaphore(0);

    dialog.getShell().getDisplay().syncExec(new Runnable() {
        public void run() {
            dialog.setBlockOnOpen(block);
            dialog.open();
            sem.release();
        }
    });

    try {
        sem.acquire();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    return wizard;
}

From source file:com.google.code.t4eclipse.tools.view.ActivePartControlView.java

License:Open Source License

public void showRootControl(Control rootControl) {
    headText.setText("");
    this.part = null;
    infoSashText.setText("");
    viewer.setSelection(StructuredSelection.EMPTY);
    viewer.setInput(new RootControlSelection(rootControl));
    viewer.expandAll();/* w  w w.j a  v a2 s .  co  m*/

}

From source file:com.google.code.t4eclipse.tools.view.ActivePartControlView.java

License:Open Source License

public void cleanContent() {
    if (!this.headText.isDisposed())
        this.headText.setText("");
    if (!this.infoSashText.isDisposed())
        this.infoSashText.setText("");
    if (!this.viewer.getTree().isDisposed()) {
        this.viewer.setSelection(StructuredSelection.EMPTY);
        this.viewer.setInput(null);
    }/*from   w  w  w . ja v a2 s .c o m*/

}

From source file:com.google.code.t4eclipse.tools.view.MenuAnalyzerView.java

License:Open Source License

@SuppressWarnings("unused")
public void update(Menu menu) {
    if (menu != null && !menu.isDisposed()) {
        // remove the following method will cause problem when reset input
        this.viewer.setSelection(StructuredSelection.EMPTY);
        this.viewer.setInput(menu);
        IViewSite site = (IViewSite) this.getSite();
    }//  www. j ava 2 s .  c o m
}

From source file:com.google.code.t4eclipse.tools.view.SytemImageView.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.horizontalSpacing = 0;/* w ww  . j  a  v a  2  s .  c  om*/
    layout.verticalSpacing = 0;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    createViewer(composite);
    viewer.setInput(SystemImageModel.getAllModels());

    getSite().setSelectionProvider(viewer);

    hookContextMenu();

    IActionBars actionBar = getViewSite().getActionBars();
    actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), this.CopyProgramAction);

    this.viewer.setSelection(StructuredSelection.EMPTY);
}

From source file:com.google.code.t4eclipse.tools.view.ToolBarAnalyzerView.java

License:Open Source License

public void update(ToolBar toolbar) {
    if (toolbar != null && !toolbar.isDisposed()) {
        // remove the following method will cause problem when reset input
        this.viewer.setSelection(StructuredSelection.EMPTY);
        this.viewer.setInput(toolbar);
    }//w  w w. jav  a  2  s .  c o  m
}