List of usage examples for org.eclipse.jface.dialogs IMessageProvider INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs IMessageProvider INFORMATION.
Click Source Link
From source file:com.ebmwebsourcing.petals.services.sa.export.SaExportWizardPage.java
License:Open Source License
/** * Validates the page entries./* ww w .ja va 2 s . co m*/ */ private void validate() { setMessage(null, IMessageProvider.INFORMATION); if (getSaProjectsToExport().isEmpty()) updateStatus("You must select at least one Service Assembly project to export."); else if (this.exportMode == null) updateStatus("You have to select an export mode."); else if (this.exportMode == SaExportMode.IN_SAME_LOCATION && (this.outputFile == null || !this.outputFile.exists() || !this.outputFile.isDirectory())) updateStatus("You have to select a valid output directory."); else updateStatus(null); }
From source file:com.ebmwebsourcing.petals.services.sa.wizards.PetalsSaSusWizardPage.java
License:Open Source License
/** * Validates the selection.//w w w . j a v a 2 s . co m */ private void validate() { ArrayList<IProject> alreadyUsed = new ArrayList<IProject>(); for (IProject p : this.suProjects) { if (ServiceProjectRelationUtils.getReferencingSaProjects(p).size() > 0) alreadyUsed.add(p); } String msg = null; if (alreadyUsed.size() > 1) msg = alreadyUsed.size() + " of the selected service units are already part of another Service Assembly project."; else if (alreadyUsed.size() == 1) msg = alreadyUsed.get(0).getName() + " is already included by another Service Assembly project."; setMessage(msg, IMessageProvider.INFORMATION); }
From source file:com.ebmwebsourcing.petals.services.su.export.SuExportWizardPage.java
License:Open Source License
public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginHeight = 10;//from w ww . j a va 2 s . c o m layout.marginWidth = 10; container.setLayout(layout); container.setLayoutData(new GridData(GridData.FILL_BOTH)); // Project viewer Label l = new Label(container, SWT.NONE); l.setText("Select the Service Unit project(s) to export:"); GridData layoutData = new GridData(); layoutData.horizontalSpan = 2; l.setLayoutData(layoutData); final TableViewer viewer = new TableViewer(container, SWT.BORDER | SWT.CHECK); layoutData = new GridData(GridData.FILL_BOTH); layoutData.heightHint = 140; layoutData.widthHint = 440; layoutData.horizontalSpan = 2; viewer.getTable().setLayoutData(layoutData); viewer.setLabelProvider(new WorkbenchLabelProvider()); viewer.setContentProvider(new ArrayContentProvider()); viewer.setInput(this.suProjects.keySet()); for (TableItem item : viewer.getTable().getItems()) { IProject p = (IProject) item.getData(); if (this.suProjects.get(p)) item.setChecked(true); } viewer.getTable().addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { boolean checked = ((TableItem) event.item).getChecked(); IProject p = (IProject) ((TableItem) event.item).getData(); SuExportWizardPage.this.suProjects.put(p, checked); validate(); } }); // Export options final Composite exportComposite = new Composite(container, SWT.SHADOW_ETCHED_OUT); layout = new GridLayout(2, false); layout.marginHeight = 0; layout.marginWidth = 0; exportComposite.setLayout(layout); layoutData = new GridData(GridData.FILL_HORIZONTAL); layoutData.verticalIndent = 17; layoutData.horizontalSpan = 2; exportComposite.setLayoutData(layoutData); l = new Label(exportComposite, SWT.NONE); l.setText("Export mode:"); final Combo exportCombo = new Combo(exportComposite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); exportCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); exportCombo.setItems(new String[] { "Distinct export, in a same directory", "Distinct export, in the project directories", "All-in-one export, in a same service assembly" }); this.lastLabel = new Label(exportComposite, SWT.NONE); exportCombo.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } public void widgetDefaultSelected(SelectionEvent e) { // Get the export type int selectionIndex = exportCombo.getSelectionIndex(); // Delete the last two widgets boolean found = false; if (SuExportWizardPage.this.lastLabel != null) { for (Control control : exportComposite.getChildren()) { if (found) control.dispose(); else found = control.equals(SuExportWizardPage.this.lastLabel); } } // Add new widgets - separate, external directory if (selectionIndex == 0) { SuExportWizardPage.this.exportMode = SuExportMode.SEPARATE_IN_DIRECTORY; SuExportWizardPage.this.lastLabel.setVisible(true); SuExportWizardPage.this.lastLabel.setText("Output directory:"); Composite subContainer = new Composite(exportComposite, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; layout.marginHeight = 0; subContainer.setLayout(layout); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Text dirText = new Text(subContainer, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); dirText.setBackground(dirText.getDisplay().getSystemColor(SWT.COLOR_WHITE)); dirText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); String loc = PetalsServicesPlugin.getDefault().getPreferenceStore() .getString(PREF_DIRECTORY_LOC); if (loc.length() != 0) { dirText.setText(loc); SuExportWizardPage.this.outputFile = new File(loc); } dirText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { SuExportWizardPage.this.outputFile = new File(dirText.getText()); validate(); } }); final Button browseDirButton = new Button(subContainer, SWT.PUSH); browseDirButton.setText("Browse..."); browseDirButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } public void widgetDefaultSelected(SelectionEvent e) { DirectoryDialog dlg = new DirectoryDialog(dirText.getShell()); dlg.setText("Output Directory"); dlg.setMessage("Select the output directory."); if (SuExportWizardPage.this.outputFile != null && SuExportWizardPage.this.outputFile.exists()) dlg.setFilterPath(SuExportWizardPage.this.outputFile.getAbsolutePath()); String loc = dlg.open(); if (loc != null) { dirText.setText(loc); PetalsServicesPlugin.getDefault().getPreferenceStore().setValue(PREF_DIRECTORY_LOC, loc); } } }); } // Separate, project directories else if (selectionIndex == 1) { SuExportWizardPage.this.exportMode = SuExportMode.SEPARATE_IN_PROJECT; SuExportWizardPage.this.lastLabel.setVisible(false); } // Same SA else if (selectionIndex == 2) { SuExportWizardPage.this.exportMode = SuExportMode.ALL_IN_ONE; SuExportWizardPage.this.lastLabel.setVisible(true); SuExportWizardPage.this.lastLabel.setText("Output file:"); Composite subContainer = new Composite(exportComposite, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; layout.marginHeight = 0; subContainer.setLayout(layout); subContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final Text fileText = new Text(subContainer, SWT.SINGLE | SWT.BORDER); fileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); String loc = PetalsServicesPlugin.getDefault().getPreferenceStore().getString(PREF_FILE_LOC); if (loc.length() != 0) { fileText.setText(loc); SuExportWizardPage.this.outputFile = new File(loc); } fileText.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { SuExportWizardPage.this.outputFile = new File(fileText.getText()); validate(); } }); final Button browseFileButton = new Button(subContainer, SWT.PUSH); browseFileButton.setText("Browse..."); browseFileButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { widgetDefaultSelected(e); } public void widgetDefaultSelected(SelectionEvent e) { FileDialog dlg = new FileDialog(fileText.getShell()); dlg.setText("Target Service Assembly"); dlg.setFilterExtensions(new String[] { "*.zip" }); dlg.setOverwrite(true); if (SuExportWizardPage.this.outputFile != null) { dlg.setFileName(SuExportWizardPage.this.outputFile.getName()); File parentFile = SuExportWizardPage.this.outputFile.getParentFile(); if (parentFile != null) dlg.setFilterPath(parentFile.getAbsolutePath()); } String loc = dlg.open(); if (loc != null) { if (!loc.endsWith(".zip")) loc += ".zip"; fileText.setText(loc); PetalsServicesPlugin.getDefault().getPreferenceStore().setValue(PREF_FILE_LOC, loc); } } }); } // Refresh the container exportComposite.layout(); validate(); } }); // Last UI details setControl(container); viewer.getTable().setFocus(); exportCombo.select(0); exportCombo.notifyListeners(SWT.Selection, new Event()); String msg = getErrorMessage(); if (msg != null) { setErrorMessage(null); setMessage(msg, IMessageProvider.INFORMATION); } }
From source file:com.ebmwebsourcing.petals.services.su.export.SuExportWizardPage.java
License:Open Source License
/** * Validates the page entries.//from ww w.j av a 2s. c o m */ private void validate() { setMessage(null, IMessageProvider.INFORMATION); if (getSuProjectsToExport().isEmpty()) updateStatus("You must select at least one Service Unit project to export."); else if (this.exportMode == null) updateStatus("You have to select an export mode."); else if (this.exportMode == SuExportMode.ALL_IN_ONE) { if (this.outputFile == null || this.outputFile.getAbsolutePath().trim().length() == 0) updateStatus("You have to provide a valid file path."); else if (this.outputFile.exists() && !this.outputFile.isFile()) updateStatus("The destination already exists and is not a file."); else updateStatus(null); } else if (this.exportMode == SuExportMode.SEPARATE_IN_DIRECTORY && (this.outputFile == null || !this.outputFile.exists() || !this.outputFile.isDirectory())) updateStatus("You have to provide a valid directory path."); else updateStatus(null); }
From source file:com.ebmwebsourcing.petals.services.su.extensions.generic.GenericSuWizardPage.java
License:Open Source License
@Override public boolean validate() { setMessage(null, IMessageProvider.INFORMATION); // Validate the fields String error = null;/* w ww .j a v a2 s. c o m*/ ComponentVersionDescription desc = getWizard().getComponentVersionDescription(); if (StringUtils.isEmpty(desc.getComponentName())) error = "You have to set the component name."; else if (StringUtils.isEmpty(desc.getComponentAlias())) error = "You have to define the service type (e.g. SOAP)."; // Update the UI setPageComplete(error == null); setErrorMessage(error); return error == null; }
From source file:com.ebmwebsourcing.petals.services.su.extensions.generic.GenericSuWizardPage.java
License:Open Source License
@Override public void createControl(final Composite parent) { // Keep the component description final GenericComponentDescription genDesc = (GenericComponentDescription) getWizard() .getComponentVersionDescription(); // Create the composite container and define its layout. final Composite container = SwtFactory.createComposite(parent); SwtFactory.applyNewGridLayout(container, 2, false, 20, 15, 5, 15); SwtFactory.applyGrabbingGridData(container); // The fields to fill-in SwtFactory.createLabel(container, "Component Type:", "The type of the target component"); Combo typeCombo = SwtFactory.createDropDownCombo(container, true, true); typeCombo.add("Binding Component"); typeCombo.add("Service Engine"); typeCombo.select(genDesc.isBc() ? 0 : 1); typeCombo.addSelectionListener(new SelectionAdapter() { @Override//from w ww. jav a 2 s . co m public void widgetSelected(SelectionEvent e) { boolean isBc = ((Combo) e.widget).getSelectionIndex() == 0 ? true : false; genDesc.setBc(isBc); validate(); } }); SwtFactory.createLabel(container, "Component Name:", "The name of the target component"); Text text = SwtFactory.createSimpleTextField(container, true); text.setText(genDesc.getComponentName()); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String componentName = ((Text) e.widget).getText().trim(); genDesc.setComponentName(componentName); validate(); } }); SwtFactory.createLabel(container, "Component Version:", "The version of the target component"); text = SwtFactory.createSimpleTextField(container, true); genDesc.setComponentVersion("1.0"); text.setText("1.0"); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String version = ((Text) e.widget).getText().trim(); genDesc.setComponentVersion(version); validate(); } }); SwtFactory.createLabel(container, "Component Alias:", "The component's alias (e.g. SOAP, FTP...)"); text = SwtFactory.createSimpleTextField(container, true); text.setText(genDesc.getComponentAlias()); text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { String type = ((Text) e.widget).getText().trim(); genDesc.setComponentAlias(type); validate(); } }); // SwtFactory.createLabel( container, "CDK Version:", "The version of the CDK to use" ); // Combo cdkCombo = new Combo( container, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY ); // cdkCombo.setLayoutData( new GridData( GridData.FILL_HORIZONTAL )); // cdkCombo.add( "" ); // cdkCombo.add( "4.x" ); // cdkCombo.add( "5.x" ); // cdkCombo.addSelectionListener( new SelectionAdapter() { // @Override // public void widgetSelected( SelectionEvent e ) { // // String version = ((Combo) e.widget).getText(); // // TODO : commented to remove deps on editor to CDK // // GenericSuWizardPage.this.cdkNamespaceUri = CdkXsdManager.getInstance().resolveCdkVersion( version.replace( 'x', '0' )); // // validate(); // } // }); // Complete the page validate(); String msg = getErrorMessage(); if (msg != null) { setErrorMessage(null); setMessage(msg, IMessageProvider.INFORMATION); } setControl(container); }
From source file:com.ebmwebsourcing.petals.services.su.wizards.pages.JbiAbstractPage.java
License:Open Source License
@Override public void setVisible(boolean visible) { // Update the UI if (visible) { AbstractEndpoint ae = getNewlyCreatedEndpoint(); this.itfQText.setValue(ae.getInterfaceName()); this.srvQText.setValue(ae.getServiceName()); String edpt = ae.getEndpointName(); if (!getWizard().getComponentVersionDescription().getAutoGeneratedEndpointValue().equals(edpt)) this.edptText.setText(edpt == null ? "" : edpt); String errorMsg = getErrorMessage(); if (errorMsg != null) { setMessage(errorMsg, IMessageProvider.INFORMATION); setErrorMessage(null);//from ww w .j a va 2 s .co m } setPageComplete(errorMsg == null); } // Call to super super.setVisible(visible); }
From source file:com.ebmwebsourcing.petals.services.su.wizards.pages.ProjectPage.java
License:Open Source License
@Override public void setVisible(boolean visible) { // Update the UI int start = -1, end = -1; if (visible) { // Update the project name from the "service-name" boolean defaultServiceName = false; AbstractEndpoint ae = getNewlyCreatedEndpoint(); String serviceName = ae.getServiceName() != null ? ae.getServiceName().getLocalPart() : null; // If there is no service name, use a default one if (StringUtils.isEmpty(serviceName)) { serviceName = ae.getInterfaceName() != null ? ae.getInterfaceName().getLocalPart() : null; if (StringUtils.isEmpty(serviceName)) { serviceName = "YourServiceName"; defaultServiceName = true; }/* ww w . j a v a2s.c o m*/ } // Store it, so that we know when we can reset the project name... // and when we must let it unchanged boolean refresh = false; if (this.oldBaseName == null || !this.oldBaseName.equals(serviceName)) { this.oldBaseName = serviceName; refresh = true; } // Create a SU name String newSuType = getWizard().getComponentVersionDescription().getComponentAlias().replaceAll("\\s", ""); if (refresh) { String formattedName = NameUtils.createSuName(newSuType, serviceName, getWizard().getPetalsMode() != PetalsMode.provides); this.projectNameText.setText(formattedName); } if (defaultServiceName) { start = 4 + newSuType.length(); end = start + serviceName.length(); } String error = getErrorMessage(); if (error != null) { setErrorMessage(null); setMessage(error, IMessageProvider.INFORMATION); } } // Super super.setVisible(visible); // Force the focus if (visible) { this.projectNameText.forceFocus(); if (start != -1 && end != -1) this.projectNameText.setSelection(start, end); else this.projectLocationText.setSelection(5); } }
From source file:com.google.appengine.eclipse.core.deploy.ui.DeployProjectDialog.java
License:Open Source License
private static int convertSeverity(IStatus status) { switch (status.getSeverity()) { case IStatus.ERROR: return IMessageProvider.ERROR; case IStatus.WARNING: return IMessageProvider.WARNING; case IStatus.INFO: return IMessageProvider.INFORMATION; default:/* w ww .j a va 2 s .c o m*/ return IMessageProvider.NONE; } }
From source file:com.google.appraise.eclipse.ui.EditCommentDialog.java
License:Open Source License
@Override public void create() { super.create(); setTitle("Review Comment"); setMessage("Enter the new review comment", IMessageProvider.INFORMATION); }