Example usage for org.eclipse.jface.dialogs MessageDialog INFORMATION

List of usage examples for org.eclipse.jface.dialogs MessageDialog INFORMATION

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Prototype

int INFORMATION

To view the source code for org.eclipse.jface.dialogs MessageDialog INFORMATION.

Click Source Link

Document

Constant for the info image, or a simple dialog with the info image and a single OK button (value 2).

Usage

From source file:eu.modelwriter.marker.command.MarkAllHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    if (AlloyUtilities.isExists()) {
        this.createMarkers();
        this.refresh();
    } else {//from  w  ww . ja va 2 s . c o m
        MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(), "System Information", null,
                "You dont have any registered alloy file to system.", MessageDialog.INFORMATION,
                new String[] { "OK" }, 0);
        infoDialog.open();
    }
    return null;
}

From source file:eu.modelwriter.marker.command.MarkAllInWorkspaceHandler.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    if (AlloyUtilities.isExists()) {
        this.file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
                .getEditorInput().getAdapter(IFile.class);
        this.selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
                .getSelection();//from w  ww . ja va  2 s  .com

        this.createMarkersWs();
        this.refresh();
    } else {
        MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(), "System Information", null,
                "You dont have any registered alloy file to system.", MessageDialog.INFORMATION,
                new String[] { "OK" }, 0);
        infoDialog.open();
    }
    return null;
}

From source file:eu.modelwriter.marker.command.MarkHandler.java

License:Open Source License

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    if (AlloyUtilities.isExists()) {
        createMarker();/*from w w w.  ja  v a 2  s . c om*/
        refresh();
    } else {
        final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(), "System Information",
                null, "You dont have any registered alloy file to system.", MessageDialog.INFORMATION,
                new String[] { "OK" }, 0);
        infoDialog.open();
    }
    return null;
}

From source file:eu.modelwriter.marker.command.MarkWithTypeHandler.java

License:Open Source License

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    if (AlloyUtilities.isExists()) {
        return markWithType();
    } else {// w ww  . j a v  a2 s .  c  o  m
        final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(), "System Information",
                null, "You dont have any registered alloy file to system.", MessageDialog.INFORMATION,
                new String[] { "OK" }, 0);
        infoDialog.open();
    }
    return null;
}

From source file:eu.modelwriter.marker.command.MarkWithTypeHandler.java

License:Open Source License

private Object markWithType() {
    file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
            .getEditorInput().getAdapter(IFile.class);
    selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();

    if (!MarkerPage.isParsed()) {
        final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Type Information", null,
                "You dont have any marker type registered to system! \n" + "Please parse an alloy file first",
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        dialog.open();//  w  w w.  ja  v a 2 s  .co m
        return null;
    }

    final IMarker selectedMarker = getMarker();
    if (selectedMarker != null) {
        final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information", null,
                "In these area, there is already a marker", MessageDialog.WARNING, new String[] { "OK" }, 0);
        dialog.open();
        return null;
    } else if (selection instanceof ITextSelection && ((ITextSelection) selection).getLength() == 0) {
        final MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information", null,
                "Please make a valid selection", MessageDialog.WARNING, new String[] { "OK" }, 0);
        dialog.open();
        return null;
    }

    final MarkerWizard markerWizard = new MarkerWizard(selection, file);
    final WizardDialog dialog = new WizardDialog(MarkerActivator.getShell(), markerWizard);
    dialog.open();

    Visualization.showViz();
    return null;
}

From source file:eu.modelwriter.marker.ui.Activator.java

License:Open Source License

public static MessageDialog infoDialogOK(String title, String message) {
    return new MessageDialog(getShell(), title, null, message, MessageDialog.INFORMATION, 0, "OK");
}

From source file:eu.modelwriter.marker.ui.Activator.java

License:Open Source License

public static MessageDialog infoDialogYESNO(String title, String message) {
    return new MessageDialog(getShell(), title, null, message, MessageDialog.INFORMATION, 0, "Yes", "No");
}

From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.AddRemoveTypeCommand.java

License:Open Source License

private void addRemoveType() {
    if (!MarkerPage.isParsed()) {
        final MessageDialog parseCtrlDialog = new MessageDialog(Activator.getShell(), "Type Information", null,
                "You dont have any marker type registered to system! \n" + "Please parse an alloy file first",
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        parseCtrlDialog.open();//from w w  w. ja va  2s  .  co m
        return;
    }

    final ActionSelectionDialog actionSelectionDialog = new ActionSelectionDialog(Activator.getShell());
    actionSelectionDialog.open();
    if (actionSelectionDialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
        return;
    }

    IMarker selectedMarker = this.marker;
    selectedMarker = MarkUtilities.getLeaderOfMarker(selectedMarker);

    if (selectedMarker != null && selectedMarker.exists()) {
        this.findCandidateToTypeChangingMarkers(selectedMarker);
        if (actionSelectionDialog.getReturnCode() == IDialogConstants.YES_ID) {
            AddRemoveTypeCommand.addType(selectedMarker);
        } else if (actionSelectionDialog.getReturnCode() == IDialogConstants.NO_ID) {
            final MessageDialog warningDialog = new MessageDialog(Activator.getShell(), "Warning!", null,
                    "If you remove marker's type, all relations of this marker has been removed! Do you want to continue to remove marker's type?",
                    MessageDialog.WARNING, new String[] { "YES", "NO" }, 0);
            final int returnCode = warningDialog.open();
            if (returnCode != 0) {
                return;
            }
            this.removeType(selectedMarker);
        }
    } else {
        final MessageDialog dialog = new MessageDialog(Activator.getShell(),
                "There is no marker in this position", null, "Please select valid marker",
                MessageDialog.INFORMATION, new String[] { "OK" }, 0);
        dialog.open();
        return;
    }
}

From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.AddRemoveTypeCommand.java

License:Open Source License

private void removeType(IMarker selectedMarker) {
    selectedMarker = AnnotationFactory.convertAnnotationType(selectedMarker, true, true,
            AlloyUtilities.getTotalTargetCount(selectedMarker));

    IMarker marker = null;//from w  w w  . j  ava  2s .  com
    for (int i = 1; i < this.candidateToTypeChanging.size(); i++) {
        marker = this.candidateToTypeChanging.get(i);
        AnnotationFactory.convertAnnotationType(marker, true, MarkUtilities.compare(marker, selectedMarker),
                AlloyUtilities.getTotalTargetCount(marker));
    }
    AlloyUtilities.removeAllRelationsOfMarker(selectedMarker);
    AlloyUtilities.removeRelationOfMarker(selectedMarker);
    if (MarkUtilities.getGroupId(selectedMarker) != null) {
        final List<IMarker> group = MarkerFactory.findMarkersByGroupId(selectedMarker.getResource(),
                MarkUtilities.getGroupId(selectedMarker));
        for (final IMarker iMarker : group) {
            AlloyUtilities.removeTypeFromMarker(iMarker);
            MarkUtilities.setType(iMarker, null);
        }
    } else {
        AlloyUtilities.removeTypeFromMarker(selectedMarker);
        MarkUtilities.setType(selectedMarker, null);
    }

    final MessageDialog removeSuccessDialog = new MessageDialog(Activator.getShell(), "Removing Type Action",
            null, "Selected marker's type has been removed.", MessageDialog.INFORMATION, new String[] { "OK" },
            0);
    removeSuccessDialog.open();
}

From source file:eu.modelwriter.marker.ui.internal.views.visualizationview.commands.AddRemoveTypeCommand.java

License:Open Source License

@Override
public void run() {
    if (AlloyUtilities.isExists()) {
        this.candidateToTypeChanging = new ArrayList<IMarker>();
        this.addRemoveType();
    } else {/*w w  w  . j a va  2s . c o m*/
        final MessageDialog infoDialog = new MessageDialog(Activator.getShell(), "System Information", null,
                "You dont have any registered alloy file to system.", MessageDialog.INFORMATION,
                new String[] { "OK" }, 0);
        infoDialog.open();
    }
}