/** * Creates the widgets for specifying a agent name. * * @param parent - the parent composite. * @param text - the label of the group. */ protected void createAgentNameEditor(Composite parent, String text) { final Group group = SWTFactory.createGroup(parent, text, 2, 1, GridData.FILL_HORIZONTAL); this.agentNameTextField = SWTFactory.createSingleText(group, 1); this.agentNameTextField.addModifyListener( new ModifyListener() { @SuppressWarnings("synthetic-access") @Override public void modifyText(ModifyEvent event) { SARLMainLaunchConfigurationTab.this.lastAgentNameError = null; updateLaunchConfigurationDialog(); } }); ControlAccessibleListener.addListener(this.agentNameTextField, group.getText()); this.agentNameSearchButton = createPushButton(group, Messages.MainLaunchConfigurationTab_1, null); this.agentNameSearchButton.addSelectionListener( new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent event) { // } @Override public void widgetSelected(SelectionEvent event) { handleAgentNameSearchButtonSelected(); } }); }
/** * Creates the encoding component * * @param parent the parent to add this composite to */ private void createEncodingComponent(Composite parent) { Group group = SWTFactory.createGroup( parent, LaunchConfigurationsMessages.CommonTab_1, 2, 1, GridData.FILL_BOTH); fDefaultEncodingButton = createRadioButton(group, IInternalDebugCoreConstants.EMPTY_STRING); GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); gd.horizontalSpan = 2; fDefaultEncodingButton.setLayoutData(gd); fAltEncodingButton = createRadioButton(group, LaunchConfigurationsMessages.CommonTab_3); fAltEncodingButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); fEncodingCombo = new Combo(group, SWT.NONE); fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fEncodingCombo.setFont(parent.getFont()); List allEncodings = IDEEncoding.getIDEEncodings(); String[] encodingArray = (String[]) allEncodings.toArray(new String[0]); fEncodingCombo.setItems(encodingArray); if (encodingArray.length > 0) { fEncodingCombo.select(0); } fEncodingCombo .getAccessible() .addAccessibleListener( new AccessibleAdapter() { public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_3; } }); SelectionListener listener = new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (e.getSource() instanceof Button) { Button button = (Button) e.getSource(); if (button.getSelection()) { updateLaunchConfigurationDialog(); fEncodingCombo.setEnabled(fAltEncodingButton.getSelection() == true); } } else { updateLaunchConfigurationDialog(); } } }; fAltEncodingButton.addSelectionListener(listener); fDefaultEncodingButton.addSelectionListener(listener); fEncodingCombo.addSelectionListener(listener); fEncodingCombo.addKeyListener( new KeyAdapter() { /* * (non-Javadoc) * * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent) */ public void keyReleased(KeyEvent e) { scheduleUpdateJob(); } }); }
/** * Creates the widgets for configuring the launch options. * * @param parent - the parent composite. * @param text - the label of the group. */ protected void createLaunchOptionEditor(Composite parent, String text) { final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL); this.showLogoOptionButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_14); this.showLogoOptionButton.addSelectionListener(this.defaultListener); this.showLogInfoButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_15); this.showLogInfoButton.addSelectionListener(this.defaultListener); this.offlineButton = createCheckButton(group, Messages.MainLaunchConfigurationTab_16); this.offlineButton.addSelectionListener(this.defaultListener); }
/** * Creates the widgets for configuring the context identifier. * * @param parent - the parent composite. * @param text - the label of the group. */ protected void createContextIdentifierTypeEditor(Composite parent, String text) { final Group group = SWTFactory.createGroup(parent, text, 1, 1, GridData.FILL_HORIZONTAL); this.defaultContextIdentifierButton = createRadioButton(group, Messages.MainLaunchConfigurationTab_11); this.defaultContextIdentifierButton.addSelectionListener(this.defaultListener); this.randomContextIdentifierButton = createRadioButton(group, Messages.MainLaunchConfigurationTab_12); this.randomContextIdentifierButton.addSelectionListener(this.defaultListener); this.bootContextIdentifierButton = createRadioButton(group, Messages.MainLaunchConfigurationTab_13); this.bootContextIdentifierButton.addSelectionListener(this.defaultListener); }
/** * Creates the shared config component * * @param parent the parent composite to add this component to * @since 3.2 */ private void createSharedConfigComponent(Composite parent) { Group group = SWTFactory.createGroup( parent, LaunchConfigurationsMessages.CommonTab_0, 3, 2, GridData.FILL_HORIZONTAL); Composite comp = SWTFactory.createComposite(group, parent.getFont(), 3, 3, GridData.FILL_BOTH, 0, 0); fLocalRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_L_ocal_3); GridData gd = new GridData(); gd.horizontalSpan = 3; fLocalRadioButton.setLayoutData(gd); fSharedRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_S_hared_4); fSharedRadioButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { handleSharedRadioButtonSelected(); } }); fSharedLocationText = SWTFactory.createSingleText(comp, 1); fSharedLocationText .getAccessible() .addAccessibleListener( new AccessibleAdapter() { public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_S_hared_4; } }); fSharedLocationText.addModifyListener(fBasicModifyListener); fSharedLocationButton = createPushButton(comp, LaunchConfigurationsMessages.CommonTab__Browse_6, null); fSharedLocationButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent evt) { handleSharedLocationButtonSelected(); } }); fLocalRadioButton.setSelection(true); setSharedEnabled(false); }
/** * Creates the favorites control * * @param parent the parent composite to add this one to * @since 3.2 */ private void createFavoritesComponent(Composite parent) { Group favComp = SWTFactory.createGroup( parent, LaunchConfigurationsMessages.CommonTab_Display_in_favorites_menu__10, 1, 1, GridData.FILL_BOTH); fFavoritesTable = CheckboxTableViewer.newCheckList( favComp, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); Control table = fFavoritesTable.getControl(); GridData gd = new GridData(GridData.FILL_BOTH); table.setLayoutData(gd); table.setFont(parent.getFont()); fFavoritesTable.setContentProvider(new FavoritesContentProvider()); fFavoritesTable.setLabelProvider(new FavoritesLabelProvider()); fFavoritesTable.addCheckStateListener( new ICheckStateListener() { public void checkStateChanged(CheckStateChangedEvent event) { updateLaunchConfigurationDialog(); } }); }
/** * Creates the component set for the capture output composite * * @param parent the parent to add this component to */ private void createOutputCaptureComponent(Composite parent) { Group group = SWTFactory.createGroup( parent, LaunchConfigurationsMessages.CommonTab_4, 5, 2, GridData.FILL_HORIZONTAL); Composite comp = SWTFactory.createComposite(group, 5, 5, GridData.FILL_BOTH); GridLayout ld = (GridLayout) comp.getLayout(); ld.marginWidth = 1; ld.marginHeight = 1; fConsoleOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_5); GridData gd = new GridData(SWT.BEGINNING, SWT.NORMAL, true, false); gd.horizontalSpan = 5; fConsoleOutput.setLayoutData(gd); fConsoleOutput.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); fFileOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_6); fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false)); fFileOutput.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { enableOuputCaptureWidgets(fFileOutput.getSelection()); updateLaunchConfigurationDialog(); } }); fFileText = SWTFactory.createSingleText(comp, 4); fFileText .getAccessible() .addAccessibleListener( new AccessibleAdapter() { public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_6; } }); fFileText.addModifyListener(fBasicModifyListener); Composite bcomp = SWTFactory.createComposite(comp, 3, 5, GridData.HORIZONTAL_ALIGN_END); ld = (GridLayout) bcomp.getLayout(); ld.marginHeight = 1; ld.marginWidth = 0; fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null); fWorkspaceBrowse.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog( getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13); dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14); dialog.setInput(ResourcesPlugin.getWorkspace().getRoot()); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); dialog.setDialogBoundsSettings( getDialogBoundsSettings(WORKSPACE_SELECTION_DIALOG), Dialog.DIALOG_PERSISTSIZE); if (dialog.open() == IDialogConstants.OK_ID) { IResource resource = (IResource) dialog.getFirstResult(); if (resource != null) { String arg = resource.getFullPath().toString(); String fileLoc = VariablesPlugin.getDefault() .getStringVariableManager() .generateVariableExpression("workspace_loc", arg); // $NON-NLS-1$ fFileText.setText(fileLoc); } } } }); fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null); fFileBrowse.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { String filePath = fFileText.getText(); FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); filePath = dialog.open(); if (filePath != null) { fFileText.setText(filePath); } } }); fVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_9, null); fVariables.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); dialog.open(); String variable = dialog.getVariableExpression(); if (variable != null) { fFileText.insert(variable); } } public void widgetDefaultSelected(SelectionEvent e) {} }); fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11); gd = new GridData(SWT.LEFT, SWT.TOP, true, false); gd.horizontalSpan = 4; fAppend.setLayoutData(gd); fAppend.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); }