org.eclipse.ui.forms.IMessageManager Java Examples

The following examples show how to use org.eclipse.ui.forms.IMessageManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ICEFormEditor.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation changes the dirty state of the FormEditor.
 * 
 * @param value
 */
public void setDirty(boolean value) {

	// Set the dirty value and fire a property change
	dirty = value;
	firePropertyChange(PROP_DIRTY);

	// Push a message to the message manager
	if (getHeaderForm() != null) {
		final IMessageManager messageManager = getHeaderForm()
				.getMessageManager();
		if (dirty) {
			messageManager.addMessage("statusUpdate",
					"There are unsaved changes on the form.", null,
					IMessageProvider.WARNING);
		} else {
			messageManager.removeMessage("statusUpdate");
			// messageManager.addMessage("statusUpdate", "Form Saved", null,
			// IMessageProvider.INFORMATION);
		}
	}

}
 
Example #2
Source File: ICEFormEditor.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * This operation posts a status message to the ICEFormEditor should be
 * displayed to the user or system viewing the widget. It is a simple
 * string.
 * 
 * @param statusMessage
 *            The status message.
 */
public void updateStatus(String statusMessage) {

	// Local Declarations
	final String message = statusMessage;

	// Sync with the display
	PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
		@Override
		public void run() {
			// Post the message to the update manager
			if (getHeaderForm() != null) {
				final IMessageManager messageManager = getHeaderForm()
						.getMessageManager();
				messageManager.addMessage("statusUpdate", message, null,
						IMessageProvider.INFORMATION);
			}
		}
	});
}
 
Example #3
Source File: ContractConstraintsTableViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void initialize(final IViewerController constraintController, final IMessageManager messageManager,
        final EMFDataBindingContext emfDataBindingContext) {
    this.messageManager = messageManager;
    this.constraintController = constraintController;
    this.emfDataBindingContext = emfDataBindingContext;
    final ProcessItemProviderAdapterFactory adapterFactory = new ProcessItemProviderAdapterFactory();
    propertySourceProvider = new AdapterFactoryContentProvider(adapterFactory);
    adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
    getTable().setHeaderVisible(true);
    getTable().setLinesVisible(true);
    setContentProvider(new ObservableListContentProvider());

    final CellNavigationStrategy cellNavigationStrategy = new AddRowOnEnterCellNavigationStrategy(this, constraintController);
    final TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(this, new FocusCellOwnerDrawHighlighter(
            this), cellNavigationStrategy);

    TableViewerEditor.create(this, focusCellManager, new CharriageColumnViewerEditorActivationStrategy(this), ColumnViewerEditor.TABBING_HORIZONTAL |
            ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
            ColumnViewerEditor.TABBING_VERTICAL |
            ColumnViewerEditor.KEYBOARD_ACTIVATION);

    ColumnViewerToolTipSupport.enableFor(this);
    createColumns();
    configureTableLayout();
}
 
Example #4
Source File: CustomTextEMFObservableValueEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public CustomTextEMFObservableValueEditingSupport(final ColumnViewer viewer, final EStructuralFeature featureToEdit,
        final IMessageManager messageManager, final DataBindingContext dbc) {
    super(viewer, dbc);
    this.dbc = dbc;
    this.messageManager = messageManager;
    this.featureToEdit = featureToEdit;
}
 
Example #5
Source File: ContractInputTreeViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public void initialize(final ContractInputController inputController, final IMessageManager messageManager,
        final EMFDataBindingContext emfDataBindingContext) {
    this.messageManager = messageManager;
    this.inputController = inputController;
    this.emfDataBindingContext = emfDataBindingContext;
    final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(
            ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
    propertySourceProvider = new ContractInputTypePropertyDescriptor(adapterFactory);
    adapterFactoryLabelProvider = new AdapterFactoryLabelProvider(adapterFactory);
    getTree().setHeaderVisible(true);
    getTree().setLinesVisible(true);
    addFilter(new ComplexTypeChildrenViewerFilter());
    final ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider(
            new ContractInputObservableFactory(),
            new ContractInputTreeStructureAdvisor());
    setContentProvider(contentProvider);
    final CellNavigationStrategy cellNavigationStrategy = new AddRowOnEnterCellNavigationStrategy(this, inputController);
    final TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(this,
            new FocusCellOwnerDrawHighlighter(
                    this),
            cellNavigationStrategy);

    TreeViewerEditor.create(this, focusCellManager, new CharriageColumnViewerEditorActivationStrategy(this),
            ColumnViewerEditor.TABBING_HORIZONTAL |
                    ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
                    ColumnViewerEditor.TABBING_VERTICAL |
                    ColumnViewerEditor.KEYBOARD_ACTIVATION);

    ColumnViewerToolTipSupport.enableFor(this);

    createColumns();
    configureTableLayout();
}
 
Example #6
Source File: InputNameObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
public InputNameObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc,
        final IRefactorOperationFactory contractInputRefactorOperationFactory,
        final IProgressService progressService) {
    super(viewer, ProcessPackage.Literals.CONTRACT_INPUT__NAME, messageManager, dbc);
    this.progressService = progressService;
    this.contractInputRefactorOperationFactory = contractInputRefactorOperationFactory;
}
 
Example #7
Source File: AbstractEntryComposite.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setMessageManager(IMessageManager manager) {

	// Set the messageManager
	messageManager = manager;

	return;
}
 
Example #8
Source File: DataComponentComposite.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This operation sets the message manager that should be used by this
 * composite and its children to post messages.
 *
 * @param manager
 *            The message manager.
 */
public void setMessageManager(IMessageManager manager) {

	// Set the class reference
	messageManager = manager;

	// Set the message manager if it is available
	if (messageManager != null) {
		for (IEntryComposite composite : entryMap.values()) {
			composite.setMessageManager(messageManager);
		}
	}

	return;
}
 
Example #9
Source File: BasicFormPage.java    From tlaplus with MIT License 5 votes vote down vote up
public void addGlobalTLCErrorMessage(String key, String message)
{
	IMessageManager mm = getManagedForm().getMessageManager();
    mm.addMessage(key, message, null, IMessageProvider.WARNING);
    /*globalTLCErrorHyperLink.setText(TLC_ERROR_STRING);
    globalTLCErrorHyperLink.setToolTipText(tooltipText);
    globalTLCErrorHyperLink.setForeground(TLCUIActivator.getColor(SWT.COLOR_DARK_YELLOW));
    globalTLCErrorHyperLink.addHyperlinkListener(globalTLCErrorHyperLinkListener);*/
}
 
Example #10
Source File: BasicFormPage.java    From tlaplus with MIT License 5 votes vote down vote up
public void validateId(final String sectionId, final Control widget, List<String> values, String errorMessagePrefix, String elementType)
{
    String message;
    IMessageManager mm = getManagedForm().getMessageManager();
    for (int i = 0; i < values.size(); i++)
    {
        String value = values.get(i);
        if (!FormHelper.isIdentifier(value))
        {
            if (value.trim().equals(""))
            {
                message = elementType + " has been omitted.";

            } else
            {
                message = elementType
                        + " "
                        + value
                        + " may not be used, since it is not a valid identifier."
                        + "\nAn identifier is a non-empty sequence of letters, digits and '_' with at least one letter.";
            }

            mm.addMessage(errorMessagePrefix + i, message, value.toString(), IMessageProvider.ERROR, widget);
            setComplete(false);
            expandSection(sectionId);
        }
    }
}
 
Example #11
Source File: BasicFormPage.java    From tlaplus with MIT License 4 votes vote down vote up
public void validateUsage(final String sectionId, final Control widget, List<String> values, String errorMessagePrefix, String elementType,
         String listSourceDescription, boolean addToContext)
{
    IMessageManager mm = getManagedForm().getMessageManager();
    SemanticHelper helper = getLookupHelper();
    String message;
    for (int i = 0; i < values.size(); i++)
    {
        String value = values.get(i);
        Object usageHint = helper.getUsedHint(value);
        if (usageHint != null)
        {
            message = elementType + " " + value + " may not be used, since it is ";
            if (usageHint instanceof SymbolNode)
            {
                message += "";
                SymbolNode node = (SymbolNode) usageHint;
                Location location = node.getLocation();
                if (location.source().equals(SemanticHelper.TLA_BUILTIN))
                {
                    message += "a built-in TLA+ definition.";
                } else
                {
                    message += "an identifier already defined at " + location.toString() + ".";
                }
            } else if (usageHint instanceof String)
            {
                if (SemanticHelper.KEYWORD.equals(usageHint))
                {
                    message += "a TLA+ keyword.";
                } else
                {
                    message += "already used in " + usageHint;
                }
            } else
            {
                message = "Error during validation. This is a bug";
            }
            mm.addMessage(errorMessagePrefix + i, message, value.toString(), IMessageProvider.ERROR, widget);
            setComplete(false);
            expandSection(sectionId);
        } else
        {
            // just adding the name
            if (addToContext)
            {
                helper.addName(value, this, listSourceDescription);
            }
        }
    }
}
 
Example #12
Source File: AbstractBonitaDescriptionSection.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected IMessageManager getMessageManager() {
    if (form != null) {
        return form.getMessageManager();
    }
    return null;
}
 
Example #13
Source File: ErrorMessageObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public ErrorMessageObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc) {
    super(viewer, ProcessPackage.Literals.CONTRACT_CONSTRAINT__ERROR_MESSAGE, messageManager, dbc);
}
 
Example #14
Source File: DescriptionObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public DescriptionObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc) {
    super(viewer, ProcessPackage.Literals.CONTRACT_CONSTRAINT__DESCRIPTION, messageManager, dbc);
}
 
Example #15
Source File: ConstraintNameObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public ConstraintNameObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc) {
    super(viewer, ProcessPackage.Literals.CONTRACT_CONSTRAINT__NAME, messageManager, dbc);
}
 
Example #16
Source File: DescriptionObservableEditingSupport.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public DescriptionObservableEditingSupport(final ColumnViewer viewer,
        final IMessageManager messageManager,
        final DataBindingContext dbc) {
    super(viewer, ProcessPackage.Literals.CONTRACT_INPUT__DESCRIPTION, messageManager, dbc);
}
 
Example #17
Source File: IEntryComposite.java    From ice with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * This operation sets the Message Manager that should be used by the
 * EntryComposite to post messages about the Entry. If the Message Manager
 * is not set, the EntryComposite will not attempt to post messages.
 *
 * @param manager
 *            The Message Manager that the EntryComposite should use.
 */
public void setMessageManager(IMessageManager manager);