private void createOptionalDependenciesButton(Composite container) { if (isEditable()) { fIncludeOptionalButton = new Button(container, SWT.CHECK); fIncludeOptionalButton.setText(PDEUIMessages.PluginSection_includeOptional); // initialize value IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { fIncludeOptionalButton.setSelection( "true".equals(file.getPersistentProperty(OPTIONAL_PROPERTY))); // $NON-NLS-1$ } catch (CoreException e) { } } // create listener to save value when the checkbox is changed fIncludeOptionalButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IEditorInput input = getPage().getEditorInput(); if (input instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) input).getFile(); try { file.setPersistentProperty( OPTIONAL_PROPERTY, fIncludeOptionalButton.getSelection() ? "true" : null); // $NON-NLS-1$ } catch (CoreException e1) { } } } }); } }
/* (non-Javadoc) * @see org.eclipse.swt.widgets.Control#setEnabled(boolean) */ public void setEnabled(boolean enabled) { fTree.getControl().setEnabled(enabled); if (enabled) { updateButtons(); } else { fSelectButton.setEnabled(false); fSelectAllButton.setEnabled(false); fDeselectButton.setEnabled(false); fDeselectAllButton.setEnabled(false); fSelectRequiredButton.setEnabled(false); fCountLabel.setText(""); // $NON-NLS-1$ } fModeLabel.setEnabled(enabled); fPluginModeButton.setEnabled(enabled); fFeaureModeButton.setEnabled(enabled); fShowLabel.setEnabled(enabled); fShowPluginsButton.setEnabled(enabled); fShowSourceButton.setEnabled(enabled); boolean isPluginMode = !fFeaureModeButton.getSelection(); fGroupLabel.setEnabled(enabled && isPluginMode); if (fGroupCombo != null) { fGroupCombo.setEnabled(enabled && isPluginMode); } else { fGroupComboPart.setEnabled(enabled && isPluginMode); } }
private void createImpButtons(Composite container) { Composite buttonContainer = SWTFactory.createComposite(container, 1, 1, GridData.FILL_VERTICAL, 0, 0); fAddButton = SWTFactory.createPushButton(buttonContainer, PDEUIMessages.SourceBlock_add, null); fAddButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleAdd(); } }); fRemoveButton = SWTFactory.createPushButton(buttonContainer, PDEUIMessages.SourceBlock_remove, null); fRemoveButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleRemove(); } }); fRemoveAllButton = SWTFactory.createPushButton( buttonContainer, PDEUIMessages.TargetImplicitPluginsTab_removeAll3, null); fRemoveAllButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleRemoveAll(); } }); updateImpButtons(); }
public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_HORIZONTAL); section.setLayoutData(data); section.setText(PDEUIMessages.IntroSection_sectionText); section.setDescription(PDEUIMessages.IntroSection_sectionDescription); boolean canCreateNew = TargetPlatformHelper.getTargetVersion() >= NEW_INTRO_SUPPORT_VERSION; Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, canCreateNew ? 3 : 2)); client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = toolkit.createLabel(client, PDEUIMessages.IntroSection_introLabel, SWT.WRAP); GridData td = new GridData(); td.horizontalSpan = canCreateNew ? 3 : 2; label.setLayoutData(td); Label introLabel = toolkit.createLabel(client, PDEUIMessages.IntroSection_introInput); introLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fIntroCombo = new ComboPart(); fIntroCombo.createControl(client, toolkit, SWT.READ_ONLY); td = new GridData(GridData.FILL_HORIZONTAL); fIntroCombo.getControl().setLayoutData(td); loadManifestAndIntroIds(false); if (fAvailableIntroIds != null) fIntroCombo.setItems(fAvailableIntroIds); fIntroCombo.add(""); // $NON-NLS-1$ fIntroCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleSelection(); } }); if (canCreateNew) { Button button = toolkit.createButton(client, PDEUIMessages.IntroSection_new, SWT.PUSH); button.setEnabled(isEditable()); button.setLayoutData(new GridData(GridData.FILL)); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleNewIntro(); } }); } fIntroCombo.getControl().setEnabled(isEditable()); toolkit.paintBordersFor(client); section.setClient(client); // Register to be notified when the model changes getModel().addModelChangedListener(this); }
private void updateButtonEnablement(boolean doAddEnablement, boolean doRemoveEnablement) { updateCount(); int availableCount = fAvailableListViewer.getTable().getItemCount(); int importCount = fImportListViewer.getTable().getItemCount(); if (doAddEnablement) updateSelectionBasedEnablement(fAvailableListViewer.getSelection(), true); if (doRemoveEnablement) updateSelectionBasedEnablement(fImportListViewer.getSelection(), false); fAddAllButton.setEnabled(availableCount > 0); fRemoveAllButton.setEnabled(importCount > 0); fAddRequiredButton.setEnabled(importCount > 0); }
public JavaScriptSupportGroup(Composite composite, WizardPage projectWizardFirstPage) { final int numColumns = 3; fGroup = new Group(composite, SWT.NONE); fGroup.setFont(composite.getFont()); fGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fGroup.setLayout(initGridLayout(new GridLayout(numColumns, false), true)); fGroup.setText(PHPUIMessages.JavaScriptSupportGroup_OptionBlockTitle); // $NON-NLS-1$ fEnableJavaScriptSupport = new Button(fGroup, SWT.CHECK | SWT.RIGHT); fEnableJavaScriptSupport.setText( PHPUIMessages.JavaScriptSupportGroup_EnableSupport); // $NON-NLS-1$ fEnableJavaScriptSupport.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); fEnableJavaScriptSupport.addSelectionListener(this); fEnableJavaScriptSupport.setSelection( PHPUiPlugin.getDefault() .getPreferenceStore() .getBoolean((PreferenceConstants.JavaScriptSupportEnable))); }
private void createFilterOptions(Composite container) { fFilterOldVersionButton = SWTFactory.createCheckButton( container, PDEUIMessages.ImportWizard_DetailedPage_filterDesc, null, true, 1); if (getDialogSettings().get(SETTINGS_SHOW_LATEST) != null) fFilterOldVersionButton.setSelection(getDialogSettings().getBoolean(SETTINGS_SHOW_LATEST)); else fFilterOldVersionButton.setSelection(true); fFilterOldVersionButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fFilterOldVersionButton.getSelection()) { fAvailableListViewer.addFilter(fVersionFilter); } else { fAvailableListViewer.removeFilter(fVersionFilter); } updateCount(); } }); }
/** * Set the container to display in the tree or <code>null</code> to disable the tree * * @param input bundle container or <code>null</code> */ public void setInput(ITargetDefinition input) { fTargetDefinition = input; // Update the cached data fFileBundleMapping = null; fAllBundles.clear(); if (input == null || !input.isResolved()) { fTree.setInput(Messages.TargetContentsGroup_10); setEnabled(false); return; } IResolvedBundle[] allResolvedBundles = input.getAllBundles(); if (allResolvedBundles == null || allResolvedBundles.length == 0) { fTree.setInput(Messages.TargetContentsGroup_11); setEnabled(false); return; } for (int i = 0; i < allResolvedBundles.length; i++) { fAllBundles.add(allResolvedBundles[i]); } boolean isFeatureMode = ((TargetDefinition) fTargetDefinition).getUIMode() == TargetDefinition.MODE_FEATURE; fFeaureModeButton.setSelection(isFeatureMode); fPluginModeButton.setSelection(!isFeatureMode); fGroupLabel.setEnabled(!isFeatureMode); fTree.getControl().setRedraw(false); fTree.setInput(fTargetDefinition); fTree.expandAll(); updateCheckState(); updateButtons(); setEnabled(true); fTree.getControl().setRedraw(true); }
private Object[] getBundleChildren(Object parent) { Object[] result = null; if (parent == null) { result = fAllBundles.toArray(); } else if (fFeaureModeButton.getSelection() && parent == OTHER_CATEGORY) { result = ((TargetDefinition) fTargetDefinition).getOtherBundles(); } else if (fGrouping == GROUP_BY_CONTAINER && parent instanceof IBundleContainer) { IBundleContainer container = (IBundleContainer) parent; result = container.getBundles(); } else if (fGrouping == GROUP_BY_FILE_LOC && parent instanceof IPath) { List bundles = (List) getFileBundleMapping().get(parent); if (bundles != null && bundles.size() > 0) { result = bundles.toArray(); } } if (result == null) { return new Object[0]; } return result; }
private void updateCheckState() { List result = new ArrayList(); // Checked error statuses if (fMissing != null) { result.addAll(fMissing); } if (fFeaureModeButton.getSelection()) { // Checked features and plugins result.addAll(((TargetDefinition) fTargetDefinition).getFeaturesAndBundles()); } else { // Bundles with errors are already included from fMissing, do not add twice IResolvedBundle[] bundles = fTargetDefinition.getBundles(); for (int i = 0; i < bundles.length; i++) { if (bundles[i].getStatus().isOK()) { result.add(bundles[i]); } } } fTree.setCheckedElements(result.toArray()); }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#buttonSelected(int) */ protected void buttonSelected(int index) { switch (index) { case 0: handleAdd(); break; case 1: handleAddWorkingSet(); break; case 2: handleAddRequired(getProduct().getPlugins(), fIncludeOptionalButton.getSelection()); break; case 3: handleDelete(); break; case 4: handleRemoveAll(); break; case 5: handleProperties(); break; } }
private void createIconStyleGroup(final Composite parent) { Group group = new Group(parent, SWT.NONE); group.setLayout(new GridLayout()); GridData iconGroupData = new GridData(SWT.FILL, SWT.FILL, false, false); group.setLayoutData(iconGroupData); group.setText("SWT MessageBox Icon Styles"); iconErrorButton = new Button(group, SWT.RADIO); iconErrorButton.setText("SWT.ICON_ERROR"); iconInformationButton = new Button(group, SWT.RADIO); iconInformationButton.setText("SWT.ICON_INFORMATION"); iconQuestionButton = new Button(group, SWT.RADIO); iconQuestionButton.setText("SWT.ICON_QUESTION"); iconWarningButton = new Button(group, SWT.RADIO); iconWarningButton.setText("SWT.ICON_WARNING"); iconWorkingButton = new Button(group, SWT.RADIO); iconWorkingButton.setText("SWT.ICON_WORKING"); noIconButton = new Button(group, SWT.RADIO); noIconButton.setText("No Icon"); noIconButton.setSelection(true); }
private void createButtonStyleGroup(final Composite parent) { Group group = new Group(parent, SWT.NONE); group.setLayout(new GridLayout()); GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false); group.setLayoutData(layoutData); group.setText("SWT MessageBox Styles"); okButton = new Button(group, SWT.CHECK); okButton.setText("SWT.OK"); cancelButton = new Button(group, SWT.CHECK); cancelButton.setText("SWT.CANCEL"); yesButton = new Button(group, SWT.CHECK); yesButton.setText("SWT.YES"); noButton = new Button(group, SWT.CHECK); noButton.setText("SWT.NO"); retryButton = new Button(group, SWT.CHECK); retryButton.setText("SWT.RETRY"); abortButton = new Button(group, SWT.CHECK); abortButton.setText("SWT.ABORT"); ignoreButton = new Button(group, SWT.CHECK); ignoreButton.setText("SWT.IGNORE"); }
private void addFilters() { fVersionFilter = new VersionFilter(); fVersionFilter.setModel(fModels); fSourceFilter = new SourcePluginFilter(fPage1.getState()); fAvailableFilter = new AvailableFilter(); fAvailableListViewer.addFilter(fAvailableFilter); if (fFilterOldVersionButton.getSelection()) { fAvailableListViewer.addFilter(fVersionFilter); } fAvailableListViewer.addFilter(fSourceFilter); fRepositoryFilter = new RepositoryFilter(); fAvailableListViewer.addFilter(fRepositoryFilter); fFilterJob = new WorkbenchJob("FilterJob") { // $NON-NLS-1$ @Override public IStatus runInUIThread(IProgressMonitor monitor) { handleFilter(); return Status.OK_STATUS; } }; fFilterJob.setSystem(true); }
public void saveIncludedBundleState() { if (fFeaureModeButton.getSelection()) { // Create a list of checked bundle infos List included = new ArrayList(); int missingCount = 0; Object[] checked = fTree.getCheckedLeafElements(); for (int i = 0; i < checked.length; i++) { if (checked[i] instanceof IFeatureModel) { included.add( new NameVersionDescriptor( ((IFeatureModel) checked[i]).getFeature().getId(), null, NameVersionDescriptor.TYPE_FEATURE)); } if (checked[i] instanceof IResolvedBundle) { // Missing features are included as IResolvedBundles, save them as features instead if (((IResolvedBundle) checked[i]).getStatus().getCode() == IResolvedBundle.STATUS_PLUGIN_DOES_NOT_EXIST) { included.add( new NameVersionDescriptor( ((IResolvedBundle) checked[i]).getBundleInfo().getSymbolicName(), null, NameVersionDescriptor.TYPE_PLUGIN)); missingCount++; } else if (((IResolvedBundle) checked[i]).getStatus().getCode() == IResolvedBundle.STATUS_FEATURE_DOES_NOT_EXIST) { included.add( new NameVersionDescriptor( ((IResolvedBundle) checked[i]).getBundleInfo().getSymbolicName(), null, NameVersionDescriptor.TYPE_FEATURE)); missingCount++; } else { included.add( new NameVersionDescriptor( ((IResolvedBundle) checked[i]).getBundleInfo().getSymbolicName(), null)); } } } if (included.size() == 0) { fTargetDefinition.setIncluded(new NameVersionDescriptor[0]); } else if (included.size() == 0 || included.size() - missingCount == fTargetDefinition.getAllFeatures().length + ((TargetDefinition) fTargetDefinition).getOtherBundles().length) { fTargetDefinition.setIncluded(null); } else { fTargetDefinition.setIncluded( (NameVersionDescriptor[]) included.toArray(new NameVersionDescriptor[included.size()])); } } else { // Figure out if there are multiple bundles sharing the same id Set multi = new HashSet(); // BSNs of bundles with multiple versions available Set all = new HashSet(); for (Iterator iterator = fAllBundles.iterator(); iterator.hasNext(); ) { IResolvedBundle rb = (IResolvedBundle) iterator.next(); if (!all.add(rb.getBundleInfo().getSymbolicName())) { multi.add(rb.getBundleInfo().getSymbolicName()); } } // Create a list of checked bundle infos List included = new ArrayList(); Object[] checked = fTree.getCheckedLeafElements(); for (int i = 0; i < checked.length; i++) { if (checked[i] instanceof IResolvedBundle) { // Create the bundle info object String bsn = ((IResolvedBundle) checked[i]).getBundleInfo().getSymbolicName(); NameVersionDescriptor info = null; if (multi.contains(bsn)) { // include version info info = new NameVersionDescriptor( bsn, ((IResolvedBundle) checked[i]).getBundleInfo().getVersion()); } else { // don't store version info info = new NameVersionDescriptor(bsn, null); } included.add(info); } } if (included.size() == 0) { fTargetDefinition.setIncluded(new NameVersionDescriptor[0]); } else if (included.size() == fAllBundles.size() + fMissing.size()) { fTargetDefinition.setIncluded(null); } else { fTargetDefinition.setIncluded( (NameVersionDescriptor[]) included.toArray(new NameVersionDescriptor[included.size()])); } } }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.wizards.target.TargetDefinitionPage#targetChanged() */ protected void targetChanged(ITargetDefinition definition) { super.targetChanged(definition); if (definition != null) { // When If the page isn't open yet, try running a UI job so the dialog has time to finish // opening new UIJob(PDEUIMessages.TargetDefinitionContentPage_0) { public IStatus runInUIThread(IProgressMonitor monitor) { ITargetDefinition definition = getTargetDefinition(); if (!definition.isResolved()) { try { getContainer() .run( true, true, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { getTargetDefinition().resolve(new ResolutionProgressMonitor(monitor)); if (monitor.isCanceled()) { throw new InterruptedException(); } } }); } catch (InvocationTargetException e) { PDECore.log(e); } catch (InterruptedException e) { fContentTree.setCancelled(); return Status.CANCEL_STATUS; } } fContentTree.setInput(definition); fLocationTree.setInput(definition); if (definition.isResolved() && definition.getStatus().getSeverity() == IStatus.ERROR) { fLocationTab.setImage( PlatformUI.getWorkbench() .getSharedImages() .getImage(ISharedImages.IMG_OBJS_ERROR_TSK)); } else { fLocationTab.setImage(null); } return Status.OK_STATUS; } }.schedule(); String name = definition.getName(); if (name == null) { name = EMPTY_STRING; } if (name.trim().length() > 0) fNameText.setText(name); else setMessage(PDEUIMessages.TargetDefinitionContentPage_8); fLocationTree.setInput(definition); fContentTree.setInput(definition); String presetValue = (definition.getOS() == null) ? EMPTY_STRING : definition.getOS(); fOSCombo.setText(presetValue); presetValue = (definition.getWS() == null) ? EMPTY_STRING : definition.getWS(); fWSCombo.setText(presetValue); presetValue = (definition.getArch() == null) ? EMPTY_STRING : definition.getArch(); fArchCombo.setText(presetValue); presetValue = (definition.getNL() == null) ? EMPTY_STRING : LocaleUtil.expandLocaleName(definition.getNL()); fNLCombo.setText(presetValue); IPath jrePath = definition.getJREContainer(); if (jrePath == null || jrePath.equals(JavaRuntime.newDefaultJREContainerPath())) { fDefaultJREButton.setSelection(true); } else { String ee = JavaRuntime.getExecutionEnvironmentId(jrePath); if (ee != null) { fExecEnvButton.setSelection(true); fExecEnvsCombo.select(fExecEnvsCombo.indexOf(ee)); } else { String vm = JavaRuntime.getVMInstallName(jrePath); if (vm != null) { fNamedJREButton.setSelection(true); fNamedJREsCombo.select(fNamedJREsCombo.indexOf(vm)); } } } if (fExecEnvsCombo.getSelectionIndex() == -1) fExecEnvsCombo.setText(fExecEnvChoices.first().toString()); if (fNamedJREsCombo.getSelectionIndex() == -1) fNamedJREsCombo.setText(VMUtil.getDefaultVMInstallName()); updateJREWidgets(); presetValue = (definition.getProgramArguments() == null) ? EMPTY_STRING : definition.getProgramArguments(); fProgramArgs.setText(presetValue); presetValue = (definition.getVMArguments() == null) ? EMPTY_STRING : definition.getVMArguments(); fVMArgs.setText(presetValue); fElementViewer.refresh(); } }
/** * Creates the buttons in this group inside a new composite * * @param parent parent composite * @param toolkit toolkit to give form style or <code>null</code> for dialog style */ private void createButtons(Composite parent, FormToolkit toolkit) { if (toolkit != null) { Composite buttonComp = toolkit.createComposite(parent); GridLayout layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; buttonComp.setLayout(layout); buttonComp.setLayoutData(new GridData(GridData.FILL_VERTICAL)); fSelectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_0, SWT.PUSH); fSelectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDeselectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_1, SWT.PUSH); fDeselectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label emptySpace = new Label(buttonComp, SWT.NONE); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectAllButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_2, SWT.PUSH); fSelectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDeselectAllButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_3, SWT.PUSH); fDeselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); emptySpace = new Label(buttonComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectRequiredButton = toolkit.createButton(buttonComp, Messages.TargetContentsGroup_4, SWT.PUSH); fSelectRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite filterComp = toolkit.createComposite(buttonComp); layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; filterComp.setLayout(layout); filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true)); fModeLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing); fPluginModeButton = toolkit.createButton(filterComp, Messages.TargetContentsGroup_PluginMode, SWT.RADIO); fPluginModeButton.setSelection(true); fFeaureModeButton = toolkit.createButton(filterComp, Messages.TargetContentsGroup_FeatureMode, SWT.RADIO); fFeaureModeButton.setSelection(true); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fShowLabel = toolkit.createLabel(filterComp, Messages.BundleContainerTable_9); fShowPluginsButton = toolkit.createButton(filterComp, Messages.BundleContainerTable_14, SWT.CHECK); fShowPluginsButton.setSelection(true); fShowSourceButton = toolkit.createButton(filterComp, Messages.BundleContainerTable_15, SWT.CHECK); fShowSourceButton.setSelection(true); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fGroupLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_0); fGroupComboPart = new ComboPart(); fGroupComboPart.createControl(filterComp, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = 10; fGroupComboPart.getControl().setLayoutData(gd); fGroupComboPart.setItems( new String[] { Messages.TargetContentsGroup_1, Messages.TargetContentsGroup_2, Messages.TargetContentsGroup_3 }); fGroupComboPart.setVisibleItemCount(30); fGroupComboPart.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleGroupChange(); } }); fGroupComboPart.select(0); } else { Composite buttonComp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_VERTICAL, 0, 0); fSelectButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_0, null); fDeselectButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_1, null); Label emptySpace = new Label(buttonComp, SWT.NONE); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectAllButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_2, null); fDeselectAllButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_3, null); emptySpace = new Label(buttonComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fSelectRequiredButton = SWTFactory.createPushButton(buttonComp, Messages.TargetContentsGroup_4, null); Composite filterComp = SWTFactory.createComposite(buttonComp, 1, 1, SWT.NONE, 0, 0); filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true)); fModeLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing, 1); fPluginModeButton = SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_PluginMode); fFeaureModeButton = SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_FeatureMode); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fShowLabel = SWTFactory.createLabel(filterComp, Messages.BundleContainerTable_9, 1); fShowPluginsButton = SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_14, null, true, 1); fShowSourceButton = SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_15, null, true, 1); emptySpace = new Label(filterComp, SWT.NONE); gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.widthHint = gd.heightHint = 5; emptySpace.setLayoutData(gd); fGroupLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_0, 1); fGroupCombo = SWTFactory.createCombo( filterComp, SWT.READ_ONLY, 1, new String[] { Messages.TargetContentsGroup_1, Messages.TargetContentsGroup_2, Messages.TargetContentsGroup_3 }); gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalIndent = 10; fGroupCombo.setLayoutData(gd); fGroupCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleGroupChange(); } }); fGroupCombo.select(0); } fSelectButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fTree.getSelection().isEmpty()) { Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray(); for (int i = 0; i < selected.length; i++) { fTree.setChecked(selected[i], true); } saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update( fTargetDefinition.getBundleContainers(), new String[] {IBasicPropertyConstants.P_TEXT}); } } }); fDeselectButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fTree.getSelection().isEmpty()) { Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray(); for (int i = 0; i < selected.length; i++) { fTree.setChecked(selected[i], false); } saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update( fTargetDefinition.getBundleContainers(), new String[] {IBasicPropertyConstants.P_TEXT}); } } }); fSelectAllButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTree.setAllChecked(true); saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update( fTargetDefinition.getBundleContainers(), new String[] {IBasicPropertyConstants.P_TEXT}); } }); fDeselectAllButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fTree.setAllChecked(false); saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update( fTargetDefinition.getBundleContainers(), new String[] {IBasicPropertyConstants.P_TEXT}); } }); fSelectRequiredButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Object[] allChecked = fTree.getCheckedLeafElements(); Object[] required = null; if (fFeaureModeButton.getSelection()) { required = getRequiredFeatures(fTargetDefinition.getAllFeatures(), allChecked); } else { required = getRequiredPlugins(fAllBundles, allChecked); } for (int i = 0; i < required.length; i++) { fTree.setChecked(required[i], true); } saveIncludedBundleState(); contentChanged(); updateButtons(); fTree.update( fTargetDefinition.getBundleContainers(), new String[] {IBasicPropertyConstants.P_TEXT}); } }); fPluginModeButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // Moving from feature based filtering to plug-in based, need to update storage ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_PLUGIN); contentChanged(); fTargetDefinition.setIncluded(null); fGroupLabel.setEnabled(true); if (fGroupCombo != null) { fGroupCombo.setEnabled(true); } else { fGroupComboPart.getControl().setEnabled(true); } fTree.getControl().setRedraw(false); fTree.refresh(false); fTree.expandAll(); updateCheckState(); updateButtons(); fTree.getControl().setRedraw(true); } }); fPluginModeButton.setSelection(true); GridData gd = new GridData(); gd.horizontalIndent = 10; fPluginModeButton.setLayoutData(gd); fFeaureModeButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // Moving from plug-in based filtering to feature based, need to update storage ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_FEATURE); contentChanged(); fTargetDefinition.setIncluded(null); fGroupLabel.setEnabled(false); if (fGroupCombo != null) { fGroupCombo.setEnabled(false); } else { fGroupComboPart.getControl().setEnabled(false); } fTree.getControl().setRedraw(false); fTree.refresh(false); fTree.expandAll(); updateCheckState(); updateButtons(); fTree.getControl().setRedraw(true); } }); fFeaureModeButton.setSelection(false); gd = new GridData(); gd.horizontalIndent = 10; fFeaureModeButton.setLayoutData(gd); fShowPluginsButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fShowPluginsButton.getSelection()) { fTree.addFilter(fPluginFilter); } else { fTree.removeFilter(fPluginFilter); fTree.expandAll(); updateCheckState(); } updateButtons(); } }); fShowPluginsButton.setSelection(true); gd = new GridData(); gd.horizontalIndent = 10; fShowPluginsButton.setLayoutData(gd); fShowSourceButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (!fShowSourceButton.getSelection()) { fTree.addFilter(fSourceFilter); } else { fTree.removeFilter(fSourceFilter); fTree.expandAll(); updateCheckState(); } updateButtons(); } }); fShowSourceButton.setSelection(true); gd = new GridData(); gd.horizontalIndent = 10; fShowSourceButton.setLayoutData(gd); }
public boolean getSelection() { return fEnableJavaScriptSupport.getSelection(); }
private void updateButtons() { if (fTargetDefinition != null && !fTree.getSelection().isEmpty()) { Object[] selection = ((IStructuredSelection) fTree.getSelection()).toArray(); boolean hasResolveBundle = false; boolean hasParent = false; boolean allSelected = true; boolean noneSelected = true; for (int i = 0; i < selection.length; i++) { if (!hasResolveBundle || !hasParent) { if (selection[i] instanceof IResolvedBundle) { hasResolveBundle = true; } else { hasParent = true; } } boolean checked = fTree.getChecked(selection[i]); if (checked) { noneSelected = false; } else { allSelected = false; } } // Selection is available if not everything is already selected and not both a parent and // child item are selected fSelectButton.setEnabled(!allSelected && !(hasResolveBundle && hasParent)); fDeselectButton.setEnabled(!noneSelected && !(hasResolveBundle && hasParent)); } else { fSelectButton.setEnabled(false); fDeselectButton.setEnabled(false); } int total = fAllBundles.size(); if (fFeaureModeButton.getSelection()) { if (fTargetDefinition == null) { total = 0; } else { total = fTargetDefinition.getAllFeatures().length; total += ((TargetDefinition) fTargetDefinition).getOtherBundles().length; } } if (fMissing != null) { total += fMissing.size(); } fSelectAllButton.setEnabled(fTargetDefinition != null && fTree.getCheckedLeafCount() != total); fDeselectAllButton.setEnabled(fTargetDefinition != null && fTree.getCheckedLeafCount() != 0); fSelectRequiredButton.setEnabled( fTargetDefinition != null && fTree.getCheckedLeafCount() > 0 && fTree.getCheckedLeafCount() != total); if (fTargetDefinition != null) { fCountLabel.setText( MessageFormat.format( Messages.TargetContentsGroup_9, new String[] { Integer.toString(fTree.getCheckedLeafCount()), Integer.toString(total) })); } else { fCountLabel.setText(""); // $NON-NLS-1$ } }
private void updateImpButtons() { boolean empty = fElementViewer.getSelection().isEmpty(); fRemoveButton.setEnabled(!empty); boolean hasElements = fElementViewer.getTable().getItemCount() > 0; fRemoveAllButton.setEnabled(hasElements); }
private Control createArgumentsGroup(Composite parent) { Composite container = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH); SWTFactory.createWrapLabel(container, PDEUIMessages.JavaArgumentsTab_description, 1); Group programGroup = SWTFactory.createGroup( container, PDEUIMessages.JavaArgumentsTab_progamArgsGroup, 1, 1, GridData.FILL_HORIZONTAL); fProgramArgs = SWTFactory.createText( programGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, 1, 200, 60, GridData.FILL_BOTH); fProgramArgs.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { getTargetDefinition().setProgramArguments(fProgramArgs.getText().trim()); } }); Composite programButtons = SWTFactory.createComposite(programGroup, 1, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0); Button programVars = SWTFactory.createPushButton( programButtons, PDEUIMessages.JavaArgumentsTab_programVariables, null, GridData.HORIZONTAL_ALIGN_END); programVars.addSelectionListener(getVariablesListener(fProgramArgs)); Group vmGroup = new Group(container, SWT.NONE); vmGroup.setLayout(new GridLayout(1, false)); vmGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); vmGroup.setText(PDEUIMessages.JavaArgumentsTab_vmArgsGroup); vmGroup.setFont(container.getFont()); fVMArgs = SWTFactory.createText( vmGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, 1, 200, 60, GridData.FILL_BOTH); fVMArgs.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { getTargetDefinition().setVMArguments(fVMArgs.getText().trim()); } }); Composite buttons = SWTFactory.createComposite(vmGroup, 2, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0); Button vmArgs = SWTFactory.createPushButton( buttons, PDEUIMessages.JavaArgumentsTab_addVMArgs, null, GridData.HORIZONTAL_ALIGN_END); vmArgs.addSelectionListener(getVMArgsListener(fVMArgs)); Button vmVars = SWTFactory.createPushButton( buttons, PDEUIMessages.JavaArgumentsTab_vmVariables, null, GridData.HORIZONTAL_ALIGN_END); vmVars.addSelectionListener(getVariablesListener(fVMArgs)); return container; }
protected void updateJREWidgets() { fNamedJREsCombo.setEnabled(fNamedJREButton.getSelection()); fExecEnvsCombo.setEnabled(fExecEnvButton.getSelection()); }
protected void createExampleControls(final Composite parent) { parent.setLayout(new GridLayout()); Group group1 = new Group(parent, SWT.NONE); group1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group1.setText("JFace Dialogs"); group1.setLayout(new GridLayout(3, true)); // JFace input dialog Button showInputDlgButton = new Button(group1, SWT.PUSH); showInputDlgButton.setText("Input Dialog"); showInputDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showInputDialog(); } }); showInputDlgButton.setLayoutData(createGridDataFillBoth()); Button showProgressDlgButton = new Button(group1, SWT.PUSH); showProgressDlgButton.setText("ProgressDialog"); showProgressDlgButton.setLayoutData(createGridDataFillBoth()); showProgressDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { showProgressDialog(); } }); insertSpaceLabels(group1, 1); inputDlgResLabel = new Label(group1, SWT.WRAP); inputDlgResLabel.setText("Result:"); GridData gdInputDlgResLabel = new GridData(); gdInputDlgResLabel.horizontalSpan = 3; inputDlgResLabel.setLayoutData(gdInputDlgResLabel); Button showMessageInfoDlgButton = new Button(group1, SWT.PUSH); showMessageInfoDlgButton.setLayoutData(createGridDataFillBoth()); showMessageInfoDlgButton.setText("Info Message"); showMessageInfoDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showMessageDialogInfo(); } }); Button showMessageWarningDlgButton = new Button(group1, SWT.PUSH); showMessageWarningDlgButton.setLayoutData(createGridDataFillBoth()); showMessageWarningDlgButton.setText("Warning Dialog"); showMessageWarningDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showMessageDialogWarning(); } }); Button showMessageErrorDlgButton = new Button(group1, SWT.PUSH); showMessageErrorDlgButton.setLayoutData(createGridDataFillBoth()); showMessageErrorDlgButton.setText("Error Message"); showMessageErrorDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showMessageDialogError(); } }); Button showMessageQuestionDlgButton = new Button(group1, SWT.PUSH); showMessageQuestionDlgButton.setLayoutData(createGridDataFillBoth()); showMessageQuestionDlgButton.setText("Question Dialog"); showMessageQuestionDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showMessageDialogQuestion(); } }); Button showMessageConfirmDlgButton = new Button(group1, SWT.PUSH); showMessageConfirmDlgButton.setLayoutData(createGridDataFillBoth()); showMessageConfirmDlgButton.setText("Confirm Message"); showMessageConfirmDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showMessageDialogConfirm(); } }); insertSpaceLabels(group1, 1); messageDlgResLabel = new Label(group1, SWT.WRAP); messageDlgResLabel.setText("Result:"); insertSpaceLabels(group1, 2); Button showErrorDlgButton = new Button(group1, SWT.PUSH); showErrorDlgButton.setLayoutData(createGridDataFillBoth()); showErrorDlgButton.setText("Error Dialog"); showErrorDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showErrorDialog(); } }); insertSpaceLabels(group1, 2); errorDlgResLabel = new Label(group1, SWT.WRAP); errorDlgResLabel.setText("Result:"); insertSpaceLabels(group1, 2); Group group2 = new Group(parent, SWT.NONE); group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); group2.setText("Custom Dialogs"); group2.setLayout(new GridLayout(3, true)); Button showLoginDlgButton = new Button(group2, SWT.PUSH); showLoginDlgButton.setText("Login Dialog"); showLoginDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showLoginDialog(); } }); showLoginDlgButton.setLayoutData(createGridDataFillBoth()); insertSpaceLabels(group2, 2); loginDlgResLabel = new Label(group2, SWT.WRAP); loginDlgResLabel.setText("Result:"); Group swtDialogsGroup = new Group(parent, SWT.NONE); swtDialogsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); swtDialogsGroup.setText("SWT Dialogs"); swtDialogsGroup.setLayout(new GridLayout(3, true)); showMessageBoxDlgButton = new Button(swtDialogsGroup, SWT.PUSH); showMessageBoxDlgButton.setText("MessageBox Dialog"); showMessageBoxDlgButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent event) { showMessageBoxDialog(); } }); showMessageBoxDlgButton.setLayoutData(createGridDataFillBoth()); showColorDialogButton = new Button(swtDialogsGroup, SWT.PUSH); showColorDialogButton.setText("ColorDialog"); showColorDialogButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { showColorDialog(); } }); showColorDialogButton.setLayoutData(createGridDataFillBoth()); showFontDialogButton = new Button(swtDialogsGroup, SWT.PUSH); showFontDialogButton.setText("FontDialog"); showFontDialogButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(final SelectionEvent e) { showFontDialog(); } }); showFontDialogButton.setLayoutData(createGridDataFillBoth()); messageBoxDlgResLabel = new Label(swtDialogsGroup, SWT.WRAP); messageBoxDlgResLabel.setText("Result:"); GridData gdMessageBoxDlgResLabel = new GridData(); gdMessageBoxDlgResLabel.horizontalSpan = 3; messageBoxDlgResLabel.setLayoutData(gdMessageBoxDlgResLabel); }
private Composite createButtonArea(Composite parent) { ScrolledComposite comp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL); GridLayout layout = new GridLayout(); layout.marginWidth = layout.marginHeight = 0; comp.setLayoutData(new GridData(GridData.FILL_VERTICAL)); Composite container = new Composite(comp, SWT.NONE); layout = new GridLayout(); layout.marginWidth = 0; container.setLayout(layout); GridData gd = new GridData(GridData.FILL_VERTICAL); gd.verticalIndent = 15; container.setLayoutData(gd); Button button = new Button(container, SWT.PUSH); button.setText(PDEUIMessages.ImportWizard_DetailedPage_existing); button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleExistingProjects(); } }); SWTUtil.setButtonDimensionHint(button); button = new Button(container, SWT.PUSH); button.setText(PDEUIMessages.ImportWizard_DetailedPage_existingUnshared); button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleExistingUnshared(); } }); SWTUtil.setButtonDimensionHint(button); fAddButton = new Button(container, SWT.PUSH); fAddButton.setText(PDEUIMessages.ImportWizard_DetailedPage_add); fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAdd(); } }); SWTUtil.setButtonDimensionHint(fAddButton); fAddAllButton = new Button(container, SWT.PUSH); fAddAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addAll); fAddAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddAllButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAddAll(); } }); SWTUtil.setButtonDimensionHint(fAddAllButton); fRemoveButton = new Button(container, SWT.PUSH); fRemoveButton.setText(PDEUIMessages.ImportWizard_DetailedPage_remove); fRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fRemoveButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleRemove(); } }); SWTUtil.setButtonDimensionHint(fRemoveButton); fRemoveAllButton = new Button(container, SWT.PUSH); fRemoveAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_removeAll); fRemoveAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fRemoveAllButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleRemoveAll(); } }); SWTUtil.setButtonDimensionHint(fRemoveAllButton); button = new Button(container, SWT.PUSH); button.setText(PDEUIMessages.ImportWizard_DetailedPage_swap); button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); button.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleSwap(); } }); SWTUtil.setButtonDimensionHint(button); fAddRequiredButton = new Button(container, SWT.PUSH); fAddRequiredButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addRequired); fAddRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddRequiredButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { handleAddRequiredPlugins(); } }); SWTUtil.setButtonDimensionHint(fAddRequiredButton); fCountLabel = new Label(container, SWT.NONE); fCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); comp.setContent(container); comp.setMinHeight(250); comp.setExpandHorizontal(true); comp.setExpandVertical(true); return container; }
private void updateSelectionBasedEnablement(ISelection theSelection, boolean available) { if (available) fAddButton.setEnabled(!theSelection.isEmpty()); else fRemoveButton.setEnabled(!theSelection.isEmpty()); }
public boolean includeOptionalDependencies() { return fIncludeOptionalButton.getSelection(); }
private void createJREGroup(Composite container) { Group group = SWTFactory.createGroup( container, PDEUIMessages.EnvironmentBlock_jreTitle, 2, 1, GridData.FILL_HORIZONTAL); initializeJREValues(); SWTFactory.createWrapLabel(group, PDEUIMessages.JRESection_description, 2); fDefaultJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_defaultJRE, 2); fDefaultJREButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateJREWidgets(); getTargetDefinition().setJREContainer(JavaRuntime.newDefaultJREContainerPath()); } }); fNamedJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_JREName); fNamedJREButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateJREWidgets(); getTargetDefinition() .setJREContainer( JavaRuntime.newJREContainerPath( VMUtil.getVMInstall(fNamedJREsCombo.getText()))); } }); fNamedJREsCombo = SWTFactory.createCombo( group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY, 1, VMUtil.getVMInstallNames()); fNamedJREsCombo.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { getTargetDefinition() .setJREContainer( JavaRuntime.newJREContainerPath( VMUtil.getVMInstall(fNamedJREsCombo.getText()))); } }); fExecEnvButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_ExecutionEnv); fExecEnvButton.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { updateJREWidgets(); getTargetDefinition() .setJREContainer( JavaRuntime.newJREContainerPath( VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText()))); } }); fExecEnvsCombo = SWTFactory.createCombo( group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY, 1, fExecEnvChoices.toArray(new String[fExecEnvChoices.size()])); fExecEnvsCombo.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { getTargetDefinition() .setJREContainer( JavaRuntime.newJREContainerPath( VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText()))); } }); }
@Override public void storeSettings() { IDialogSettings settings = getDialogSettings(); settings.put(SETTINGS_SHOW_LATEST, fFilterOldVersionButton.getSelection()); super.storeSettings(); }
private void showMessageBoxDialog() { int style = getStyle(); if (okButton.getEnabled() && okButton.getSelection()) { style |= SWT.OK; } if (cancelButton.getEnabled() && cancelButton.getSelection()) { style |= SWT.CANCEL; } if (yesButton.getEnabled() && yesButton.getSelection()) { style |= SWT.YES; } if (noButton.getEnabled() && noButton.getSelection()) { style |= SWT.NO; } if (retryButton.getEnabled() && retryButton.getSelection()) { style |= SWT.RETRY; } if (abortButton.getEnabled() && abortButton.getSelection()) { style |= SWT.ABORT; } if (ignoreButton.getEnabled() && ignoreButton.getSelection()) { style |= SWT.IGNORE; } if (iconErrorButton.getEnabled() && iconErrorButton.getSelection()) { style |= SWT.ICON_ERROR; } if (iconInformationButton.getEnabled() && iconInformationButton.getSelection()) { style |= SWT.ICON_INFORMATION; } if (iconQuestionButton.getEnabled() && iconQuestionButton.getSelection()) { style |= SWT.ICON_QUESTION; } if (iconWarningButton.getEnabled() && iconWarningButton.getSelection()) { style |= SWT.ICON_WARNING; } if (iconWorkingButton.getEnabled() && iconWorkingButton.getSelection()) { style |= SWT.ICON_WORKING; } String title = "MessageBox Title"; String mesg = "Lorem ipsum dolor sit amet consectetuer adipiscing elit."; MessageBox mb = new MessageBox(getShell(), style); mb.setText(title); mb.setMessage(mesg); int result = mb.open(); String strResult = ""; switch (result) { case SWT.OK: strResult = "SWT.OK"; break; case SWT.YES: strResult = "SWT.YES"; break; case SWT.NO: strResult = "SWT.NO"; break; case SWT.CANCEL: strResult = "SWT.CANCEL"; break; case SWT.ABORT: strResult = "SWT.ABORT"; break; case SWT.RETRY: strResult = "SWT.RETRY"; break; case SWT.IGNORE: strResult = "SWT.IGNORE"; break; default: strResult = "" + result; break; } messageBoxDlgResLabel.setText("Result: " + strResult); messageBoxDlgResLabel.pack(); }