本文整理汇总了Java中org.eclipse.jface.dialogs.MessageDialog.openWarning方法的典型用法代码示例。如果您正苦于以下问题:Java MessageDialog.openWarning方法的具体用法?Java MessageDialog.openWarning怎么用?Java MessageDialog.openWarning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.dialogs.MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.openWarning方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showDialog
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
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 () ) );
}
}
示例2: addInstallation
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
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());
}
}
}
示例3: addWorkspace
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
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());
}
}
}
示例4: open
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
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);
}
}
示例5: updateEntity
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* 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;
}
}
示例6: deleteEntity
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* 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;
}
}
示例7: execute
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@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连接!");
}
}
示例8: getTargetConnectionAnchor
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@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());
}
示例9: showDialogNotImplemented
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private static void showDialogNotImplemented(String what) {
MessageDialog.openWarning(null, "Warning", "Launching of type " + what + " is not implemeneted yet!");
}
示例10: showDialogNotImplemented
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private static void showDialogNotImplemented(String what) {
MessageDialog.openWarning(null, "Warning", "Launching of type " + what + " is not implemented yet!");
}
示例11: createNewEMFTreeProject
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
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");
}
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:45,代码来源:CreateEditorProjectWizardContextAction.java
示例12: openWarningMessageDialog
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
protected final void openWarningMessageDialog(String title, String message) {
MessageDialog.openWarning(getActiveShell(), title, message);
}
示例13: displayWarning
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* @param title
* @param text
*/
public static void displayWarning(String title, String text) {
if (isAutomatedMode ()) return;
MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), title, text);
}
示例14: MessageDialogAborted
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
public void MessageDialogAborted(IWorkbenchWindow window) {
MessageDialog.openWarning(window.getShell(), "ModelWriter Project Management",
"The user has aborted the document creation process");
}
示例15: executeAction
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* 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;
}
}