mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (warnings; formatting)
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.internal;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -30,13 +16,15 @@ public class TestWriteActionUnderProgress extends DumbAwareAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
ApplicationImpl app = (ApplicationImpl)ApplicationManager.getApplication();
|
||||
boolean success;
|
||||
|
||||
boolean success = app.runWriteActionWithNonCancellableProgressInDispatchThread(
|
||||
"Progress", null, null,
|
||||
TestWriteActionUnderProgress::runIndeterminateProgress);
|
||||
success = app.runWriteActionWithNonCancellableProgressInDispatchThread(
|
||||
"Progress", null, null, TestWriteActionUnderProgress::runIndeterminateProgress);
|
||||
assert success;
|
||||
|
||||
app.runWriteActionWithProgressInBackgroundThread("Cancellable Progress", null, null, "Stop", TestWriteActionUnderProgress::runDeterminateProgress);
|
||||
success = app.runWriteActionWithProgressInBackgroundThread(
|
||||
"Cancellable Progress", null, null, "Stop", TestWriteActionUnderProgress::runDeterminateProgress);
|
||||
assert success;
|
||||
}
|
||||
|
||||
private static void runDeterminateProgress(ProgressIndicator indicator) {
|
||||
@@ -61,4 +49,4 @@ public class TestWriteActionUnderProgress extends DumbAwareAction {
|
||||
indicator.checkCanceled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+23
-18
@@ -129,6 +129,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
getPicoContainer().registerComponentInstance(Application.class, this);
|
||||
getPicoContainer().registerComponentInstance(TransactionGuard.class.getName(), myTransactionGuard);
|
||||
|
||||
//noinspection AssignmentToStaticFieldFromInstanceMethod
|
||||
BundleBase.assertKeyIsFound = IconLoader.STRICT = isUnitTestMode || isInternal;
|
||||
|
||||
AWTExceptionHandler.register(); // do not crash AWT on exceptions
|
||||
@@ -166,6 +167,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
}
|
||||
}));
|
||||
|
||||
//noinspection AssignmentToStaticFieldFromInstanceMethod
|
||||
WindowsCommandLineProcessor.LISTENER = (currentDirectory, commandLine) -> {
|
||||
LOG.info("Received external Windows command line: current directory " + currentDirectory + ", command line " + commandLine);
|
||||
invokeLater(() -> {
|
||||
@@ -175,6 +177,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
if (isUnitTestMode && IdeaApplication.getInstance() == null) {
|
||||
String[] args = {"inspect", "", "", ""};
|
||||
Main.setFlags(args); // set both isHeadless and isCommandLine to true
|
||||
@@ -345,13 +348,13 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be called from inside {@link #executeSuspendingWriteAction}.
|
||||
* Can be called from inside {@link #executeSuspendingWriteAction}.
|
||||
* The returned access token allows to start read action on another thread.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public Supplier<AccessToken> transferReadPrivilege() {
|
||||
ReadMostlyRWLock.SuspensionId suspensionId = myLock.currentReadPrivilege();
|
||||
return () -> myLock.applyReadPrivilege(suspensionId);
|
||||
return () -> myLock.applyReadPrivilege(suspensionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -952,25 +955,26 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public boolean runWriteActionWithNonCancellableProgressInDispatchThread(
|
||||
@NotNull String title, @Nullable Project project, @Nullable JComponent parentComponent,
|
||||
@NotNull Consumer<ProgressIndicator> action
|
||||
) {
|
||||
public boolean runWriteActionWithNonCancellableProgressInDispatchThread(@NotNull String title,
|
||||
@Nullable Project project,
|
||||
@Nullable JComponent parentComponent,
|
||||
@NotNull Consumer<ProgressIndicator> action) {
|
||||
return runEdtProgressWriteAction(title, project, parentComponent, null, action);
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public boolean runWriteActionWithCancellableProgressInDispatchThread(
|
||||
@NotNull String title, @Nullable Project project, @Nullable JComponent parentComponent,
|
||||
@NotNull Consumer<ProgressIndicator> action
|
||||
) {
|
||||
public boolean runWriteActionWithCancellableProgressInDispatchThread(@NotNull String title,
|
||||
@Nullable Project project,
|
||||
@Nullable JComponent parentComponent,
|
||||
@NotNull Consumer<ProgressIndicator> action) {
|
||||
return runEdtProgressWriteAction(title, project, parentComponent, IdeBundle.message("action.stop"), action);
|
||||
}
|
||||
|
||||
private boolean runEdtProgressWriteAction(
|
||||
@NotNull String title, @Nullable Project project, @Nullable JComponent parentComponent, @Nullable String cancelText,
|
||||
@NotNull Consumer<ProgressIndicator> action
|
||||
) {
|
||||
private boolean runEdtProgressWriteAction(@NotNull String title,
|
||||
@Nullable Project project,
|
||||
@Nullable JComponent parentComponent,
|
||||
@Nullable String cancelText,
|
||||
@NotNull Consumer<ProgressIndicator> action) {
|
||||
Class<?> clazz = action.getClass();
|
||||
startWrite(clazz);
|
||||
try {
|
||||
@@ -984,10 +988,11 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App
|
||||
}
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public boolean runWriteActionWithProgressInBackgroundThread(
|
||||
@NotNull String title, @Nullable Project project, @Nullable JComponent parentComponent, @Nullable String cancelText,
|
||||
@NotNull Consumer<ProgressIndicator> action
|
||||
) {
|
||||
public boolean runWriteActionWithProgressInBackgroundThread(@NotNull String title,
|
||||
@Nullable Project project,
|
||||
@Nullable JComponent parentComponent,
|
||||
@Nullable String cancelText,
|
||||
@NotNull Consumer<ProgressIndicator> action) {
|
||||
Class<?> clazz = action.getClass();
|
||||
startWrite(clazz);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user