本文整理匯總了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;
}
}