List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION
int INFORMATION
To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.
Click Source Link
From source file:org.obeonetwork.dsl.uml2.profile.design.services.ImportMetaclass.java
License:Open Source License
/** * Find the imported metaclass to the profile. * /* w w w . ja v a 2 s .co m*/ * @param profile * to test. * @return a list of class. */ public List<PackageableElement> importMetaclass(final Profile profile) { final List<PackageableElement> alreadyOnProfile = new ArrayList<PackageableElement>(); final List<String> alreadyOnProfileNames = new ArrayList<String>(); final ImportMetaclassDialog dialog = new ImportMetaclassDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), profile, true); dialog.setHeaderMessageText("Select the UML Metaclasses to import."); dialog.open(); if (dialog.getResult() != null) { final List<Object> selectedObjects = Arrays.asList(dialog.getResult()); for (Object object : selectedObjects) { if (object instanceof Class) { final Class selectedMetaclass = (Class) object; final PackageableElement importedMember = profile .getImportedMember(selectedMetaclass.getName()); if (importedMember == null) { profile.createMetaclassReference(selectedMetaclass); } else { // reserved for a future utilisation alreadyOnProfile.add(importedMember); alreadyOnProfileNames.add(importedMember.getName()); } } } } if (alreadyOnProfile.size() > 0) { final String[] buttonList = { "Ok" }; final MessageDialog msgDialog = new MessageDialog( PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Already imported Metaclasses", null, "The following Metaclasses are already imported:" + "\n" + alreadyOnProfileNames, MessageDialog.INFORMATION, buttonList, 0); msgDialog.open(); } return alreadyOnProfile; }
From source file:org.obeonetwork.dsl.uml2.profile.design.services.UMLProfileServices.java
License:Open Source License
/** * Dialog message to define a profile./*from w ww . j a va 2 s . c o m*/ * * @param rootProfile * to define * @param allContentProfile * to define */ private static void defineProfileDialog(final Profile rootProfile, final List<Profile> allContentProfile) { boolean result = false; final String[] buttonYes = { OK }; final Shell activeShell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog msgDialogYes = null; result = defineProfile(rootProfile, allContentProfile); if (result) { msgDialogYes = new MessageDialog(activeShell, "Define the Profile", null, "The profile is defined", MessageDialog.INFORMATION, buttonYes, 0); msgDialogYes.open(); } }
From source file:org.obeonetwork.dsl.uml2.profile.design.services.UMLProfileServices.java
License:Open Source License
/** * Dialog message to undefine the profile. * //w w w . ja v a2s. c om * @param rootProfile * to undefine */ public static void undefineProfileDialog(final Profile rootProfile) { final String[] buttonYesNo = { YES, NO }; final String[] buttonYes = { OK }; final Shell activeShell = PlatformUI.getWorkbench().getDisplay().getActiveShell(); MessageDialog msgDialogYesNo = null; MessageDialog msgDialogYes = null; if (rootProfile.getDefinition() != null) { msgDialogYesNo = new MessageDialog(activeShell, undefineProfile, null, "Would you like to undefine this profile ?", MessageDialog.QUESTION, buttonYesNo, 1); final int diagResult = msgDialogYesNo.open(); if (diagResult == 0) { undefineProfile(rootProfile); msgDialogYes = new MessageDialog(activeShell, undefineProfile, null, "The profile is undefined", MessageDialog.INFORMATION, buttonYes, 0); msgDialogYes.open(); } } else { msgDialogYes = new MessageDialog(activeShell, undefineProfile, null, "The profile is not defined !", MessageDialog.WARNING, buttonYes, 0); msgDialogYes.open(); } }
From source file:org.pentaho.di.ui.spoon.dialog.CapabilityManagerDialog.java
License:Apache License
public void open() { final Display display = parent.getDisplay(); shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN); props.setLook(shell);// w w w . ja v a2s . c o m shell.setImage(GUIResource.getInstance().getImageSpoon()); FormLayout formLayout = new FormLayout(); formLayout.marginWidth = Const.FORM_MARGIN; formLayout.marginHeight = Const.FORM_MARGIN; shell.setLayout(formLayout); shell.setText(BaseMessages.getString(getClass(), "CapabilityManager.Dialog.Title")); int margin = Const.MARGIN; Button closeButton = new Button(shell, SWT.PUSH); closeButton.setText(BaseMessages.getString(getClass(), "System.Button.Close")); BaseStepDialog.positionBottomButtons(shell, new Button[] { closeButton, }, margin, null); // Add listeners closeButton.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { shell.dispose(); } }); ScrolledComposite scrollpane = new ScrolledComposite(shell, SWT.BORDER | SWT.V_SCROLL); FormData treeFormData = new FormData(); treeFormData.left = new FormAttachment(0, 0); // To the right of the label treeFormData.top = new FormAttachment(0, 0); treeFormData.right = new FormAttachment(100, 0); Label label = new Label(shell, SWT.NONE); label.setText("Capabilities:"); label.setLayoutData(treeFormData); treeFormData = new FormData(); treeFormData.left = new FormAttachment(0, 0); // To the right of the label treeFormData.top = new FormAttachment(label, 0); treeFormData.right = new FormAttachment(100, 0); treeFormData.bottom = new FormAttachment(closeButton, -margin * 2); scrollpane.setLayoutData(treeFormData); scrollpane.setExpandVertical(true); scrollpane.setExpandHorizontal(true); scrollpane.setAlwaysShowScrollBars(true); Composite mainPanel = new Composite(scrollpane, SWT.NONE); scrollpane.setContent(mainPanel); scrollpane.setSize(250, 400); mainPanel.setLayout(new GridLayout(1, false)); Set<ICapability> allCapabilities = DefaultCapabilityManager.getInstance().getAllCapabilities(); SortedSet<ICapability> capabilitySortedSet = new TreeSet<ICapability>(allCapabilities); for (final ICapability capability : capabilitySortedSet) { final Button button = new Button(mainPanel, SWT.CHECK); button.setLayoutData(new GridData(GridData.FILL_BOTH, SWT.BEGINNING, false, false)); button.setSelection(capability.isInstalled()); button.setText(capability.getId()); buttons.add(button); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent selectionEvent) { final boolean selected = ((Button) selectionEvent.widget).getSelection(); new Thread(new Runnable() { @Override public void run() { final Future<Boolean> future = (selected) ? capability.install() : capability.uninstall(); try { final Boolean successful = future.get(); display.asyncExec(new Runnable() { @Override public void run() { button.setSelection(successful); if (!successful) { MessageDialog dialog = new MessageDialog(shell, "Capability Install Error", null, "Error Installing Capability:\n\n" + capability.getId(), MessageDialog.ERROR, new String[] { "OK" }, 0); dialog.open(); } else { MessageDialog dialog = new MessageDialog(shell, "Capability Install Success", null, capability.getId() + " " + ((!selected) ? "un" : "") + "installed successfully", MessageDialog.INFORMATION, new String[] { "OK" }, 0); dialog.open(); } updateAllCheckboxes(); } }); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } } }).run(); } }); } mainPanel.setSize(mainPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrollpane.setMinSize(mainPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT)); BaseStepDialog.setSize(shell, 250, 400, false); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:org.seasar.dbflute.emecha.eclipse.plugin.core.util.WorkbenchUtil.java
License:Apache License
public static void showMessage(String pluginName, String msg) { showMessage(pluginName, msg, MessageDialog.INFORMATION); }
From source file:org.stuntaz.qcwtool.tools.VerifyTool.java
License:Open Source License
private void verify(final String fileName) { try {/* w w w . j a v a 2 s .com*/ final FileInputStream fStream = new FileInputStream(fileName); final BufferedInputStream streamBuf = new BufferedInputStream(fStream); final byte[] input = new byte[(int) fStream.getChannel().size()]; final int size = streamBuf.read(input); assert (size == fStream.getChannel().size()); final ByteArrayInputStream stream = new ByteArrayInputStream(input); final WorkspaceFileBlob qcw = new WorkspaceFileBlob(); qcw.parse(stream); final ByteArrayOutputStream ostream = new ByteArrayOutputStream(qcw.getWorkspace().getSize()); final BufferedOutputStream ostreamBuf = new BufferedOutputStream(ostream); qcw.write(ostreamBuf); ostreamBuf.flush(); if (Arrays.equals(input, ostream.toByteArray())) { final String[][] stats = getStatsTableEntries(qcw.getWorkspace()); final MessageDialog md = new MessageDialog(getComposite().getShell(), "Verify Successful", null, "File verified successfully!", MessageDialog.INFORMATION, new String[] { "OK" }, 0) { @Override protected Control createCustomArea(Composite parent) { parent.setLayout(new GridLayout()); final Table table = new Table(parent, SWT.FULL_SELECTION | SWT.BORDER); GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, false); table.setLayoutData(gridData); TableColumn tc1 = new TableColumn(table, SWT.LEFT); tc1.setText("Section Type"); tc1.setWidth(100); tc1.setMoveable(false); tc1.setResizable(false); TableColumn tc2 = new TableColumn(table, SWT.LEFT); tc2.setText("Count"); tc2.setWidth(100); tc2.setMoveable(false); tc2.setResizable(false); TableColumn tc3 = new TableColumn(table, SWT.RIGHT); tc3.setText("Size (In Bytes)"); tc3.setWidth(100); tc3.setMoveable(false); tc3.setResizable(false); table.setHeaderVisible(true); for (final String[] data : stats) { TableItem item = new TableItem(table, SWT.NORMAL); item.setText(data); } table.pack(); return table; } }; md.open(); } else { System.out.println("l1: " + input.length); System.out.println("l2: " + ostream.toByteArray().length); for (int i = 0; i < input.length; ++i) { if (input[i] != ostream.toByteArray()[i]) { System.out.println("MISMATCH at offset 0x" + Integer.toHexString(i)); } } final MessageDialog md = new MessageDialog(getComposite().getShell(), "Verify Failed", null, "File verification failed!", MessageDialog.ERROR, new String[] { "OK" }, 0); md.open(); } } catch (final QCWException e) { final MessageDialog md = new MessageDialog(getComposite().getShell(), "Verify Failed", null, "Error occurred while reading file: " + e.getMessage(), MessageDialog.ERROR, new String[] { "OK" }, 0); md.open(); } catch (final IOException e) { final MessageDialog md = new MessageDialog(getComposite().getShell(), "I/O error", null, "An unknown I/O error occurred!", MessageDialog.ERROR, new String[] { "OK" }, 0); md.open(); } catch (final AssertionError ass) { StringBuffer buf = new StringBuffer(); for (final StackTraceElement elt : ass.getStackTrace()) { buf.append(elt.toString() + "\n"); } final MessageDialog md = new MessageDialog(getComposite().getShell(), "Assertion Failed", null, "An assertion failed: " + buf, MessageDialog.ERROR, new String[] { "OK" }, 0); md.open(); } }
From source file:org.talend.designer.esb.runcontainer.ui.dialog.InitFinishMessageDialog.java
License:Open Source License
public InitFinishMessageDialog(Shell parentShell, String[] bundlesName) { super(parentShell, "Initialize Finished", null, "", MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); this.bundlesName = bundlesName; }
From source file:org.talend.repository.preference.PaletteSettingPage.java
License:Open Source License
/** * set the selected component as visible or not * // www .ja v a 2 s . c o m * @param selection * @param b */ protected void setComponentVisible(ISelection selection, boolean visible) { IStructuredSelection sel = (IStructuredSelection) selection; Set<IPaletteItem> items = new HashSet<IPaletteItem>(); for (Iterator iterator = sel.iterator(); iterator.hasNext();) { IPaletteItem entry = (IPaletteItem) iterator.next(); retrieveAllEntry(items, entry); } Set<IComponent> usedComponents = getComponentsUsedInProject( ProjectManager.getInstance().getCurrentProject()); boolean isUsed = false; for (IPaletteItem item : items) { if (!visible && item instanceof ComponentPaletteItem) { if (usedComponents.contains(((ComponentPaletteItem) item).getComponent())) { isUsed = true; continue; } } setComponentVisible(item, visible); } if (isUsed) { MessageDialog messageDialog = new MessageDialog(getShell(), Messages.getString("PaletteSettingPage.paletteSettings"), null, //$NON-NLS-1$ Messages.getString("PaletteSettingPage.selection1") + "\n" //$NON-NLS-1$ //$NON-NLS-2$ + Messages.getString("PaletteSettingPage.selection2"), //$NON-NLS-1$ MessageDialog.INFORMATION, new String[] { "OK" }, 0); //$NON-NLS-1$ messageDialog.open(); } refreshViewer(); }
From source file:org.talend.repository.ui.wizards.metadata.table.database.DatabaseTableForm.java
License:Open Source License
/** * DOC PLV Comment method "checkDefaultValue". */// w ww.j ava 2s . c o m private void checkDefaultValue() { if (metadataTable != null) { EList<MetadataColumn> columns = metadataTable.getColumns(); for (MetadataColumn column : columns) { String defaultValue = column.getDefaultValue(); if (!StringUtils.isEmpty(defaultValue)) { IPreferenceStore preferenceStore = CoreUIPlugin.getDefault().getPreferenceStore(); String preKey = "DatabaseTableForm.defaultValueShowAgain"; //$NON-NLS-1$ if (!preferenceStore.getBoolean(preKey)) { MessageDialogWithToggle dialog = new MessageDialogWithToggle(this.getShell(), "", //$NON-NLS-1$ getBackgroundImage(), Messages.getString("DatabaseTableForm.checkDefaultValue"), //$NON-NLS-1$ MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0, Messages.getString("DatabaseTableForm.doNotShowMessage"), //$NON-NLS-1$ false); dialog.setPrefKey(preKey); //$NON-NLS-1$ dialog.setPrefStore(preferenceStore); dialog.open(); preferenceStore.setValue(preKey, dialog.getToggleState()); } break; } } } }
From source file:org.topcased.checktool.handlers.AddCToRegistryHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { // Get the content of the selection ISelection currentSelection = HandlerUtil.getCurrentSelection(event); if (currentSelection instanceof IStructuredSelection) { IStructuredSelection selection = (IStructuredSelection) currentSelection; boolean atLeastOneOK = false; boolean atLeastOneKO = false; StringBuilder nominalBuilder = new StringBuilder( "The following C files were processed and added to the registry :\n"); StringBuilder errorBuilder = new StringBuilder("The following C files failed during processing :\n"); for (Iterator<Object> i = selection.iterator(); i.hasNext();) { ResourceSet set = new ResourceSetImpl(); Object o = i.next();/*from w ww . j a v a 2s . co m*/ IFile f = adapt(o, IFile.class); if (f != null) { Resource res = HandlerUtils.instance.processCModel(f, set); if (res != null) { atLeastOneOK = true; nominalBuilder.append("-" + f.getName() + "\n"); } else { atLeastOneKO = true; errorBuilder.append("-" + f.getName() + "\n"); } } else { Collection<?> collec = adapt(o, Collection.class); if (collec != null) { for (Object o2 : collec) { IFile f2 = adapt(o2, IFile.class); if (f2 != null) { Resource res = HandlerUtils.instance.processCModel(f2, set); if (res != null) { atLeastOneOK = true; nominalBuilder.append("-" + f2.getName() + "\n"); } else { atLeastOneKO = true; errorBuilder.append("-" + f2.getName() + "\n"); } } } } } } if (atLeastOneOK || atLeastOneKO) { MessageDialog.open(MessageDialog.INFORMATION, Display.getDefault().getActiveShell(), "Information", (atLeastOneOK ? nominalBuilder.toString() : "") + (atLeastOneKO ? errorBuilder.toString() : ""), SWT.NONE); } } return null; }