public void createControl(Composite parent) { Composite pageContent = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; pageContent.setLayout(layout); pageContent.setLayoutData(new GridData(GridData.FILL_BOTH)); // variable never used ... is pageContent.getLayoutData() needed? // GridData outerFrameGridData = (GridData) pageContent.getLayoutData(); // outerFrameGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL; // outerFrameGridData.verticalAlignment = GridData.VERTICAL_ALIGN_FILL; // WorkbenchHelp.setHelp( // pageContent, // B2BGUIContextIds.BTBG_SELECT_MULTI_FILE_PAGE); createLabels(pageContent); createSourceViewer(pageContent); createButtonPanel(pageContent); createSelectedListBox(pageContent); createImportButton(pageContent); setControl(pageContent); if (isFileMandatory) setPageComplete(false); }
public void createURLControl(Composite composite) { Group group = new Group(composite, SWT.NONE); String projectLabel = PHPServerUIMessages.getString("ServerTab.url"); // $NON-NLS-1$ group.setText(projectLabel); group.setLayout(new GridLayout(2, false)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); autoGeneratedURL = new Button(group, SWT.CHECK); autoGeneratedURL.setText( PHPServerUIMessages.getString("ServerTab.autoGenerate")); // $NON-NLS-1$ autoGeneratedURL.setSelection(true); autoGeneratedURL.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1)); autoGeneratedURL.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { initializeURLControl(); updateLaunchConfigurationDialog(); } }); fURLLabel = new Label(group, SWT.NONE); fURLLabel.setText(PHPServerUIMessages.getString("ServerTab.urlLabel")); // $NON-NLS-1$ GridData gridData = new GridData(); gridData.horizontalIndent = 20; gridData.horizontalSpan = 1; fURLLabel.setLayoutData(gridData); Composite urlComposite = new Composite(group, SWT.NONE); urlComposite.setLayout(new GridLayout(2, false)); urlComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fURLHost = new Text(urlComposite, SWT.SINGLE | SWT.BORDER); fURLHost.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fURLHost.setEnabled(false); fURLPath = new Text(urlComposite, SWT.SINGLE | SWT.BORDER); fURLPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fURLPath.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { updateLaunchConfigurationDialog(); } }); }
private void createButtonPanel(Composite pageContent) { Composite buttonPanel = new Composite(pageContent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; buttonPanel.setLayout(layout); GridData gridData = new GridData(); gridData.grabExcessHorizontalSpace = false; gridData.grabExcessVerticalSpace = true; gridData.verticalAlignment = GridData.CENTER; gridData.horizontalAlignment = GridData.CENTER; buttonPanel.setLayoutData(gridData); addButton = new Button(buttonPanel, SWT.PUSH); addButton.setText(Messages._UI_ADD_BUTTON); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; addButton.setLayoutData(gridData); addButton.addSelectionListener(new ButtonSelectListener()); addButton.setToolTipText(Messages._UI_ADD_BUTTON_TOOL_TIP); addButton.setEnabled(false); removeButton = new Button(buttonPanel, SWT.PUSH); removeButton.setText(Messages._UI_REMOVE_BUTTON); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; removeButton.setLayoutData(gridData); removeButton.addSelectionListener(new ButtonSelectListener()); removeButton.setToolTipText(Messages._UI_REMOVE_BUTTON_TOOL_TIP); removeButton.setEnabled(false); removeAllButton = new Button(buttonPanel, SWT.PUSH); removeAllButton.setText(Messages._UI_REMOVE_ALL_BUTTON); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalAlignment = GridData.CENTER; removeAllButton.setLayoutData(gridData); removeAllButton.addSelectionListener(new ButtonSelectListener()); removeAllButton.setToolTipText(Messages._UI_REMOVE_ALL_BUTTON_TOOL_TIP); removeAllButton.setEnabled(false); }
/** @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(Composite) */ public void createControl(Composite parent) { ScrolledCompositeImpl scrolledComposite = new ScrolledCompositeImpl(parent, SWT.V_SCROLL); Composite composite = new Composite(scrolledComposite, SWT.NONE); composite.setLayout(new GridLayout(1, false)); createServerControl(composite); createFileComponent(composite); createURLControl(composite); createExtensionControls(composite); Dialog.applyDialogFont(composite); scrolledComposite.setContent(composite); Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolledComposite.setMinSize(size.x, size.y); PlatformUI.getWorkbench() .getHelpSystem() .setHelp(parent, IPHPHelpContextIds.DEBUGGING_A_PHP_WEB_PAGE); setControl(scrolledComposite); }
protected void createServerSelectionControl(Composite parent) { Group group = new Group(parent, SWT.NONE); group.setText(PHPServerUIMessages.getString("ServerTab.server")); // $NON-NLS-1$ GridLayout ly = new GridLayout(1, false); ly.marginHeight = 0; ly.marginWidth = 0; group.setLayout(ly); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite phpServerComp = new Composite(group, SWT.NONE); phpServerComp.setLayout(new GridLayout(4, false)); phpServerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); phpServerComp.setFont(parent.getFont()); Label label = new Label(phpServerComp, SWT.WRAP); GridData data = new GridData(GridData.BEGINNING); data.widthHint = 100; label.setLayoutData(data); label.setFont(parent.getFont()); label.setText(PHPServerUIMessages.getString("ServerLaunchConfigurationTab.0")); // $NON-NLS-1$ serverCombo = new Combo(phpServerComp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); serverCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleServerSelection(); } }); createNewServer = createPushButton( phpServerComp, PHPServerUIMessages.getString("ServerTab.new"), null); // $NON-NLS-1$ createNewServer.addSelectionListener(fListener); configureServers = createPushButton( phpServerComp, PHPServerUIMessages.getString("ServerTab.configure"), null); //$NON-NLS-1$ configureServers.addSelectionListener(fListener); servers = new ArrayList<Server>(); populateServerList(servers); // initialize the servers list if (!servers.isEmpty()) { for (int i = 0; i < servers.size(); i++) { Server svr = servers.get(i); serverCombo.add(svr.getName()); } } // select first item in list if (serverCombo.getItemCount() > 0) { serverCombo.select(0); } serverCombo.forceFocus(); }
@Override public void createControl(final Composite parent) { Composite container = new Composite(parent, SWT.NULL); GridLayout layout = new GridLayout(); container.setLayout(layout); layout.numColumns = 3; layout.verticalSpacing = 9; Label label = new Label(container, SWT.NULL); label.setText("&Container:"); containerText = new Text(container, SWT.BORDER | SWT.SINGLE); GridData gd = new GridData(GridData.FILL_HORIZONTAL); containerText.setLayoutData(gd); containerText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialogChanged(); } }); Button button = new Button(container, SWT.PUSH); button.setText("Browse..."); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { handleBrowse(); } }); label = new Label(container, SWT.NULL); label.setText("&Choose a model:"); Composite middleComposite = new Composite(container, SWT.NULL); FillLayout fillLayout = new FillLayout(); middleComposite.setLayout(fillLayout); emptyModelButton = new Button(middleComposite, SWT.RADIO); emptyModelButton.setText("Empty"); emptyModelButton.setSelection(true); skeletonModelButton = new Button(middleComposite, SWT.RADIO); skeletonModelButton.setText("Skeleton"); exampleModelButton = new Button(middleComposite, SWT.RADIO); exampleModelButton.setText("Example"); emptyModelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { typeOfModel = "empty"; radioChanged(); } }); exampleModelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { typeOfModel = "example"; radioChanged(); } }); skeletonModelButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { typeOfModel = "skeleton"; radioChanged(); } }); /* Need to add empty label so the next controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&File name:"); fileText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); fileText.setLayoutData(gd); fileText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { Text t = (Text) e.getSource(); String fname = t.getText(); int i = fname.lastIndexOf(".gaml"); if (i > 0) { // model title = filename less extension less all non alphanumeric characters titleText.setText(fname.substring(0, i).replaceAll("[^\\p{Alnum}]", "")); } /* * else if (fname.length()>0) { * int pos = t.getSelection().x; * fname = fname.replaceAll("[[^\\p{Alnum}]&&[^_-]&&[^\\x2E]]", "_"); * t.setText(fname+".gaml"); * t.setSelection(pos); * } else { * t.setText("new.gaml"); * } */ dialogChanged(); } }); /* Need to add empty label so the next two controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&Author:"); authorText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); authorText.setLayoutData(gd); authorText.setText(getComputerFullName()); authorText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialogChanged(); } }); /* Need to add empty label so the next two controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&Model name:"); titleText = new Text(container, SWT.BORDER | SWT.SINGLE); gd = new GridData(GridData.FILL_HORIZONTAL); titleText.setLayoutData(gd); titleText.setText("new"); titleText.addModifyListener( new ModifyListener() { @Override public void modifyText(final ModifyEvent e) { dialogChanged(); } }); /* Need to add empty label so the next two controls are pushed to the next line in the grid. */ label = new Label(container, SWT.NULL); label.setText(""); label = new Label(container, SWT.NULL); label.setText("&Model description:"); descriptionText = new Text(container, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); descriptionText.setBounds(0, 0, 250, 100); gd = new GridData(SWT.FILL, SWT.FILL, true, false); gd.verticalSpan = 4; descriptionText.setLayoutData(gd); /* * Need to add seven empty labels in order to push next controls after the descriptionText * box. */ // TODO Dirty!! Change the way to do this for (int i = 0; i < 7; i++) { label = new Label(container, SWT.NULL); label.setText(""); } label = new Label(container, SWT.NULL); label.setText("&Create a html template \nfor the model description ?"); middleComposite = new Composite(container, SWT.NULL); fillLayout = new FillLayout(); middleComposite.setLayout(fillLayout); yesButton = new Button(middleComposite, SWT.RADIO); yesButton.setText("Yes"); yesButton.setSelection(true); Button noButton = new Button(middleComposite, SWT.RADIO); noButton.setText("No"); yesButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent se) { dialogChanged(); } }); /* Finished adding the custom control */ initialize(); dialogChanged(); setControl(container); }