/** * Creates the SWT controls for this workbench part. * * @param parent the parent control */ public void createSection(Composite parent) { super.createSection(parent); FormToolkit toolkit = getFormToolkit(parent.getDisplay()); Section section = toolkit.createSection( parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | Section.DESCRIPTION | ExpandableComposite.FOCUS_TITLE); section.setText(Messages.configurationEditorPortsSection); section.setDescription(Messages.configurationEditorPortsDescription); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL)); // ports Composite composite = toolkit.createComposite(section); GridLayout layout = new GridLayout(); layout.marginHeight = 8; layout.marginWidth = 8; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL)); IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem(); whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_PORTS); toolkit.paintBordersFor(composite); section.setClient(composite); ports = toolkit.createTable(composite, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION); ports.setHeaderVisible(true); ports.setLinesVisible(true); whs.setHelp(ports, ContextIds.CONFIGURATION_EDITOR_PORTS_LIST); TableLayout tableLayout = new TableLayout(); TableColumn col = new TableColumn(ports, SWT.NONE); col.setText(Messages.configurationEditorPortNameColumn); ColumnWeightData colData = new ColumnWeightData(15, 150, true); tableLayout.addColumnData(colData); col = new TableColumn(ports, SWT.NONE); col.setText(Messages.configurationEditorPortValueColumn); colData = new ColumnWeightData(8, 80, true); tableLayout.addColumnData(colData); GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL); data.widthHint = 230; data.heightHint = 100; ports.setLayoutData(data); ports.setLayout(tableLayout); viewer = new TableViewer(ports); viewer.setColumnProperties(new String[] {"name", "port"}); initialize(); }
/* (non-Javadoc) * Initializes the editor part with a site and input. */ public void init(IEditorSite site, IEditorInput input) { super.init(site, input); TomcatServer ts = (TomcatServer) server.getAdapter(TomcatServer.class); try { tomcatConfiguration = ts.getTomcatConfiguration(); } catch (Exception e) { // ignore } addChangeListener(); initialize(); }