下面列出了怎么用org.eclipse.ui.part.IContributedContentsView的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
if (adapter == IContributedContentsView.class) {
return this;
}
return super.getAdapter(adapter);
}
public Object getAdapter( Class key )
{
if ( key == IContributedContentsView.class )
return new IContributedContentsView( ) {
public IWorkbenchPart getContributingPart( )
{
return getCurrentContributingPart( );
}
};
return super.getAdapter( key );
}
public Object getAdapter( Class key )
{
if ( key == IContributedContentsView.class )
return new IContributedContentsView( ) {
public IWorkbenchPart getContributingPart( )
{
return getCurrentContributingPart( );
}
};
return super.getAdapter( key );
}
public Object getAdapter( Class key )
{
if ( key == IContributedContentsView.class )
{
return new IContributedContentsView( ) {
public IWorkbenchPart getContributingPart( )
{
return getCurrentContributingPart( );
}
};
}
return super.getAdapter( key );
}
/**
* Handle the part activated event.
*
* @param part
* the new activated part.
*/
protected void handlePartActivated(IWorkbenchPart part) {
/*
* The properties view has been activated and the current page is this
* instance of TabbedPropertySheetPage
*/
boolean thisActivated = part instanceof PropertySheet
&& ((PropertySheet) part).getCurrentPage() == this;
/*
* When the active part changes and the part does not provide a
* selection that affects this property sheet page, the PropertySheet
* does not send us a selectionChanged() event. We need to be informed
* of these events since we want to send aboutToBeHidden() and
* aboutToBeShown() when the property sheet is hidden or shown.
*/
if (!thisActivated && !part.equals(contributor)
&& !part.getSite().getId().equals(contributor.getContributorId())) {
/*
* Is the part is a IContributedContentsView for the contributor,
* for example, outline view.
*/
IContributedContentsView view = Adapters.adapt(part, IContributedContentsView.class);
if (view == null
|| (view.getContributingPart() != null && !view
.getContributingPart().equals(contributor))) {
if (activePropertySheet) {
if (currentTab != null) {
currentTab.aboutToBeHidden();
}
activePropertySheet = false;
}
return;
}
}
if (!activePropertySheet && currentTab != null) {
currentTab.aboutToBeShown();
currentTab.refresh();
}
activePropertySheet = true;
}