Search in sources :

Example 1 with PropertyShowInContext

use of org.eclipse.ui.views.properties.PropertyShowInContext in project tdi-studio-se by Talend.

the class StartMonitorJobAction method openPropertiesView.

/**
     * Opens the properties view.
     * 
     * @param jvm The JVM
     * @throws PartInitException
     */
private static void openPropertiesView(IActiveJvm jvm) throws PartInitException {
    PropertySheet view = (PropertySheet) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(IPageLayout.ID_PROP_SHEET, String.valueOf(new Date().getTime()), IWorkbenchPage.VIEW_ACTIVATE);
    // make sure to set the selection as an identifier of view
    PropertyShowInContext context = (PropertyShowInContext) view.getShowInContext();
    if (context.getSelection() == null) {
        RuntimeVisualizationView jvmExplorer = (RuntimeVisualizationView) context.getPart();
        if (jvmExplorer != null) {
            view.selectionChanged(jvmExplorer, jvmExplorer.getSelection());
        }
    }
}
Also used : PropertySheet(org.eclipse.ui.views.properties.PropertySheet) PropertyShowInContext(org.eclipse.ui.views.properties.PropertyShowInContext) Date(java.util.Date)

Example 2 with PropertyShowInContext

use of org.eclipse.ui.views.properties.PropertyShowInContext in project linuxtools by eclipse.

the class ShowInPropertiesViewCommandHandler method execute.

@Override
public Object execute(final ExecutionEvent event) {
    final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
    final List<IDockerContainer> containers = CommandUtils.getSelectedContainers(activePart);
    if (containers == null || containers.isEmpty()) {
        return null;
    }
    Display.getDefault().asyncExec(() -> {
        try {
            final PropertySheet propertySheet = (PropertySheet) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(// $NON-NLS-1$
            "org.eclipse.ui.views.PropertySheet");
            final PropertyShowInContext showInContext = new PropertyShowInContext(activePart, HandlerUtil.getCurrentSelection(event));
            propertySheet.show(showInContext);
        } catch (PartInitException e) {
            Activator.logErrorMessage(CommandMessages.getString(// $NON-NLS-1$
            "command.showIn.propertiesView.failure"), e);
        }
    });
    return null;
}
Also used : IDockerContainer(org.eclipse.linuxtools.docker.core.IDockerContainer) PropertySheet(org.eclipse.ui.views.properties.PropertySheet) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) PropertyShowInContext(org.eclipse.ui.views.properties.PropertyShowInContext) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

PropertySheet (org.eclipse.ui.views.properties.PropertySheet)2 PropertyShowInContext (org.eclipse.ui.views.properties.PropertyShowInContext)2 Date (java.util.Date)1 IDockerContainer (org.eclipse.linuxtools.docker.core.IDockerContainer)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 PartInitException (org.eclipse.ui.PartInitException)1