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:net.bhl.cdt.paxelerate.ui.commands.MoveObjectCommand.java
License:Open Source License
/** * This method executed the right click command. The cabin view is updated. *///w w w. j a v a2 s. c o m @Override protected final void doRun() { /** * Main method. * * @param args * the arguments */ Input input = new Input(WindowType.MOVE_OBJECT, "All values must be entered in [cm]. Please use positive and negative digits only.", IMessageProvider.INFORMATION); movementVector = input.getVectorValue(); /* * scaleVector = input.getSecondVectorValue(); if (scaleVector.getX() != * 0 && scaleVector.getY() != 0) { scalingDesired = true; } */ int xMovement = movementVector.getX(); int yMovement = movementVector.getY(); if (!rowlist.isEmpty()) { for (Row row : rowlist) { for (Row compareRow : ModelHelper.getChildrenByClass(cabin, Row.class)) { if (row.getRowNumber() == compareRow.getRowNumber()) { for (Seat seat : compareRow.getSeats()) { seat.setYPosition(seat.getYPosition() + yMovement); seat.setXPosition(seat.getXPosition() + xMovement); /* * if (scalingDesired) { * seat.setYDimension(scaleVector.getY()); * seat.setXDimension(scaleVector.getX()); } */ } } } } } if (!seatlist.isEmpty()) { for (Seat seat : seatlist) { for (Seat compareSeat : ModelHelper.getChildrenByClass(cabin, Seat.class)) { if (seat.getId() == compareSeat.getId()) { compareSeat.setYPosition(compareSeat.getYPosition() + yMovement); compareSeat.setXPosition(compareSeat.getXPosition() + xMovement); /* * if (scalingDesired) { * compareSeat.setYDimension(scaleVector.getX()); * compareSeat.setXDimension(scaleVector.getY()); } */ } } } } if (!galleylist.isEmpty()) { for (Galley galley : galleylist) { for (Galley compareGalley : cabin.getGalleys()) { if (galley.getId() == compareGalley.getId()) { galley.setYPosition(galley.getYPosition() + yMovement); galley.setXPosition(galley.getXPosition() + xMovement); /* * if (scalingDesired) { * galley.setYDimension(scaleVector.getY()); * galley.setXDimension(scaleVector.getX()); } */ } } } } if (!lavatorylist.isEmpty()) { for (Lavatory lavatory : lavatorylist) { for (Lavatory compareLavatory : cabin.getLavatories()) { if (lavatory.getId() == compareLavatory.getId()) { compareLavatory.setYPosition(compareLavatory.getYPosition() + yMovement); compareLavatory.setXPosition(compareLavatory.getXPosition() + xMovement); /* * if (scalingDesired) { * compareLavatory.setYDimension(scaleVector.getY()); * compareLavatory.setXDimension(scaleVector.getX()); } */ } } } } if (!curtainlist.isEmpty()) { for (Curtain curtain : curtainlist) { for (Curtain compareCurtain : cabin.getCurtains()) { if (curtain.getId() == compareCurtain.getId()) { compareCurtain.setYPosition(compareCurtain.getYPosition() + yMovement); compareCurtain.setXPosition(compareCurtain.getXPosition() + xMovement); /* * if (scalingDesired) { * compareCurtain.setYDimension(scaleVector.getY()); * compareCurtain.setXDimension(scaleVector.getX()); } */ } } } } new DrawCabinCommand(cabin).execute(); }
From source file:net.bhl.cdt.paxelerate.ui.commands.SortPassengersCommand.java
License:Open Source License
@Override protected final synchronized void doRun() { CabinViewPart cabinViewPart = ViewPartHelper.getCabinView(); cabinViewPart.unsyncViewer();/*from w w w.j a v a 2s .co m*/ if (showDialog) { Input input = new Input(WindowType.OPTIONS, INPUT_STRING, IMessageProvider.INFORMATION); value = input.getIntegerValue(); } EList<Passenger> paxList = cabin.getPassengers(); Log.add(this, "Sorting passengers ..."); /* * The number of loops needs to be this high because the algorithm only * compares two neighboring elements. In order to sort an element from * the last to the first position, there are as much iterations needed * as there are elements in the list. */ int numberOfLoops = cabin.getPassengers().size(); int numberOfRows = ModelHelper.getChildrenByClass(cabin, Row.class).size(); synchronized (paxList) { switch (value) { // Random case 0: for (int i = 0; i < numberOfLoops; i++) { Passenger pax = paxList.get(i); paxList.move(RandomHelper.randomValue(0, paxList.size()), pax); } break; // Rear to front (RTF) case 1: for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size() - 1; i++) { Passenger pax1 = paxList.get(i); Passenger pax2 = paxList.get(i + 1); if (pax1.getSeat().getXPosition() < pax2.getSeat().getXPosition()) { paxList.move(i, pax2); } } } break; // Front to rear (FTR) case 2: for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size() - 1; i++) { Passenger pax1 = paxList.get(i); Passenger pax2 = paxList.get(i + 1); if (pax1.getSeat().getXPosition() > pax2.getSeat().getXPosition()) { paxList.move(i, pax2); } } } break; // Window to aisle (WTA) case 3: for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size() - 1; i++) { Passenger thisPax = paxList.get(i); Passenger otherPax = paxList.get(i + 1); if (AgentFunctions.otherSeatCloserToAisle(thisPax.getSeat(), otherPax.getSeat())) { paxList.move(i, otherPax); } } } break; // Window to aisle and rear to front (WTA + RTF) case 4: for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size() - 1; i++) { Passenger thisPax = paxList.get(i); Passenger otherPax = paxList.get(i + 1); if (AgentFunctions.otherSeatCloserToAisle(thisPax.getSeat(), otherPax.getSeat())) { if (thisPax.getSeat().getXPosition() < otherPax.getSeat().getXPosition()) { paxList.move(i, otherPax); } } } } break; // Window to aisle and front to rear (WTA + FTR) case 5: for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size() - 1; i++) { Passenger thisPax = paxList.get(i); Passenger otherPax = paxList.get(i + 1); if (AgentFunctions.otherSeatCloserToAisle(thisPax.getSeat(), otherPax.getSeat())) { if (thisPax.getSeat().getXPosition() > otherPax.getSeat().getXPosition()) { paxList.move(i, otherPax); } } } } break; // Group/block boarding: create blocks with 10 rows each and // distribute // the passengers randomly case 6: int blocks = (numberOfRows / 10); int paxPerBlock = numberOfLoops / blocks; for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size(); i++) { Passenger pax = paxList.get(i); paxList.move(RandomHelper.randomValue(0, paxList.size()), pax); } } break; // Steffen method: window every second row left and right case 7: for (int j = 0; j < numberOfLoops; j++) { for (int i = 0; i < paxList.size() - 1; i++) { Passenger thisPax = paxList.get(i); Passenger otherPax = paxList.get(i + 1); if (AgentFunctions.otherSeatCloserToAisle(thisPax.getSeat(), otherPax.getSeat())) { if (thisPax.getSeat().getXPosition() > otherPax.getSeat().getXPosition()) { // TODO: } } } } break; // Milne/Kelly method: based on number of carried bags case 8: // TODO break; default: Log.add(this, "Wrong Input!"); break; } } Log.add(this, "Sorting completed."); int counter = 1; for (Passenger pax : cabin.getPassengers()) { pax.setStartBoardingAfterDelay(calculateDelay(pax)); pax.setId(counter); pax.setName(counter + "(" + pax.getSeat().getName() + ")"); counter++; } for (Door door : cabin.getDoors()) { door.getWaitingPassengers().clear(); } cabinViewPart.syncViewer(); try { Display.getDefault().syncExec(new Runnable() { @Override public void run() { cabinViewPart.setCabin(cabin); Log.add(this, "Cabin view checked and updated"); } }); } catch (NullPointerException e) { Log.add(this, "No cabin view is visible!"); e.printStackTrace(); } }
From source file:net.enilink.rap.workbench.auth.LoginDialog.java
License:Open Source License
private void createTextoutputHandler(Composite composite, TextOutputCallback callback) { int messageType = callback.getMessageType(); int dialogMessageType = IMessageProvider.NONE; switch (messageType) { case TextOutputCallback.INFORMATION: dialogMessageType = IMessageProvider.INFORMATION; break;/*w w w. j a v a 2s.c o m*/ case TextOutputCallback.WARNING: dialogMessageType = IMessageProvider.WARNING; break; case TextOutputCallback.ERROR: dialogMessageType = IMessageProvider.ERROR; break; } setMessage(callback.getMessage(), dialogMessageType); }
From source file:net.geoprism.oda.driver.ui.editors.ConfigureSSHFormDialog.java
License:Open Source License
@Override public void create() { super.create(); this.setTitle(GeoprismPlugin.getResourceString("wizard.ssh.title")); //$NON-NLS-1$ this.setMessage(GeoprismPlugin.getResourceString("wizard.ssh.message"), IMessageProvider.INFORMATION); //$NON-NLS-1$ }
From source file:net.rim.ejde.internal.ui.wizards.imports.BasicGenericSelectionPage.java
License:Open Source License
@Override public boolean isPageComplete() { if (VMUtils.getDefaultBBVM() == null) { setMessage(//from w ww .j a va 2s .c o m net.rim.ejde.internal.util.Messages.NewBlackBerryProjectWizardPageOne_Message_noBBJREInstalled, IMessageProvider.ERROR); return false; } if (!isBBVMSelected(_jreSelectionUI)) { setMessage(net.rim.ejde.internal.util.Messages.NewBlackBerryProjectWizardPageOne_Message_noJRESelected, IMessageProvider.ERROR); return false; } IPath currentWorkspace = _projectSelectionTableGroup.getCurrentWorkspace(); if (currentWorkspace == null || currentWorkspace.isEmpty()) { setMessage(Messages.GenericSelectionPage_NO_WORKSPACE_SELECTED_MSG, IMessageProvider.INFORMATION); return false; } if (!_projectSelectionTableGroup.isValidWorkspaceFile()) { setMessage(NLS.bind(Messages.GenericSelectionPage_FILE_NOT_EXIST_MSG, currentWorkspace.toOSString()), IMessageProvider.INFORMATION); return false; } if (_projectSelectionTableGroup.getAllProjectNumber() == 0) { setMessage(Messages.GenericSelectionPage_NO_WORKSPACE_LOADED_MSG, IMessageProvider.INFORMATION); return false; } if ((_projectSelectionTableGroup.getSelectedProjectsNumber() - _projectSelectionTableGroup.getExistingProjectsNumber()) == 0) { setMessage(Messages.GenericSelectionPage_NO_PROJECT_SELECTED_ERROR_MSG, IMessageProvider.INFORMATION); return false; } String message = _projectSelectionTableGroup.hasDependencyProblem(); if (!StringUtils.isBlank(message)) { setMessage(message, IMessageProvider.WARNING); return true; } if (_projectSelectionTableGroup.getExistingProjectsNumber() > 0) { setMessage(Messages.GenericSelectionPage_SOME_PROJECTS_EXIST_MSG, IMessageProvider.WARNING); return true; } setMessage(IConstants.EMPTY_STRING); return true; }
From source file:net.sf.jmoney.transactionDialog.TransactionDialog.java
License:Open Source License
/** * Sets or clears the error message.//from w w w . j a v a2 s. com * If not <code>null</code>, the OK button is disabled. * * @param errorMessage * the error message, or <code>null</code> to clear */ public void updateErrorMessage() { String errorMessage = null; try { BaseEntryRowControl.baseValidation(topEntry.getTransaction()); // No exception was thrown, so transaction is valid. // If there are two currencies/commodities involved in // the transaction then the exchange rate or conversion cost // or net price or whatever is displayed. Map<Commodity, Long> amounts = new HashMap<Commodity, Long>(); for (Entry entry : transaction.getEntryCollection()) { Commodity commodity = entry.getCommodityInternal(); Long previousAmount = amounts.get(commodity); if (previousAmount == null) { amounts.put(commodity, entry.getAmount()); } else { amounts.put(commodity, entry.getAmount() + previousAmount); } } if (amounts.size() == 2) { List<Map.Entry<Commodity, Long>> a = new ArrayList<Map.Entry<Commodity, Long>>(amounts.entrySet()); Commodity commodity1 = a.get(0).getKey(); Commodity commodity2 = a.get(1).getKey(); long amount1 = a.get(0).getValue(); long amount2 = a.get(1).getValue(); if (amount1 >= 0 && amount2 >= 0) { messageArea.updateText("A net gain has occurred!", IMessageProvider.ERROR); } else if (amount1 <= 0 && amount2 <= 0) { messageArea.updateText("A net loss has occurred!", IMessageProvider.ERROR); } else { amount1 = Math.abs(amount1); amount2 = Math.abs(amount2); long worthOfCommodity1 = amount2 * commodity1.getScaleFactor() / amount1; long worthOfCommodity2 = amount1 * commodity2.getScaleFactor() / amount2; String message = MessageFormat.format(Messages.TransactionDialog_Message, commodity1.getName(), commodity2.getName(), commodity2.format(worthOfCommodity1), commodity1.format(worthOfCommodity2)); messageArea.updateText(message, IMessageProvider.INFORMATION); } } else { // messageArea.clearErrorMessage(); ????? messageArea.restoreTitle(); } } catch (InvalidUserEntryException e) { errorMessage = e.getLocalizedMessage(); messageArea.updateText(errorMessage, IMessageProvider.ERROR); } // If called during createDialogArea, the okButton // will not have been created yet. Button okButton = this.getButton(IDialogConstants.OK_ID); if (okButton != null) { okButton.setEnabled(errorMessage == null); } }
From source file:net.sourceforge.metrics.properties.ExclusionPatternDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { setTitle("Edit Exclusion Patterns"); setMessage("Use this dialog to add, edit or remove exclusion patterns for " + descriptor.getName(), IMessageProvider.INFORMATION); Composite c = new Composite(parent, SWT.NONE); GridLayout l = new GridLayout(); l.marginWidth = 5;/* w w w. j av a 2 s. c o m*/ l.marginHeight = 5; c.setLayout(l); GridData data = new GridData(GridData.FILL_BOTH); data.grabExcessHorizontalSpace = true; c.setLayoutData(data); patternList = new List(c, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE); patternList.setLayoutData(data); patternList.setItems(patterns); patternList.addSelectionListener(this); return super.createDialogArea(parent); }
From source file:net.tourbook.ui.MessageRegion.java
License:Open Source License
/** * Show the new message in the message text and update the image. Base the background color on * whether or not there are errors.//from w w w . j a v a 2 s .co m * * @param newMessage * The new value for the message * @param newType * One of the IMessageProvider constants. If newType is IMessageProvider.NONE show * the title. * @see IMessageProvider */ public void updateText(final String newMessage, final int newType) { Image newImage = null; boolean showingError = false; switch (newType) { case IMessageProvider.NONE: hideRegion(); return; case IMessageProvider.INFORMATION: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); break; case IMessageProvider.WARNING: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); break; case IMessageProvider.ERROR: newImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); showingError = true; break; } if (newMessage == null) {//No message so clear the area hideRegion(); return; } showRegion(); // Any more updates required if (newMessage.equals(messageText.getText()) && newImage == messageImageLabel.getImage()) { return; } messageImageLabel.setImage(newImage); messageText.setText(newMessage); if (showingError) { setMessageColors(JFaceColors.getErrorBackground(messageComposite.getDisplay())); } else { lastMessageText = newMessage; setMessageColors(JFaceColors.getBannerBackground(messageComposite.getDisplay())); } }
From source file:no.javatime.inplace.ui.dialogs.DependencyDialog.java
License:Open Source License
/** * Initialize and manage the activate radio group *//*ww w . j a v a 2s. c o m*/ private void activate() { grpActivate = new Group(container, SWT.SHADOW_ETCHED_OUT); grpActivate.addMouseListener(new MouseAdapter() { @Override public void mouseDoubleClick(MouseEvent e) { setMessage(msg.formatString("dep_operation_group_activation", activateOp), IMessageProvider.INFORMATION); } @Override public void mouseDown(MouseEvent e) { setMessage(msg.formatString("dep_operation_group_activation", activateOp), IMessageProvider.INFORMATION); } }); grpActivate.setToolTipText(msg.formatString("dep_operation_group_activation", activateOp)); GridData gd_grpActivate = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_grpActivate.heightHint = grpHeightHint; gd_grpActivate.widthHint = grWidthHint; grpActivate.setLayoutData(gd_grpActivate); grpActivate.setText(msg.formatString("dep_bundles_name", msg.formatString("dep_operation_activate"))); // Providing btnActivateProvidingBundles = new Button(grpActivate, SWT.RADIO); btnActivateProvidingBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (btnActivateProvidingBundles.getSelection()) { setMessage(msg.formatString("dep_operation_providing", activateOp), IMessageProvider.INFORMATION); } } }); btnActivateProvidingBundles.setToolTipText(msg.formatString("dep_operation_providing", activateOp)); btnActivateProvidingBundles.setBounds(101, 20, 72, 16); btnActivateProvidingBundles.setText("Providing"); if (!requiringOnActivate && !partialOnActivate) { btnActivateProvidingBundles.setSelection(true); } btnActivateRequiringBundles = new Button(grpActivate, SWT.RADIO); btnActivateRequiringBundles .setToolTipText(msg.formatString("dep_operation_requiring_providing", activateOp)); btnActivateRequiringBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Category.setState(Category.requiringOnActivate, btnActivateRequiringBundles.getSelection()); if (btnActivateRequiringBundles.getSelection()) { setMessage(msg.formatString("dep_operation_requiring_providing", activateOp), IMessageProvider.INFORMATION); } } @Override public void widgetDefaultSelected(SelectionEvent e) { btnActivateRequiringBundles .setSelection(Category.getInstance().resetState(Category.requiringOnActivate)); } }); btnActivateRequiringBundles.setBounds(290, 20, 149, 16); btnActivateRequiringBundles.setText("Requiring and Providing"); btnActivateRequiringBundles.setSelection(Category.getState(Category.requiringOnActivate)); btnActivatePartialGraph = new Button(grpActivate, SWT.RADIO); btnActivatePartialGraph.setToolTipText(msg.formatString("dep_operation_partial", activateOp)); btnActivatePartialGraph.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Category.setState(Category.partialGraphOnActivate, btnActivatePartialGraph.getSelection()); if (btnActivatePartialGraph.getSelection()) { setMessage(msg.formatString("dep_operation_partial", activateOp), IMessageProvider.INFORMATION); } } }); btnActivatePartialGraph.setBounds(463, 20, 89, 16); btnActivatePartialGraph.setText("Partial Graph"); btnActivatePartialGraph.setSelection(Category.getState(Category.partialGraphOnActivate)); }
From source file:no.javatime.inplace.ui.dialogs.DependencyDialog.java
License:Open Source License
/** * Initialize and manage the deactivate radio group *//*from w w w.j av a 2 s. c om*/ private void deactivate() { grpDeactivate = new Group(container, SWT.SHADOW_ETCHED_IN); grpDeactivate.addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { setMessage(msg.formatString("dep_operation_group_activation", deactivateOp), IMessageProvider.INFORMATION); } @Override public void mouseDoubleClick(MouseEvent e) { setMessage(msg.formatString("dep_operation_group_activation", deactivateOp), IMessageProvider.INFORMATION); } }); grpDeactivate.setToolTipText(msg.formatString("dep_operation_group_activation", deactivateOp)); GridData gd_grpDeactivate = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); gd_grpDeactivate.widthHint = grWidthHint; gd_grpDeactivate.heightHint = grpHeightHint; grpDeactivate.setLayoutData(gd_grpDeactivate); grpDeactivate.setText(msg.formatString("dep_bundles_name", msg.formatString("dep_operation_deactivate"))); btnDeactivateRequiringBundles = new Button(grpDeactivate, SWT.RADIO); btnDeactivateRequiringBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (btnDeactivateRequiringBundles.getSelection()) { setMessage(msg.formatString("dep_operation_requiring", deactivateOp), IMessageProvider.INFORMATION); } } }); btnDeactivateRequiringBundles.setToolTipText(msg.formatString("dep_operation_requiring", deactivateOp)); btnDeactivateRequiringBundles.setBounds(194, 20, 72, 16); btnDeactivateRequiringBundles.setText("Requiring"); if (!providingOnDeactivate && !partialOnDeactivate) { btnDeactivateRequiringBundles.setSelection(true); } btnDeactivateProvidingBundles = new Button(grpDeactivate, SWT.RADIO); btnDeactivateProvidingBundles.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Category.setState(Category.providingOnDeactivate, btnDeactivateProvidingBundles.getSelection()); if (btnDeactivateProvidingBundles.getSelection()) { setMessage(msg.formatString("dep_operation_providing_requiring", deactivateOp), IMessageProvider.INFORMATION); } } }); btnDeactivateProvidingBundles .setToolTipText(msg.formatString("dep_operation_providing_requiring", deactivateOp)); btnDeactivateProvidingBundles.setText("Providing and Requiring"); btnDeactivateProvidingBundles.setBounds(290, 20, 149, 16); btnDeactivateProvidingBundles.setSelection(Category.getState(Category.providingOnDeactivate)); btnDeactivatePartialGraph = new Button(grpDeactivate, SWT.RADIO); btnDeactivatePartialGraph.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Category.setState(Category.partialGraphOnDeactivate, btnDeactivatePartialGraph.getSelection()); if (btnDeactivatePartialGraph.getSelection()) { setMessage(msg.formatString("dep_operation_partial", deactivateOp), IMessageProvider.INFORMATION); } } }); btnDeactivatePartialGraph.setToolTipText(msg.formatString("dep_operation_partial", deactivateOp)); btnDeactivatePartialGraph.setText("Partial Graph"); btnDeactivatePartialGraph.setBounds(463, 20, 89, 16); btnDeactivatePartialGraph.setSelection(Category.getState(Category.partialGraphOnDeactivate)); }