org.eclipse.ui.part.WorkbenchPart Java Examples

The following examples show how to use org.eclipse.ui.part.WorkbenchPart. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TmfAnalysisViewOutput.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void requestOutput() {
    Display.getDefault().asyncExec(() -> {
        try {
            IViewPart view = openView();
            // Transfers the properties of this output to the view
            if (!(fProperties.isEmpty()) && (view instanceof WorkbenchPart)) {
                WorkbenchPart wbPart = (WorkbenchPart) view;
                for (String key : fProperties.keySet()) {
                    wbPart.setPartProperty(key, fProperties.get(key));
                }
            }
        } catch (final PartInitException e) {
            TraceUtils.displayErrorMsg(Messages.TmfAnalysisViewOutput_Title, "Error opening view " + getName() + e.getMessage()); //$NON-NLS-1$
            Activator.getDefault().logError("Error opening view " + getName(), e); //$NON-NLS-1$
        }
    });
}
 
Example #2
Source File: TmfAnalysisViewOutput.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void setOutputProperty(@NonNull String key, String value, boolean immediate) {
    if (value == null) {
        fProperties.remove(key);
    } else {
        fProperties.put(key, value);
        /*
         * If the property is immediate, we forward it to the view if the
         * view is active
         */
        if (immediate) {
            final IWorkbench wb = PlatformUI.getWorkbench();
            final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage();
            IViewPart view = activePage.findView(fViewId);
            if (view instanceof WorkbenchPart) {
                ((WorkbenchPart) view).setPartProperty(key, value);
            }
        }
    }
}
 
Example #3
Source File: FilenameDifferentiator.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private void setTitle(IEditorPart key, String value)
{
	try
	{
		Method m = WorkbenchPart.class.getDeclaredMethod("setPartName", String.class); //$NON-NLS-1$
		m.setAccessible(true);
		m.invoke(key, value);
	}
	catch (Exception e)
	{
		IdeLog.logError(CommonEditorPlugin.getDefault(), e);
	}
}