Java Code Examples for org.eclipse.jface.dialogs.MessageDialog.openWarning()

The following are Jave code examples for showing how to use openWarning() of the org.eclipse.jface.dialogs.MessageDialog class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: neoscada   File: ConfirmationDialogFuture.java   Source Code and License Vote up 5 votes
private Boolean showDialog ( final ConfirmationCallback cb, final Display display, final Shell parentShell, final String dialogTitle )
{
    switch ( cb.getConfirmationType () )
    {
        case CONFIRM:
            return MessageDialog.openConfirm ( parentShell, dialogTitle, cb.getLabel () ) ? true : null;
        case ERROR:
            MessageDialog.openError ( parentShell, dialogTitle, cb.getLabel () );
            return true;
        case WARNING:
            MessageDialog.openWarning ( parentShell, dialogTitle, cb.getLabel () );
            return true;
        case INFORMATION:
            MessageDialog.openInformation ( parentShell, dialogTitle, cb.getLabel () );
            return true;
        case QUESTION:
            return MessageDialog.openQuestion ( parentShell, dialogTitle, cb.getLabel () );
        case QUESTION_WITH_CANCEL:
        {
            final MessageDialog dialog = new MessageDialog ( parentShell, dialogTitle, null, cb.getLabel (), MessageDialog.QUESTION_WITH_CANCEL, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }, 0 );
            final int result = dialog.open ();
            if ( result == 2 /*CANCEL*/)
            {
                return null;
            }
            else
            {
                return result == Window.OK;
            }
        }
        default:
            throw new IllegalArgumentException ( String.format ( "Unable to process type: %s", cb.getConfirmationType () ) );
    }
}
 
Example 2
Project: com.onpositive.prefeditor   File: FolderSelectionDialog.java   Source Code and License Vote up 5 votes
private void addInstallation() {
	String dir = obtainDir();
	if (dir != null) {
		File prefDir = new File(dir,CONFIGURATION_SETTINGS_PATH);
		if (!prefDir.exists()) {
			MessageDialog.openWarning(getShell(),"Incorrect workspace", dir + " is either not valid Eclipse workspace or doesn't contain any workspace preferences");
		} else {
			valueAdded(prefDir.getAbsolutePath());
		}
	}
}
 
Example 3
Project: com.onpositive.prefeditor   File: FolderSelectionDialog.java   Source Code and License Vote up 5 votes
private void addWorkspace() {
	String dir = obtainDir();
	if (dir != null) {
		File prefDir = new File(dir,WORKSPACE_SETTINGS_PATH);
		if (!prefDir.exists()) {
			MessageDialog.openWarning(getShell(),"Incorrect workspace", dir + " is either not valid Eclipse workspace or doesn't contain any workspace preferences");
		} else {
			valueAdded(prefDir.getAbsolutePath());
		}
	}
}
 
Example 4
Project: Hydrograph   File: CustomMessageBox.java   Source Code and License Vote up 5 votes
public void open(){
	if(messageType==SWT.ERROR){
		MessageDialog.setDefaultOrientation(SWT.NONE);
		MessageDialog.openError(Display.getCurrent().getActiveShell(), title, message);
	}
	if(messageType==SWT.ICON_INFORMATION){
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), title, message);
	}
	if(messageType==SWT.ICON_WARNING){
		MessageDialog.openWarning(Display.getCurrent().getActiveShell(), title, message);
	}
}
 
Example 5
Project: OCCI-Studio   File: DesignServices.java   Source Code and License Vote up 5 votes
/**
 * Update an OCCI entity.
 * @param entity the entity to update.
 */
public void updateEntity(Entity entity)
{
	Client jocciClient = getJocciClient(entity);
	if(jocciClient == null) {
		return;
	}

       // Create the jOCCI entity.
       cz.cesnet.cloud.occi.core.Entity jocciEntity = newJocciEntity(entity);
       if(jocciEntity == null) {
       	return;
       }
       try {
		jocciEntity.setId(entity.getId());
	} catch (InvalidAttributeValueException iave) {
		reportException(iave);
		return;
	}

       try {
       	// Update the OCCI resource.
       	boolean updated = jocciClient.update(jocciEntity);
       	if(updated) {
             MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Update OCCI Entity", "Entity " + getLocation(entity) + " updated");
       	} else {
             MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Update OCCI Entity", "Entity " + getLocation(entity) + " not updated");
       	}
       } catch (CommunicationException ce) {
       	reportException(ce);
       	return;
       }
}
 
Example 6
Project: OCCI-Studio   File: DesignServices.java   Source Code and License Vote up 5 votes
/**
 * Delete an OCCI entity.
 * @param entity the entity to delete.
 */
public void deleteEntity(Entity entity)
{
	Client jocciClient = getJocciClient(entity);
	if(jocciClient == null) {
		return;
	}
	
	boolean deleted = false;
	try {
		deleted = jocciClient.delete(URI.create(getLocation(entity)));
	} catch (CommunicationException ce) {
		reportException(ce);
		return;
	}

   	if(deleted) {
           MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Delete OCCI Entity", "Entity " + getLocation(entity) + " deleted");
     	} else {
           MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Delete OCCI Entity", "Entity " + getLocation(entity) + " not deleted");
		return;
     	}

	if(entity instanceof org.eclipse.cmf.occi.core.Resource) {
		Configuration configuration = (Configuration)entity.eContainer();
		configuration.getResources().remove(entity);
	} else if(entity instanceof org.eclipse.cmf.occi.core.Link) {
		org.eclipse.cmf.occi.core.Link link = (org.eclipse.cmf.occi.core.Link)entity;
		link.getSource().getLinks().remove(link);
	} else {
		// Should never happen!
		reportException(new Error("Must be a Resource or a Link"));
		return;
	}
}
 
Example 7
Project: bdf2   File: CreateTransitionCommand.java   Source Code and License Vote up 5 votes
@Override
public void execute() {
	transition=new Transition(source,target);
	if(!hasTransition(source,target)){
		this.buildTransition(transition);
		transition.reconnection();
	}else{
		transition=null;
		MessageDialog.openWarning(null,"操作错误", "当前两节点上已有Transition连接!");
	}
}
 
Example 8
Project: bdf2   File: TableEditPart.java   Source Code and License Vote up 5 votes
@Override
public ConnectionAnchor getTargetConnectionAnchor(Request request) {
	if (request instanceof CreateConnectionRequest) {
		CreateConnectionRequest crequest = (CreateConnectionRequest) request;
		Table table = (Table) crequest.getSourceEditPart().getModel();
		Column c = table.getFirstPkColumn();
		if (c == null) {
			MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "提示", "此表没有主键,请先设置主键!");
			crequest.setStartCommand(null);
		}
	}
	return new ChopboxAnchor(getFigure());
}
 
Example 9
Project: n4js   File: LaunchXpectShortcut.java   Source Code and License Vote up 4 votes
private static void showDialogNotImplemented(String what) {
	MessageDialog.openWarning(null, "Warning", "Launching of type " + what + " is not implemeneted yet!");
}
 
Example 10
Project: n4js   File: GenerateXpectReportShortcut.java   Source Code and License Vote up 4 votes
private static void showDialogNotImplemented(String what) {
	MessageDialog.openWarning(null, "Warning", "Launching of type " + what + " is not implemented yet!");
}
 
Example 11
Project: n4js   File: AbstractRunnerLaunchShortcut.java   Source Code and License Vote up 4 votes
private static void showDialogNotImplemented(String what) {
	MessageDialog.openWarning(null, "Warning", "Launching of type " + what + " is not implemented yet!");
}
 
Example 12
Project: gemoc-studio-modeldebugging   File: CreateEditorProjectWizardContextAction.java   Source Code and License Vote up 4 votes
protected void createNewEMFTreeProject() {
	// launch the appropriate wizard

	// "org.eclipse.emf.importer.ui.EMFProjectWizard" = create EMFProject
	// from existing Ecore file
	/*
	 * IWizardDescriptor descriptor = PlatformUI .getWorkbench()
	 * .getNewWizardRegistry() .findWizard(
	 * "fr.obeo.mda.pim.ecore.design.wizard");
	 * 
	 * // Then if we have a wizard, open it. if (descriptor != null) { //
	 * add a listener to capture the creation of the resulting project
	 * NewProjectWorkspaceListener workspaceListener = new
	 * NewProjectWorkspaceListener();
	 * ResourcesPlugin.getWorkspace().addResourceChangeListener
	 * (workspaceListener); try { IWizard wizard; wizard =
	 * descriptor.createWizard(); // this wizard need some dedicated
	 * initialization ((EcoreModelerWizard
	 * )wizard).init(PlatformUI.getWorkbench(), (IStructuredSelection)
	 * PlatformUI
	 * .getWorkbench().getActiveWorkbenchWindow().getSelectionService
	 * ().getSelection());
	 * //((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
	 * (IStructuredSelection) selection); WizardDialog wd = new
	 * WizardDialog(
	 * PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
	 * wizard); wd.create(); wd.setTitle(wizard.getWindowTitle());
	 * 
	 * int res = wd.open(); if(res == WizardDialog.OK){
	 * ResourcesPlugin.getWorkspace
	 * ().removeResourceChangeListener(workspaceListener); IProject
	 * createdProject = workspaceListener.getLastCreatedProject(); // update
	 * the project configuration model if(createdProject != null){
	 * addEMFProjectToConf(createdProject.getName()); } else{
	 * addEMFProjectToConf(""); } } } catch (CoreException e) {
	 * Activator.error(e.getMessage(), e); } finally{ // make sure to remove
	 * listener in all situations
	 * ResourcesPlugin.getWorkspace().removeResourceChangeListener
	 * (workspaceListener); } }
	 */
	MessageDialog.openWarning(PlatformUI.getWorkbench()
			.getActiveWorkbenchWindow().getShell(),
			"Gemoc Language Workbench UI", "Action not implemented yet");
}
 
Example 13
Project: eZooKeeper   File: BaseAction.java   Source Code and License Vote up 4 votes
protected final void openWarningMessageDialog(String title, String message) {
    MessageDialog.openWarning(getActiveShell(), title, message);
}
 
Example 14
Project: gw4e.project   File: DialogManager.java   Source Code and License Vote up 4 votes
/**
 * @param title
 * @param text
 */
public static void displayWarning(String title, String text) {
	if (isAutomatedMode ()) return;
	MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, text);
}
 
Example 15
Project: Tarski   File: CreateSoftwareRequirementReviewMeetingDocument.java   Source Code and License Vote up 4 votes
public void MessageDialogAborted(IWorkbenchWindow window) {
  MessageDialog.openWarning(window.getShell(), "ModelWriter Project Management",
      "The user has aborted the document creation process");
}
 
Example 16
Project: Tarski   File: CreateUserRequirementDocument.java   Source Code and License Vote up 4 votes
public void MessageDialogAborted(IWorkbenchWindow window) {
  MessageDialog.openWarning(window.getShell(), "ModelWriter Project Management",
      "The user has aborted the document creation process");
}
 
Example 17
Project: Tarski   File: CreateUserRequirementReviewMeetingDocument.java   Source Code and License Vote up 4 votes
public void MessageDialogAborted(IWorkbenchWindow window) {
  MessageDialog.openWarning(window.getShell(), "ModelWriter Project Management",
      "The user has aborted the document creation process");
}
 
Example 18
Project: Tarski   File: CreateSoftwareRequirementDocument.java   Source Code and License Vote up 4 votes
public void MessageDialogAborted(IWorkbenchWindow window) {
  MessageDialog.openWarning(window.getShell(), "ModelWriter Project Management",
      "The user has aborted the document creation process");
}
 
Example 19
Project: OCCI-Studio   File: DesignServices.java   Source Code and License Vote up 4 votes
/**
 * Execute an OCCI action on an OCCI entity.
 * @param entity the entity on which an OCCI action will be executed.
 */
public void executeAction(Entity entity)
{
	Client jocciClient = getJocciClient(entity);
	if(jocciClient == null) {
		return;
	}

	// Get all actions of the entity.
	List<Action> actions = new ArrayList<Action>();
	addActions(entity, actions);

	// Display the OCCI action dialog.
	Shell shell = Display.getCurrent().getActiveShell();
	OcciActionDialog occiActionDialog = new OcciActionDialog(shell, actions.toArray(new Action[actions.size()]));
	occiActionDialog.create();
	if (occiActionDialog.open() != Window.OK) {
		return;
	}
	String selectedAction = occiActionDialog.getSelectedAction();
	if(selectedAction == null || selectedAction.isEmpty()) {
		return;
	}

	// Get an jOCCI entity builder.
       EntityBuilder eb = new EntityBuilder(jocciClient.getModel());
       
       // Create a jOCCI action instance.
	ActionInstance actionInstance;
	try {
		actionInstance = eb.getActionInstance(URI.create(selectedAction));
	} catch (EntityBuildingException ebe) {
		reportException(ebe);
		return;
	}

	// TODO: add action's parameters.

	// Execute the OCCI action.
       try {
       	boolean status = jocciClient.trigger(URI.create(getLocation(entity)), actionInstance);
       	if(status) {
               MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Execute OCCI Action", "Action " + selectedAction + " on " + getLocation(entity) + " executed");
         	} else {
               MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Execute OCCI Action", "Action " + selectedAction + " on " + getLocation(entity) + " failed");
         	}
	} catch (CommunicationException ce) {
		reportException(ce);
		return;
	}
}