public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); parent.addControlListener( new ControlListener() { public void controlResized(ControlEvent e) { viewer.applyLayout(); } public void controlMoved(ControlEvent e) {} }); viewer = new GraphViewer(parent, SWT.NONE); viewer.setContentProvider(new XLogFlowContentProvider()); viewer.setLabelProvider(new XLogFlowLabelProvider()); viewer.setLayoutAlgorithm( new HorizontalTreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)); viewer.addDoubleClickListener( new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { StructuredSelection sel = (StructuredSelection) event.getSelection(); if (sel.getFirstElement() instanceof XLogConnection) { XLogData d = ((XLogConnection) sel.getFirstElement()).destXlog; String date = DateUtil.yyyymmdd(d.p.endTime); ArrayList<AgentObject> objList = agentProxy.getObjectList(date, d.serverId); for (AgentObject obj : objList) { if (obj.getObjHash() == d.p.objHash) { new OpenXLogProfileJob( XLogCallView.this.getViewSite().getShell().getDisplay(), d, d.serverId) .schedule(); break; } } } } }); }
@Override public void createPartControl(Composite parent) { viewer = new GraphViewer(parent, SWT.NONE); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setInput(getViewSite()); viewer.setLayoutAlgorithm(new TreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING)); ResourcesPlugin.getWorkspace() .addResourceChangeListener( new IResourceChangeListener() { public void resourceChanged(IResourceChangeEvent event) { Display.getDefault() .asyncExec( new Runnable() { public void run() { viewer.refresh(); viewer.applyLayout(); } }); } }); getSite().setSelectionProvider(viewer); // Create the help context id for the viewer's control PlatformUI.getWorkbench() .getHelpSystem() .setHelp(viewer.getControl(), "com.javadude.dependencies2.viewer"); }