1:主要ViewPart代码
package XXXX;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Panel;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
import com.teamcenter.rac.aif.AbstractAIFUIApplication;
import com.teamcenter.rac.aif.kernel.InterfaceAIFComponent;
import com.teamcenter.rac.aifrcp.AIFUtility;
import com.teamcenter.rac.common.tcviewer.TCViewerPanel;
import com.teamcenter.rac.kernel.TCComponent;
import com.teamcenter.rac.kernel.TCComponentBOMLine;
import com.teamcenter.rac.kernel.TCComponentDataset;
import com.teamcenter.rac.kernel.TCComponentItemRevision;
import com.teamcenter.rac.kernel.TCException;
public class JTViewPart extends ViewPart {
private TCViewerPanel tcViewerPanel;
private AbstractAIFUIApplication app = AIFUtility.getCurrentApplication();
private InterfaceAIFComponent targetComponent=app.getTargetComponent();
@Override
public void createPartControl(Composite paramComposite) {
// TODO Auto-generated method stub
tcViewerPanel = new TCViewerPanel();
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null) {
page.getWorkbenchWindow().getShell().setMaximized(true);
}
Composite composite = new Composite(paramComposite, SWT.EMBEDDED);
Frame frame = SWT_AWT.new_Frame(composite);
Panel contentPane = new Panel(new BorderLayout(0, 0));
contentPane.setBackground(new Color(212, 208, 200));
frame.add(contentPane);
Display display = PlatformUI.getWorkbench().getDisplay();
display.asyncExec(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try {
tcViewerPanel.setInput(“数据集”);
} catch (TCException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
contentPane.add(tcViewerPanel);
}
@Override
public void setFocus() {
// TODO Auto-generated method stub
}
}
2:如何在plugin.xml中配置
https://blog.csdn.net/qq_36880602/article/details/105824552