mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
NotNull
This commit is contained in:
@@ -20,6 +20,7 @@ import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
@@ -97,6 +98,7 @@ public class DelegatingProgressIndicator implements ProgressIndicator {
|
||||
return getDelegate().isModal();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getModalityState() {
|
||||
return getDelegate().getModalityState();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.mock;
|
||||
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MockProgressIndicator implements ProgressIndicator {
|
||||
private boolean myIsRunning = false;
|
||||
@@ -80,6 +81,7 @@ public class MockProgressIndicator implements ProgressIndicator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getModalityState() {
|
||||
return ModalityState.NON_MODAL;
|
||||
}
|
||||
@@ -96,4 +98,4 @@ public class MockProgressIndicator implements ProgressIndicator {
|
||||
|
||||
public void checkCanceled() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,7 @@ public interface Application extends ComponentManager {
|
||||
*
|
||||
* @return the current modality state.
|
||||
*/
|
||||
@NotNull
|
||||
ModalityState getCurrentModalityState();
|
||||
|
||||
/**
|
||||
@@ -216,6 +217,7 @@ public interface Application extends ComponentManager {
|
||||
* @param c the component for which the modality state is requested.
|
||||
* @return the modality state.
|
||||
*/
|
||||
@NotNull
|
||||
ModalityState getModalityStateForComponent(@NotNull Component c);
|
||||
|
||||
/**
|
||||
@@ -224,6 +226,7 @@ public interface Application extends ComponentManager {
|
||||
*
|
||||
* @return the modality state for the current thread.
|
||||
*/
|
||||
@NotNull
|
||||
ModalityState getDefaultModalityState();
|
||||
|
||||
/**
|
||||
@@ -232,6 +235,7 @@ public interface Application extends ComponentManager {
|
||||
*
|
||||
* @return the modality state for no modal dialogs.
|
||||
*/
|
||||
@NotNull
|
||||
ModalityState getNoneModalityState();
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,17 +45,20 @@ public abstract class ModalityState {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ModalityState current() {
|
||||
return ApplicationManager.getApplication().getCurrentModalityState();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ModalityState stateForComponent(Component component){
|
||||
return ApplicationManager.getApplication().getModalityStateForComponent(component);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ModalityState defaultModalityState() {
|
||||
return ApplicationManager.getApplication().getDefaultModalityState();
|
||||
}
|
||||
|
||||
public abstract boolean dominates(ModalityState anotherState);
|
||||
public abstract boolean dominates(@NotNull ModalityState anotherState);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.intellij.openapi.progress;
|
||||
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EmptyProgressIndicator implements ProgressIndicator {
|
||||
private boolean myIsRunning = false;
|
||||
@@ -80,6 +81,7 @@ public class EmptyProgressIndicator implements ProgressIndicator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getModalityState() {
|
||||
return ModalityState.NON_MODAL;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.progress;
|
||||
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ProgressIndicator {
|
||||
void start();
|
||||
@@ -60,6 +61,7 @@ public interface ProgressIndicator {
|
||||
|
||||
boolean isModal();
|
||||
|
||||
@NotNull
|
||||
ModalityState getModalityState();
|
||||
|
||||
void setModalityProgress(ProgressIndicator modalityProgress);
|
||||
@@ -69,4 +71,4 @@ public interface ProgressIndicator {
|
||||
void setIndeterminate(boolean indeterminate);
|
||||
|
||||
void checkCanceled() throws ProcessCanceledException;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -368,6 +369,7 @@ public class MergingUpdateQueue implements Runnable, Disposable, Activatable {
|
||||
return myModalityStateComponent == ANY_COMPONENT ? null : getModalityState();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getModalityState() {
|
||||
if (myModalityStateComponent == null) {
|
||||
return ModalityState.NON_MODAL;
|
||||
|
||||
@@ -631,17 +631,20 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
LaterInvocator.invokeAndWait(runnable, modalityState);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getCurrentModalityState() {
|
||||
Object[] entities = LaterInvocator.getCurrentModalEntities();
|
||||
return entities.length > 0 ? new ModalityStateEx(entities) : getNoneModalityState();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getModalityStateForComponent(@NotNull Component c) {
|
||||
Window window = c instanceof Window ? (Window)c : SwingUtilities.windowForComponent(c);
|
||||
if (window == null) return getNoneModalityState(); //?
|
||||
return LaterInvocator.modalityStateForWindow(window);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getDefaultModalityState() {
|
||||
if (EventQueue.isDispatchThread()) {
|
||||
return getCurrentModalityState();
|
||||
@@ -652,6 +655,7 @@ public class ApplicationImpl extends ComponentManagerImpl implements Application
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ModalityState getNoneModalityState() {
|
||||
return MODALITY_STATE_NONE;
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ public class LaterInvocator {
|
||||
ourModalityStateMulticaster.removeListener(listener);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static ModalityStateEx modalityStateForWindow(@NotNull Window window){
|
||||
int index = ourModalEntities.indexOf(window);
|
||||
if (index < 0){
|
||||
|
||||
+7
-4
@@ -18,6 +18,7 @@ package com.intellij.openapi.application.impl;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
@@ -44,11 +45,13 @@ public class ModalityStateEx extends ModalityState {
|
||||
}
|
||||
}
|
||||
|
||||
public ModalityState appendProgress(ProgressIndicator progress){
|
||||
@NotNull
|
||||
public ModalityState appendProgress(@NotNull ProgressIndicator progress){
|
||||
return appendEntity(progress);
|
||||
}
|
||||
|
||||
ModalityStateEx appendEntity(Object anEntity){
|
||||
@NotNull
|
||||
ModalityStateEx appendEntity(@NotNull Object anEntity){
|
||||
ArrayList<Object> list = new ArrayList<Object>();
|
||||
for (WeakReference modalEntity : myModalEntities) {
|
||||
Object entity = modalEntity.get();
|
||||
@@ -68,7 +71,7 @@ public class ModalityStateEx extends ModalityState {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean dominates(ModalityState anotherState){
|
||||
public boolean dominates(@NotNull ModalityState anotherState){
|
||||
for (WeakReference modalEntity : myModalEntities) {
|
||||
Object entity = modalEntity.get();
|
||||
if (entity == null) continue;
|
||||
@@ -93,4 +96,4 @@ public class ModalityStateEx extends ModalityState {
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -303,6 +303,7 @@ public class ProgressIndicatorBase extends UserDataHolderBase implements Progres
|
||||
return myModalityProgress != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final ModalityState getModalityState() {
|
||||
return myModalityState;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class MockApplication extends MockComponentManager implements Application
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T getCurrentWriteAction(@NotNull Class<T> actionClass) {
|
||||
public <T> T getCurrentWriteAction(@Nullable Class<T> actionClass) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -285,21 +285,25 @@ public class MockApplication extends MockComponentManager implements Application
|
||||
return Extensions.getRootArea().getExtensionPoint(extensionPointName).getExtensions();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getCurrentModalityState() {
|
||||
return null;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getModalityStateForComponent(@NotNull Component c) {
|
||||
return null;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getDefaultModalityState() {
|
||||
return null;
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getNoneModalityState() {
|
||||
if (MODALITY_STATE_NONE == null) {
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
package com.intellij.cvsSupport2.cvsExecution;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ModalityContext {
|
||||
void runInDispatchThread(Runnable action, Project project);
|
||||
void runInDispatchThread(@NotNull Runnable action, Project project);
|
||||
|
||||
boolean isForTemporaryConfiguration();
|
||||
}
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* author: lesya
|
||||
@@ -40,7 +41,7 @@ public class ModalityContextImpl implements ModalityContext {
|
||||
myIsForTemporaryConfiguration = forTemp;
|
||||
}
|
||||
|
||||
public void runInDispatchThread(Runnable action, Project project) {
|
||||
public void runInDispatchThread(@NotNull Runnable action, Project project) {
|
||||
Application application = ApplicationManager.getApplication();
|
||||
if (application.isUnitTestMode() || application.isDispatchThread()) {
|
||||
action.run();
|
||||
|
||||
@@ -56,13 +56,13 @@ public class UpdateHandler extends CommandCvsHandler implements PostCvsActivity
|
||||
private final Collection<File> myNotProcessedRepositories = new HashSet<File>();
|
||||
private double myDirectoriesToBeProcessedCount;
|
||||
|
||||
private final static CvsMessagePattern UPDATE_PATTERN = new CvsMessagePattern(new String[]{"cvs server: Updating ", "*"}, 2);
|
||||
private static final CvsMessagePattern UPDATE_PATTERN = new CvsMessagePattern(new String[]{"cvs server: Updating ", "*"}, 2);
|
||||
private final Project myProject;
|
||||
private final Collection<MergedWithConflictProjectOrModuleFile> myCorruptedFiles = new ArrayList<MergedWithConflictProjectOrModuleFile>();
|
||||
private final UpdatedFiles myUpdatedFiles;
|
||||
private final UpdateSettings myUpdateSettings;
|
||||
|
||||
public UpdateHandler(FilePath[] files, UpdateSettings updateSettings, Project project, @NotNull UpdatedFiles updatedFiles) {
|
||||
public UpdateHandler(FilePath[] files, UpdateSettings updateSettings, @NotNull Project project, @NotNull UpdatedFiles updatedFiles) {
|
||||
super(CvsBundle.message("operation.name.update"), new UpdateOperation(new FilePath[0], updateSettings, project),
|
||||
FileSetToBeUpdated.selectedFiles(files));
|
||||
myFiles = files;
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.progress.EmptyProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.svn.SvnVcs;
|
||||
import org.jetbrains.idea.svn.dialogs.RepositoryTreeNode;
|
||||
import org.tmatesoft.svn.core.ISVNDirEntryHandler;
|
||||
@@ -87,6 +88,7 @@ class RepositoryLoader extends Loader {
|
||||
@Override
|
||||
public void run() {
|
||||
ProgressManager.getInstance().runProcess(new LoadTask(data), new EmptyProgressIndicator() {
|
||||
@NotNull
|
||||
@Override
|
||||
public ModalityState getModalityState() {
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user