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

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

Introduction

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

Prototype

public static void openWarning(Shell parent, String title, String message) 

Source Link

Document

Convenience method to open a standard warning dialog.

Usage

From source file:com.netxforge.netxstudio.screens.ch9.ObjectExpressions.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // invalid, and we should cancel the action and warn the user.
        if (primaryContextObject instanceof CDOObject && ((CDOObject) primaryContextObject).cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }/*from  ww w.  j  a  v  a  2 s.  c  o  m*/
    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}

From source file:com.netxforge.netxstudio.screens.f1.NewEditDerivedResource.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        // We also set the reference to this expression, we need to
        // referee and a feature for this.
        Command ac = new AddCommand(editingService.getEditingDomain(), owner.getProfileResources(),
                this.derivedResource);

        editingService.getEditingDomain().getCommandStack().execute(ac);

        // We can't add this resource now, we need a referee.
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will/*from   w  ww .j  a v  a2  s . c o  m*/
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (derivedResource.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
        System.out.println(derivedResource.cdoID() + "" + derivedResource.cdoState());

    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }

}

From source file:com.netxforge.netxstudio.screens.f2.NewEditParameter.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(this) && owner != null) {
        // If new, we have been operating on an object not added yet.
        Command c;//from w w w . j ava 2  s.  co m

        c = new AddCommand(editingService.getEditingDomain(), owner.getContents(), parameter);

        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (parameter.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }

    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}

From source file:com.netxforge.netxstudio.screens.f2.NewEditResource.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        CompoundCommand c = new CompoundCommand();

        if (res instanceof NetXResource) {

            Command addResource = new AddCommand(editingService.getEditingDomain(), owner.getContents(),
                    (NetXResource) res);

            c.append(addResource);//  ww  w . j a v a  2 s  .  c o  m
            //
            // Command refBidiCommand = new AddCommand(
            // editingService.getEditingDomain(),
            // ((Component) referingComponent).getResourceRefs(),
            // (NetXResource) res);
            //
            // c.append(refBidiCommand);

        }
        editingService.getEditingDomain().getCommandStack().execute(c);

    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (res.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
        // System.out.println(res.cdoID() + "" + res.cdoState());

    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }

}

From source file:com.netxforge.netxstudio.screens.f3.NewEditSite.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        Command c;/*from w  w  w. j a  va 2  s .  c  om*/

        c = new AddCommand(editingService.getEditingDomain(), owner.getSites(), site);

        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (site.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}

From source file:com.netxforge.netxstudio.screens.f3.NewEditWarehouse.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        Command c;/*from  ww  w  . java  2 s  .  c  om*/

        c = new AddCommand(editingService.getEditingDomain(), owner.getContents(), warehouse);

        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (warehouse.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
        System.out.println(warehouse.cdoID() + "" + warehouse.cdoState());

    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}

From source file:com.netxforge.netxstudio.screens.f4.NewEditJob.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        Command c = new AddCommand(editingService.getEditingDomain(), owner.getContents(), job);
        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will//from w  w w  .j  av a2s . co m
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (job.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }

        // Command c = new ReplaceCommand(editingService.getEditingDomain(),
        // owner.getContents(), original, job);
        // editingService.getEditingDomain().getCommandStack().execute(c);

        // Databinding would have occured on the object, not through the
        // editing
        // domain, so no point in creating a command. It won't be undoable.

    }
    // After our edit, we shall be dirty only if using the editing domain.
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}

From source file:com.netxforge.netxstudio.screens.f4.NewEditMappingColumn.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && mappingColumns != null) {
        // If new, we have been operating on an object not added yet.
        Command c = new AddCommand(editingService.getEditingDomain(), mappingColumns, mxlsColumn);

        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will//  w w  w . j  a va2s . com
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (mxlsColumn.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }

}

From source file:com.netxforge.netxstudio.screens.f4.NewEditMetricSource.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        Command c = new AddCommand(editingService.getEditingDomain(), owner.getContents(), metricSource);
        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will/* w  w w . j a v  a 2 s.  com*/
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (metricSource.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}

From source file:com.netxforge.netxstudio.screens.nf4.NewEditUser.java

License:Open Source License

public void addData() {
    if (ScreenUtil.isNewOperation(getOperation()) && owner != null) {
        // If new, we have been operating on an object not added yet.
        Command c = new AddCommand(editingService.getEditingDomain(), owner.getContents(), user);
        editingService.getEditingDomain().getCommandStack().execute(c);
    } else if (ScreenUtil.isEditOperation(getOperation())) {
        // If edit, we have been operating on a copy of the object, so we
        // have to replace. However if our original object is invalid, this
        // will//from   w  w w.ja  v  a 2 s.co  m
        // cause invalidity, so the action will not occure in case the
        // original is
        // invalid, and we should cancel the action and warn the user.
        if (user.cdoInvalid()) {
            MessageDialog.openWarning(Display.getDefault().getActiveShell(), "Conflict",
                    "There is a conflict with another user. Your changes can't be saved.");
            return;
        }
        System.out.println(user.cdoID() + "" + user.cdoState());

    }
    // After our edit, we shall be dirty
    if (editingService.isDirty()) {
        editingService.doSave(new NullProgressMonitor());
    }
}