List of usage examples for org.eclipse.jface.operation ModalContext getModalLevel
public static int getModalLevel()
From source file:com.twinsoft.convertigo.eclipse.ConvertigoPlugin.java
License:Open Source License
public static boolean[] warningGlobalSymbols(final String projectName, final String objectName, final String objectType, final String propertyName, final String propertyValue, final Set<String> undefinedSymboles, final boolean showCheckBox) { final boolean[] result = { false, false }; getDisplay().syncExec(new Runnable() { public void run() { try { int level = ModalContext.getModalLevel(); if (level > 0) { // prevents double modal windows: dead lock on linux/gtk studio getDisplay().syncExec(this); return; }/*from ww w. j ava 2 s . com*/ GlobalsSymbolsWarnDialog dialogGlobalSymbols = new GlobalsSymbolsWarnDialog( getDisplay().getActiveShell(), projectName, objectName, objectType, propertyName, propertyValue, undefinedSymboles, showCheckBox); dialogGlobalSymbols.open(); result[0] = dialogGlobalSymbols.getCreateAction(); result[1] = dialogGlobalSymbols.getCheckButtonSelection(); } catch (Exception e) { ConvertigoPlugin.logException(e, "Error while trying to open warning global symbols box"); } } }); return result; }
From source file:com.twinsoft.convertigo.eclipse.views.projectexplorer.model.ProjectTreeObject.java
License:Open Source License
public void checkMissingProjects() { if (isCheckMissingProjects) { return;//from w w w . j av a 2s.c o m } final Project project = getObject(); final Set<String> missingProjects = project.getMissingProjects(); final Set<String> missingProjectReferences = project.getMissingProjectReferences(); if (!missingProjects.isEmpty() || !missingProjectReferences.isEmpty()) { isCheckMissingProjects = true; Display.getDefault().asyncExec(new Runnable() { @Override public void run() { try { int level = ModalContext.getModalLevel(); if (level > 0) { // prevents double modal windows: dead lock on linux/gtk studio Display.getDefault().asyncExec(this); return; } String message = "For \"" + project.getName() + "\" project :\n"; for (String targetProjectName : missingProjects) { message += " > The project \"" + targetProjectName + "\" is missing\n"; } for (String targetProjectName : missingProjectReferences) { message += " > The reference to project \"" + targetProjectName + "\" is missing\n"; } message += "\nPlease create missing reference(s) and import missing project(s),\nor correct your sequence(s)."; if (!missingProjectReferences.isEmpty()) { int response = ConvertigoPlugin.questionMessageBox(null, message + "\n\nDo you want to automatically add reference objects ?"); if (response == SWT.YES) { for (String targetProjectName : missingProjectReferences) { try { ProjectSchemaReference reference = new ProjectSchemaReference(); reference.setProjectName(targetProjectName); reference.setName(targetProjectName + "_reference"); project.add(reference); ProjectExplorerView explorerView = ConvertigoPlugin.projectManager .getProjectExplorerView(); explorerView.reloadTreeObject(ProjectTreeObject.this); } catch (Exception e) { ConvertigoPlugin.logException(e, "failed to add a reference to '" + targetProjectName + "'"); } } hasBeenModified(true); } } else { ConvertigoPlugin.warningMessageBox(message); } } finally { isCheckMissingProjects = false; } } }); } }