类org.eclipse.ui.part.WorkbenchPart源码实例Demo

下面列出了怎么用org.eclipse.ui.part.WorkbenchPart的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tracecompass   文件: TmfAnalysisViewOutput.java
@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$
        }
    });
}
 
源代码2 项目: tracecompass   文件: TmfAnalysisViewOutput.java
@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);
            }
        }
    }
}
 
源代码3 项目: APICloud-Studio   文件: FilenameDifferentiator.java
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);
	}
}
 
 类所在包
 同包方法