Example usage for org.eclipse.jface.dialogs TrayDialog closeTray

List of usage examples for org.eclipse.jface.dialogs TrayDialog closeTray

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs TrayDialog closeTray.

Prototype

public void closeTray() throws IllegalStateException 

Source Link

Document

Closes this dialog's tray, disposing its widgets.

Usage

From source file:de.walware.ecommons.debug.ui.HelpRequestor.java

License:Open Source License

public static void closeHelpTray(final TrayDialog dialog) {
    if (dialog.getTray() instanceof HelpRequestor.InfoTray) {
        dialog.closeTray();
    }/*ww w .ja v  a2 s .c  o m*/
}

From source file:eu.esdihumboldt.hale.ui.function.internal.NewRelationPage.java

License:Open Source License

@Override
public void performHelp() {
    IContext helpContext = getHelpContext();

    if (helpContext == null) {
        TrayDialog trayDialog = (TrayDialog) getContainer();
        if (trayDialog.getTray() != null) {
            trayDialog.closeTray();
        }/*from w  w w . ja  v a 2s. co  m*/
    } else {
        PlatformUI.getWorkbench().getHelpSystem().displayHelp(helpContext);
    }
}

From source file:eu.esdihumboldt.hale.ui.functions.groovy.internal.GroovyASTTray.java

License:Open Source License

/**
 * Show the AST viewer in the wizard tray.
 * //from  w w w .  j  a v  a 2 s . c  om
 * @param page the associated wizard page
 * @param viewer the associated viewer with the Groovy source or
 *            <code>null</code>
 */
public static void showTray(final HaleWizardPage<?> page, final CompilingSourceViewer<GroovyAST> viewer) {
    if (page.getContainer() instanceof TrayDialog) {
        TrayDialog dialog = (TrayDialog) page.getContainer();

        // close existing tray
        if (dialog.getTray() != null) {
            dialog.closeTray();
        }

        dialog.openTray(new GroovyASTTray(viewer));
    } else {
        // TODO show dialog instead?
    }
}

From source file:eu.esdihumboldt.hale.ui.functions.groovy.internal.JoinTypeStructureTray.java

License:Open Source License

/**
 * //w  ww.  j  a v  a 2 s.  c om
 * Creates a tool item
 * 
 * @param bar a toolbar
 * @param page hale wizard page
 * @param schemaSpace schema space
 * @param types type provider
 */
public static void createToolItem(ToolBar bar, final HaleWizardPage<?> page, final SchemaSpaceID schemaSpace,
        final TypeProvider types) {

    ToolItem item = new ToolItem(bar, SWT.PUSH);

    item.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SOURCE_SCHEMA));
    item.setToolTipText("Show source structure");

    item.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (page.getContainer() instanceof TrayDialog) {
                TrayDialog dialog = (TrayDialog) page.getContainer();

                // close existing tray
                if (dialog.getTray() != null) {
                    dialog.closeTray();
                }
                ParameterValue param = CellUtil.getFirstParameter(
                        ((GenericTypeFunctionWizard) page.getWizard()).getUnfinishedCell(),
                        JoinFunction.PARAMETER_JOIN);

                dialog.openTray(new JoinTypeStructureTray(param, types, schemaSpace));
            } else {
                // TODO show dialog instead?
            }
        }
    });

}

From source file:eu.esdihumboldt.hale.ui.functions.groovy.internal.PageFunctions.java

License:Open Source License

/**
 * Creates a tool item for a helper function dialog page
 * /*from   ww w.j a  va2s .  c  o m*/
 * @param toolbar the tool bar
 * @param page the dialog page
 */
public static void createToolItem(ToolBar toolbar, final HaleWizardPage<?> page) {
    ToolItem item = new ToolItem(toolbar, SWT.PUSH);
    item.setToolTipText("Show functions");
    item.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_FUNCTION));
    item.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (page.getContainer() instanceof TrayDialog) {
                TrayDialog tray = (TrayDialog) page.getContainer();
                if (tray.getTray() != null) {
                    tray.closeTray();
                }
                tray.openTray(new PageFunctions());
            }

        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            // do nothing

        }
    });

}

From source file:eu.esdihumboldt.hale.ui.functions.groovy.internal.TypeStructureTray.java

License:Open Source License

/**
 * Create a tool item for displaying the source or target type structure in
 * the dialog tray./*w ww  .  ja  v  a 2  s .  c om*/
 * 
 * @param bar the tool bar to add the item to
 * @param page the associated wizard page
 * @param types the provider for the types to display
 * @param schemaSpace the schema space
 */
public static void createToolItem(ToolBar bar, final HaleWizardPage<?> page, final SchemaSpaceID schemaSpace,
        final TypeProvider types) {
    ToolItem item = new ToolItem(bar, SWT.PUSH);
    switch (schemaSpace) {
    case SOURCE:
        item.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_SOURCE_SCHEMA));
        item.setToolTipText("Show source structure");
        break;
    case TARGET:
        item.setImage(CommonSharedImages.getImageRegistry().get(CommonSharedImages.IMG_TARGET_SCHEMA));
        item.setToolTipText("Show target structure");
        break;
    }
    item.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (page.getContainer() instanceof TrayDialog) {
                TrayDialog dialog = (TrayDialog) page.getContainer();

                // close existing tray
                if (dialog.getTray() != null) {
                    dialog.closeTray();
                }

                dialog.openTray(new TypeStructureTray(types, schemaSpace));
            } else {
                // TODO show dialog instead?
            }
        }
    });
}

From source file:eu.esdihumboldt.hale.ui.HaleWizardPage.java

License:Open Source License

/**
 * @see DialogPage#performHelp()//from www  .ja  va  2s .  c  om
 */
@Override
public void performHelp() {
    boolean closed = false;
    if (getContainer() instanceof TrayDialog) {
        TrayDialog trayDialog = (TrayDialog) getContainer();
        if (trayDialog.getTray() != null) {
            closed = trayDialog.getTray().getClass().getSimpleName().equals("HelpTray");
            trayDialog.closeTray();
        }
    }
    if (!closed && getHelpContext() != null)
        PlatformUI.getWorkbench().getHelpSystem().displayHelp(getHelpContext());
}

From source file:org.eclipse.help.ui.internal.CloseHelpTrayHandler.java

License:Open Source License

/**
 * Executes the command.//from   w ww  .  j  a  v  a  2 s.  c  o m
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    Display display = Display.getCurrent();
    if (display == null) {
        display = Display.getDefault();
    }
    if (display != null) {
        Shell shell = Display.getCurrent().getActiveShell();
        if (shell != null && !shell.isDisposed()) {
            Object shellData = shell.getData();
            if (shellData instanceof TrayDialog) {
                TrayDialog trayDialog = (TrayDialog) shellData;
                if (trayDialog.getTray() instanceof HelpTray) {
                    trayDialog.closeTray();
                }
            }
        }
    }
    return null;
}

From source file:org.eclipse.help.ui.internal.views.HelpTray.java

License:Open Source License

/**
 * Creates any actions needed by the tray.
 *///from  ww w. j  a v a  2s .c  o m
private void createActions() {
    createImages();
    closeAction = new ContributionItem() {
        public void fill(ToolBar parent, int index) {
            final ToolItem item = new ToolItem(parent, SWT.PUSH);
            item.setImage(normal);
            item.setHotImage(hover);
            item.setToolTipText(Messages.ReusableHelpPart_closeAction_tooltip);
            item.addListener(SWT.Selection, new Listener() {
                public void handleEvent(Event event) {
                    // close the tray
                    TrayDialog dialog = (TrayDialog) shell.getData();
                    dialog.closeTray();
                }
            });
        }
    };
}