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


Java SWT.ICON_WARNING属性代码示例

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


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

示例1: openTranscriptionFile

protected void openTranscriptionFile(File f) {
	if (!textEditor.isDisposed()) {
		try {
			closeTranscription();
			transcriptionFile = f;
			textEditor.loadTranscription(transcriptionFile);
			textFilesCache.add(transcriptionFile);
			shell.setText(f.getName());
		} catch (Exception e) {
			textEditor.clear();
			textFilesCache.remove(transcriptionFile);
			MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
			diag.setMessage("Unable to open file " + f.getPath());
			diag.open();
			transcriptionFile = null;
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:18,代码来源:PmTrans.java

示例2: exportTextFile

protected void exportTextFile() {
	boolean done = false;
	while (!done)
		if (!textEditor.isDisposed()) {
			FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
			fd.setFilterNames(new String[] { "Plain text file (*.txt)", "All Files (*.*)" });
			fd.setFilterExtensions(new String[] { "*.txt", "*.*" });
			String lastPath = Config.getInstance().getString(Config.LAST_EXPORT_TRANSCRIPTION_PATH);
			if (lastPath != null && !lastPath.isEmpty())
				fd.setFileName(lastPath);
			String file = fd.open();
			try {
				if (file != null) {
					Config.getInstance().putValue(Config.LAST_EXPORT_TRANSCRIPTION_PATH, file);
					File destFile = new File(file);
					boolean overwrite = true;
					if (destFile.exists())
						overwrite = MessageDialog.openConfirm(shell, "Overwrite current file?",
								"Would you like to overwrite " + destFile.getName() + "?");
					if (overwrite) {
						textEditor.exportText(new File(file));
						done = true;
					}
				} else
					done = true;
			} catch (Exception e) {
				e.printStackTrace();
				MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
				diag.setMessage("Unable to export to file " + transcriptionFile.getPath());
				diag.open();
			}
		}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:33,代码来源:PmTrans.java

示例3: importTextFile

protected void importTextFile(File f) {
	if (!textEditor.isDisposed()) {
		FileDialog fd = new FileDialog(shell, SWT.OPEN);
		fd.setText("Import text");
		fd.setFilterExtensions(new String[] { "*.txt;*.TXT" });
		fd.setFilterNames(new String[] { "Plain text files (*.txt)" });
		String selected = fd.open();
		if (selected != null) {
			try {
				textEditor.importText(new File(selected));
			} catch (IOException e) {
				e.printStackTrace();
				MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
				diag.setMessage("Unable to open file " + transcriptionFile.getPath());
				diag.open();
			}
		}
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:19,代码来源:PmTrans.java

示例4: initTray

private void initTray() {
    tray = display.getSystemTray();
    if (tray != null) {
        TrayItem trayItem = new TrayItem(tray, SWT.NONE);
        trayItem.setImage(ImageUtils.getImage(Images.UNBLOCKED));
        trayItem.setToolTipText(APP_NAME);
        final Menu trayMenu = new Menu(getShell(), SWT.POP_UP);
        MenuItem trayMenuItem = new MenuItem(trayMenu, SWT.PUSH);
        trayMenuItem.setText(resourceBundle.getString("exit"));
        trayMenuItem.addListener(SWT.Selection, event -> {
            if (settings.isConfirmExit()) {
                getShell().forceActive();
            }
            getShell().close();
        });
        trayItem.addListener(SWT.MenuDetect, event -> trayMenu.setVisible(true));

        ToolTip tip = new ToolTip(getShell(), SWT.BALLOON | SWT.ICON_WARNING);
        tip.setText(APP_NAME);
        tip.setAutoHide(true);
        tip.setVisible(false);
        trayItem.setToolTip(tip);
    }
}
 
开发者ID:technology16,项目名称:pgsqlblocks,代码行数:24,代码来源:ApplicationView.java

示例5: openAudioFile

protected void openAudioFile(File file) {
	// Add new file to cache and refresh the list
	closePlayer();

	// Create the player
	try {
		if (file != null && file.exists()) {

			player = new AudioPlayerTarsosDSP(file);
			GridData gd = new GridData();
			gd.grabExcessHorizontalSpace = true;
			gd.horizontalAlignment = SWT.FILL;
			gd.verticalAlignment = SWT.FILL;
			player.initGUI(shell, gd);

			audioFilesCache.add(file);
			shell.layout();
		} else {
			createNewDummyPlayer();
			audioFilesCache.remove(file);
			MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
			diag.setMessage("Unable to open file " + file.getPath());
			diag.open();
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:28,代码来源:PmTrans.java

示例6: promptToSaveOnClose

@Override
public int promptToSaveOnClose() {
	MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING);
	messageBox.setText("Convertigo");
	messageBox.setMessage("A transaction is currently running.\nThe connector editor can't be closed.");
	messageBox.open();
	
	return CANCEL;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:9,代码来源:ConnectorEditor.java

示例7: promptToSaveOnClose

@Override
public int promptToSaveOnClose() {
	MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING);
	messageBox.setText("Convertigo");
	messageBox.setMessage("A sequence is currently running.\nThe sequence editor can't be closed.");
	messageBox.open();
	
	return CANCEL;
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:9,代码来源:SequenceEditor.java

示例8: refreshDifference

void refreshDifference () {
	DeviceData info = display.getDeviceData ();
	if (!info.tracking) {
		MessageBox dialog = new MessageBox (shell, SWT.ICON_WARNING | SWT.OK);
		dialog.setText (shell.getText ());
		dialog.setMessage ("Warning: Device is not tracking resource allocation"); //$NON-NLS-1$
		dialog.open ();
	}
	Object [] newObjects = info.objects;
	Error [] newErrors = info.errors;
	Object [] diffObjects = new Object [newObjects.length];
	Error [] diffErrors = new Error [newErrors.length];
	int count = 0;
	for (int i=0; i<newObjects.length; i++) {
		int index = 0;
		while (index < oldObjects.length) {
			if (newObjects [i] == oldObjects [index]) break;
			index++;
		}
		if (index == oldObjects.length) {
			diffObjects [count] = newObjects [i];
			diffErrors [count] = newErrors [i];
			count++;
		}
	}
	objects = new Object [count];
	errors = new Error [count];
	System.arraycopy (diffObjects, 0, objects, 0, count);
	System.arraycopy (diffErrors, 0, errors, 0, count);
	list.removeAll ();
	text.setText (""); //$NON-NLS-1$
	canvas.redraw ();
	for (int i=0; i<objects.length; i++) {
		list.add (objectName (objects [i]));
	}
	refreshLabel ();
	layout ();
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:38,代码来源:Sleak.java

示例9: warnVersion

/**
 * Shows a message box with version warning.
 * @param isError does the error block the project from opening
 */
private static void warnVersion(Shell parent, String error, boolean isError) {
    MessageBox mb = new MessageBox(
            parent, isError? SWT.ICON_ERROR : SWT.ICON_WARNING);
    mb.setText(Messages.OpenProjectUtils_version_error);

    String msg = isError? Messages.OpenProjectUtils_proj_version_unsupported :
        Messages.OpenProjectUtils_proj_version_warn;
    mb.setMessage(msg + error);
    mb.open();
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:14,代码来源:OpenProjectUtils.java

示例10: saveParameters

private boolean saveParameters() {
	String currentFilePath = (String) parameterTableViewer
			.getData(MultiParameterFileDialogConstants.CURRENT_PARAM_FILE);
	if (!StringUtils.isEmpty(currentFilePath)) {
		
		Map<String, String> parameterMap = new LinkedHashMap<>();
		for (Parameter parameter : parameters) {
			if(StringUtils.isEmpty(parameter.getParameterName())){
				MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
				messageBox.setText(ErrorMessages.WARNING);
				messageBox.setMessage(ErrorMessages.BLANK_PARAMETER_WILL_BE_LOST);
				int response = messageBox.open();
				if (response != SWT.OK) {
					return false;
				}
			}else{
			parameterMap.put(parameter.getParameterName(),
					parameter.getParameterValue());
			}
		}
		try {
			ParameterFileManager.getInstance().storeParameters(parameterMap, null, currentFilePath);
			ifNotified = false;
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}

	populateParameterSearchBox();
	return true;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:31,代码来源:MultiParameterFileDialog.java

示例11: open

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);
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:12,代码来源:CustomMessageBox.java

示例12: isFileExistsOnLocalFileSystem

/**
 * Check if file exist on local file system. 
 * @param jobFilePath
 * @param textBox
 * @return
 */
private boolean isFileExistsOnLocalFileSystem(IPath jobFilePath, Text textBox) {
	jobFilePath=jobFilePath.removeFileExtension().addFileExtension(Constants.XML_EXTENSION_FOR_IPATH);
	try {
		if (ResourcesPlugin.getWorkspace().getRoot().getFile(jobFilePath).exists()){
			return true;
		}
		else if (jobFilePath.toFile().exists()){
			return true;
		}
	} catch (Exception exception) {
		logger.error("Error occured while cheking file on local file system", exception);
	}
	MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(), SWT.ICON_WARNING | SWT.YES
			| SWT.NO);
	messageBox.setMessage(jobFilePath.lastSegment()+Messages.FILE_DOES_NOT_EXISTS);
	messageBox.setText(jobFilePath.toString() +Messages.NOT_EXISTS);
	int response = messageBox.open();
	if (response == SWT.YES) {
		jobFilePath=jobFilePath.removeFileExtension().addFileExtension(Constants.JOB_EXTENSION_FOR_IPATH);
		textBox.setText(jobFilePath.toString().substring(1));
	}
	else{
		textBox.setText("");
	}
	return false;
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:32,代码来源:FilterOperationClassUtility.java

示例13: getMessageBoxIcon

private int getMessageBoxIcon(String messageBoxType){
	if(StringUtils.equals(MessageBoxText.ERROR, messageBoxType)){
		return SWT.ICON_ERROR;
	}else if(StringUtils.equals(MessageBoxText.WARNING, messageBoxType)){
		return SWT.ICON_WARNING;
	}else{
		return SWT.ICON_INFORMATION;
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:Utils.java

示例14: messageDialogForExecutionTracking

/**
 * Opens a message dialog in case if there are issues while making
 * connection to server.
 *
 * @param job the job
 * @param shell the shell
 */
public void messageDialogForExecutionTracking(Job job, Shell shell) {
	String portNo;
	String host;
	if(job.isRemoteMode()){
		portNo = TrackingDisplayUtils.INSTANCE.getRemotePortFromPreference();
		if(StringUtils.isBlank(portNo)){
			portNo = PreferenceConstants.DEFAULT_PORT_NO;
		}
		if(PlatformUI.getPreferenceStore().getBoolean(PreferenceConstants.USE_REMOTE_CONFIGURATION)){
			host = PlatformUI.getPreferenceStore().getString(PreferenceConstants.REMOTE_HOST);
		}else{
			host = job.getHost();
		}
		
	}else{
		portNo = TrackingDisplayUtils.INSTANCE.getPortFromPreference();
		if(StringUtils.isBlank(portNo)){
			portNo = PreferenceConstants.DEFAULT_PORT_NO;
		}
		host = job.getHost();
	}
	String msg = "Execution tracking can't be displayed as connection refused on host: "
			+ host + " with port no: " + portNo;
	MessageDialog dialog = new MessageDialog(shell, "Warning", null, msg,
			SWT.ICON_WARNING, new String[] { "OK" }, 0);
	dialog.open();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:34,代码来源:HydrographServerConnection.java

示例15: checkValidWorkspace

/**
   * Return true if the argument directory is ok to use as a workspace and
   * false otherwise. A version check will be performed, and a confirmation
   * box may be displayed on the argument shell if an older version is
   * detected.
   * 
   * @return true if the argument URL is ok to use as a workspace and false
   *         otherwise.
   */
  private boolean checkValidWorkspace(Shell shell, URL url) {
      // a null url is not a valid workspace
      if (url == null) {
	return false;
}

      String version = readWorkspaceVersion(url);

      // if the version could not be read, then there is not any existing
      // workspace data to trample, e.g., perhaps its a new directory that
      // is just starting to be used as a workspace
      if (version == null) {
	return true;
}

      final int ide_version = Integer.parseInt(WORKSPACE_VERSION_VALUE);
      int workspace_version = Integer.parseInt(version);

      // equality test is required since any version difference (newer
      // or older) may result in data being trampled
      if (workspace_version == ide_version) {
	return true;
}

      // At this point workspace has been detected to be from a version
      // other than the current ide version -- find out if the user wants
      // to use it anyhow.
      String title = IDEWorkbenchMessages.IDEApplication_versionTitle_newerWorkspace;
      String message = NLS.bind(IDEWorkbenchMessages.IDEApplication_versionMessage_newerWorkspace, url.getFile());

      MessageBox mbox = new MessageBox(shell, SWT.OK | SWT.CANCEL
              | SWT.ICON_WARNING | SWT.APPLICATION_MODAL);
      mbox.setText(title);
      mbox.setMessage(message);
      return mbox.open() == SWT.OK;
  }
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:45,代码来源:Application.java


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