当前位置: 首页>>代码示例>>Java>>正文


Java IDEWorkbenchMessages.Question方法代码示例

本文整理汇总了Java中org.eclipse.ui.internal.ide.IDEWorkbenchMessages.Question方法的典型用法代码示例。如果您正苦于以下问题:Java IDEWorkbenchMessages.Question方法的具体用法?Java IDEWorkbenchMessages.Question怎么用?Java IDEWorkbenchMessages.Question使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.internal.ide.IDEWorkbenchMessages的用法示例。


在下文中一共展示了IDEWorkbenchMessages.Question方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryYesNoQuestion

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
/**
    * This override is provided to provide an appropriate shell vs the standard
    * approach of just using the container.
    */
   @Override
protected boolean queryYesNoQuestion(String message) {
           MessageDialog dialog = new MessageDialog(getShellForMessageDialog(),
                   IDEWorkbenchMessages.Question,
                   (Image) null, message, MessageDialog.NONE,
                   new String[] { IDialogConstants.YES_LABEL,
                           IDialogConstants.NO_LABEL }, 0) {
           	@Override
			protected int getShellStyle() {
           		return super.getShellStyle() | SWT.SHEET;
           	}
           };
           // ensure yes is the default

           return dialog.open() == 0;
       }
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:21,代码来源:AbstractEnsembleProjectExportWizardPage.java

示例2: queryYesNoQuestion

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
/**
 * Displays a Yes/No question to the user with the specified message and returns the user's response.
 *
 * @param message
 *            the question to ask
 * @return <code>true</code> for Yes, and <code>false</code> for No
 */
private boolean queryYesNoQuestion(String message) {
	MessageDialog dialog = new MessageDialog(getContainer().getShell(),
			IDEWorkbenchMessages.Question,
			(Image) null, message, MessageDialog.NONE,
			new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0) {
		@Override
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	return dialog.open() == 0;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:AbstractExportToSingleFileWizardPage.java

示例3: queryOverwrite

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
/**
 * The <code>WizardDataTransfer</code> implementation of this <code>IOverwriteQuery</code> method asks the user
 * whether the existing resource at the given path should be overwritten.
 * 
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or
 *         <code>"CANCEL"</code>
 */
public String queryOverwrite(String pathString)
{

	Path path = new Path(pathString);

	String messageString;
	// Break the message up if there is a file name and a directory
	// and there are at least 2 segments.
	if (path.getFileExtension() == null || path.segmentCount() < 2)
	{
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
	}

	else
	{
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
				path.lastSegment(), path.removeLastSegments(1).toOSString());
	}

	final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question, null,
			messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
					IDialogConstants.CANCEL_LABEL }, 0);
	String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
	// run in syncExec because callback is from an operation,
	// which is probably not running in the UI thread.
	getControl().getDisplay().syncExec(new Runnable()
	{
		public void run()
		{
			dialog.open();
		}
	});
	return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:44,代码来源:WizardFolderImportPage.java

示例4: queryOverwrite

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
/**
 * The default implementation of this <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 *
 * @param pathString
 *            the path of the archive
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or
 *         <code>"CANCEL"</code>
 */
@Override
public String queryOverwrite(String pathString) {

	IPath path = Path.fromOSString(pathString);

	String messageString;
	// Break the message up if there is a file name and a directory
	// and there are at least 2 segments.
	if (path.getFileExtension() == null || path.segmentCount() < 2) {
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
	} else {
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
				path.lastSegment(),
				path.removeLastSegments(1).toOSString());
	}

	final MessageDialog dialog = new MessageDialog(getContainer()
			.getShell(), IDEWorkbenchMessages.Question,
			null, messageString, MessageDialog.QUESTION, new String[] {
		IDialogConstants.YES_LABEL,
		IDialogConstants.YES_TO_ALL_LABEL,
		IDialogConstants.NO_LABEL,
		IDialogConstants.NO_TO_ALL_LABEL,
		IDialogConstants.CANCEL_LABEL }, 0) {
		@Override
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
	// run in syncExec because callback is from an operation,
	// which is probably not running in the UI thread.
	getControl().getDisplay().syncExec(new Runnable() {
		@Override
		public void run() {
			dialog.open();
		}
	});
	return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:50,代码来源:AbstractExportToSingleFileWizardPage.java

示例5: queryOverwrite

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
@Override
public String queryOverwrite(String pathString) {

       Path path = new Path(pathString);
       String messageString;
       //Break the message up if there is a file name and a directory
       //and there are at least 2 segments.
       if (path.getFileExtension() == null || path.segmentCount() < 2) {
       	// PATH_TO_FILE already exists.  Would you like to overwrite it?
		//messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
       	
		IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
		IPath location = folder.getLocation();
		File file = null;
		if(location == null) {
			file = new File(pathString);
		}
		
		else {
			file = location.toFile();
		}
		
		messageString = getDialogQuestionText(file);
		
	} else {
		messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(),
		path.removeLastSegments(1).toOSString());
		String osString = path.toOSString();
		Date date = new Date(new File(osString).lastModified());
		messageString += System.getProperty("line.separator") + System.getProperty("line.separator")
			+ "'" + path.lastSegment() + "' was last modified on: " + date; 
	}

       final MessageDialog dialog = new MessageDialog(getShellForMessageDialog(), IDEWorkbenchMessages.Question,
               null, messageString, MessageDialog.QUESTION, new String[] {
                       IDialogConstants.YES_LABEL,
                       IDialogConstants.YES_TO_ALL_LABEL,
                       IDialogConstants.NO_LABEL,
                       IDialogConstants.NO_TO_ALL_LABEL,
                       IDialogConstants.CANCEL_LABEL }, 0) {
       	@Override
		protected int getShellStyle() {
       		return super.getShellStyle() | SWT.SHEET;
       	}
       };
       String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
       //run in syncExec because callback is from an operation,
       //which is probably not running in the UI thread.
	WidgetUtils.runInDisplayThread(getShell(), new Runnable() {
           @Override
		public void run() {
               dialog.open();
           }
       });
       return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:57,代码来源:AbstractEnsembleProjectExportWizardPage.java

示例6: queryOverwrite

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
/**
 * The <code>WizardDataTransfer</code> implementation of this
 * <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 * 
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
 * 	<code>"ALL"</code>, or <code>"CANCEL"</code>
 */
@Override
public String queryOverwrite(String pathString) {

	Path path = new Path(pathString);

	String messageString;
	// Break the message up if there is a file name and a directory
	// and there are at least 2 segments.
	if (path.getFileExtension() == null || path.segmentCount() < 2) {
		messageString = NLS.bind(
				IDEWorkbenchMessages.WizardDataTransfer_existsQuestion,
				pathString);
	} else {
		messageString = NLS
				.bind(
						IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
						path.lastSegment(), path.removeLastSegments(1)
								.toOSString());
	}

	final MessageDialog dialog = new MessageDialog(getContainer()
			.getShell(), IDEWorkbenchMessages.Question, null,
			messageString, MessageDialog.QUESTION, new String[] {
					IDialogConstants.YES_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL,
					IDialogConstants.NO_LABEL,
					IDialogConstants.NO_TO_ALL_LABEL,
					IDialogConstants.CANCEL_LABEL }, 0) {
		@Override
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
	// run in syncExec because callback is from an operation,
	// which is probably not running in the UI thread.
	getControl().getDisplay().syncExec(new Runnable() {
		@Override
		public void run() {
			dialog.open();
		}
	});
	return dialog.getReturnCode() < 0 ? CANCEL : response[dialog
			.getReturnCode()];
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:55,代码来源:SPIFePlanIntegrationWizardPage.java

示例7: queryOverwrite

import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; //导入方法依赖的package包/类
/**
 * The <code>WizardDataTransfer</code> implementation of this
 * <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 * 
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
 * 	<code>"ALL"</code>, or <code>"CANCEL"</code>
 */
public String queryOverwrite(String pathString) {

	Path path = new Path(pathString);

	String messageString;
	// Break the message up if there is a file name and a directory
	// and there are at least 2 segments.
	if (path.getFileExtension() == null || path.segmentCount() < 2) {
		messageString = NLS.bind(
				IDEWorkbenchMessages.WizardDataTransfer_existsQuestion,
				pathString);
	} else {
		messageString = NLS
				.bind(
						IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
						path.lastSegment(), path.removeLastSegments(1)
								.toOSString());
	}

	final MessageDialog dialog = new MessageDialog(getContainer()
			.getShell(), IDEWorkbenchMessages.Question, null,
			messageString, MessageDialog.QUESTION, new String[] {
					IDialogConstants.YES_LABEL,
					IDialogConstants.YES_TO_ALL_LABEL,
					IDialogConstants.NO_LABEL,
					IDialogConstants.NO_TO_ALL_LABEL,
					IDialogConstants.CANCEL_LABEL }, 0) {
		protected int getShellStyle() {
			return super.getShellStyle() | SWT.SHEET;
		}
	};
	String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
	// run in syncExec because callback is from an operation,
	// which is probably not running in the UI thread.
	getControl().getDisplay().syncExec(new Runnable() {
		public void run() {
			dialog.open();
		}
	});
	return dialog.getReturnCode() < 0 ? CANCEL : response[dialog
			.getReturnCode()];
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:52,代码来源:ImportProjectWizardPage.java


注:本文中的org.eclipse.ui.internal.ide.IDEWorkbenchMessages.Question方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。