use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class IpnbCodePanel method updatePrompt.
public void updatePrompt() {
final Application application = ApplicationManager.getApplication();
application.invokeAndWait(() -> {
myCell.setPromptNumber(-1);
final String promptText = IpnbEditorUtil.prompt(myCell.getPromptNumber(), IpnbEditorUtil.PromptType.In);
myPromptLabel.setText(promptText);
}, ModalityState.stateForComponent(this));
}
use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class MvcModuleStructureSynchronizer method scheduleRunActions.
private void scheduleRunActions() {
if (myProject.isDisposed())
return;
final Application app = ApplicationManager.getApplication();
if (app.isUnitTestMode()) {
if (ourGrailsTestFlag && !myProject.isInitialized()) {
runActions(computeRawActions(takeOrderSnapshot()));
}
return;
}
final Set<Pair<Object, SyncAction>> orderSnapshot = takeOrderSnapshot();
ReadTask task = new ReadTask() {
@Nullable
@Override
public Continuation performInReadAction(@NotNull final ProgressIndicator indicator) throws ProcessCanceledException {
final Set<Trinity<Module, SyncAction, MvcFramework>> actions = isUpToDate() ? computeRawActions(orderSnapshot) : Collections.<Trinity<Module, SyncAction, MvcFramework>>emptySet();
return new Continuation(() -> {
if (isUpToDate()) {
runActions(actions);
} else if (!indicator.isCanceled()) {
scheduleRunActions();
}
}, ModalityState.NON_MODAL);
}
@Override
public void onCanceled(@NotNull ProgressIndicator indicator) {
scheduleRunActions();
}
private boolean isUpToDate() {
return !myProject.isDisposed() && orderSnapshot.equals(takeOrderSnapshot());
}
};
GuiUtils.invokeLaterIfNeeded(() -> ProgressIndicatorUtils.scheduleWithWriteActionPriority(ourExecutor, task), ModalityState.NON_MODAL);
}
use of com.intellij.openapi.application.Application in project intellij-community by JetBrains.
the class MvcModuleStructureUtil method updateModuleStructure.
public static void updateModuleStructure(final Module module, MvcProjectStructure structure, @NotNull VirtualFile root) {
final Pair<Collection<Consumer<ModifiableRootModel>>, Collection<Consumer<ModifiableFacetModel>>> actions = getUpdateProjectStructureActions(Collections.singletonList(root), structure);
// update module
if (!actions.first.isEmpty()) {
ModuleRootModificationUtil.updateModel(module, model -> {
for (final Consumer<ModifiableRootModel> action : actions.first) {
action.consume(model);
}
});
}
// update facets
if (!actions.second.isEmpty()) {
final Application application = ApplicationManager.getApplication();
final ModifiableFacetModel model = application.runReadAction(new Computable<ModifiableFacetModel>() {
@Override
public ModifiableFacetModel compute() {
return FacetManager.getInstance(module).createModifiableModel();
}
});
for (Consumer<ModifiableFacetModel> action : actions.second) {
action.consume(model);
}
application.invokeAndWait(() -> application.runWriteAction(() -> model.commit()));
}
}
use of com.intellij.openapi.application.Application in project smali by JesusFreke.
the class ITNProxy method createParameters.
public static Map<String, String> createParameters(ErrorBean error) {
Map<String, String> params = ContainerUtil.newLinkedHashMap(40);
params.put("protocol.version", "1");
params.put("os.name", SystemProperties.getOsName());
params.put("java.version", SystemProperties.getJavaVersion());
params.put("java.vm.vendor", SystemProperties.getJavaVmVendor());
ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
Application application = ApplicationManager.getApplication();
params.put("app.name", namesInfo.getProductName());
params.put("app.name.full", namesInfo.getFullProductName());
params.put("app.name.version", appInfo.getVersionName());
params.put("app.eap", Boolean.toString(appInfo.isEAP()));
params.put("app.internal", Boolean.toString(application.isInternal()));
params.put("app.build", appInfo.getBuild().asString());
params.put("app.version.major", appInfo.getMajorVersion());
params.put("app.version.minor", appInfo.getMinorVersion());
params.put("app.build.date", format(appInfo.getBuildDate()));
params.put("app.build.date.release", format(appInfo.getMajorReleaseBuildDate()));
params.put("app.compilation.timestamp", IdeaLogger.getOurCompilationTimestamp());
UpdateSettings updateSettings = UpdateSettings.getInstance();
params.put("update.channel.status", updateSettings.getSelectedChannelStatus().getCode());
params.put("update.ignored.builds", StringUtil.join(updateSettings.getIgnoredBuildNumbers(), ","));
params.put("plugin.name", error.getPluginName());
params.put("plugin.version", error.getPluginVersion());
params.put("last.action", error.getLastAction());
params.put("previous.exception", error.getPreviousException() == null ? null : Integer.toString(error.getPreviousException()));
params.put("error.message", error.getMessage());
params.put("error.stacktrace", error.getStackTrace());
params.put("error.description", error.getDescription());
params.put("assignee.id", error.getAssigneeId() == null ? null : Integer.toString(error.getAssigneeId()));
for (Attachment attachment : error.getAttachments()) {
params.put("attachment.name", attachment.getName());
params.put("attachment.value", attachment.getEncodedBytes());
}
return params;
}
use of com.intellij.openapi.application.Application in project ideavim by JetBrains.
the class UiHelper method requestFocus.
/**
* Get focus reliably.
*/
public static void requestFocus(@NotNull final JComponent component) {
final Application application = ApplicationManager.getApplication();
// XXX: This workaround is required at least for Oracle Java 6
application.invokeLater(new Runnable() {
@Override
public void run() {
application.invokeLater(new Runnable() {
@Override
public void run() {
component.requestFocus();
}
});
}
});
}
Aggregations