mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -19,9 +19,9 @@ import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.analysis.AnalysisUIOptions;
|
||||
import com.intellij.analysis.BaseAnalysisActionDialog;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class SliceForwardHandler extends SliceHandler {
|
||||
@Override
|
||||
public SliceAnalysisParams askForParams(PsiElement element, boolean dataFlowToThis, SliceManager.StoredSettingsBean storedSettingsBean, String dialogTitle) {
|
||||
AnalysisScope analysisScope = new AnalysisScope(element.getContainingFile());
|
||||
Module module = ModuleUtil.findModuleForPsiElement(element);
|
||||
Module module = ModuleUtilCore.findModuleForPsiElement(element);
|
||||
String name = module == null ? null : module.getName();
|
||||
|
||||
Project myProject = element.getProject();
|
||||
|
||||
@@ -117,7 +117,7 @@ public class SliceManager implements PersistentStateComponent<SliceManager.Store
|
||||
myCanceled = true;
|
||||
}
|
||||
|
||||
public void slice(@NotNull PsiElement element, boolean dataFlowToThis, SliceHandler handler) {
|
||||
public void slice(@NotNull PsiElement element, boolean dataFlowToThis, @NotNull SliceHandler handler) {
|
||||
String dialogTitle = getElementDescription((dataFlowToThis ? BACK_TOOLWINDOW_ID : FORTH_TOOLWINDOW_ID) + " ", element, null);
|
||||
|
||||
dialogTitle = Pattern.compile("(<style>.*</style>)|<[^<>]*>").matcher(dialogTitle).replaceAll("");
|
||||
@@ -129,7 +129,7 @@ public class SliceManager implements PersistentStateComponent<SliceManager.Store
|
||||
createToolWindow(dataFlowToThis, rootNode, false, getElementDescription(null, element, null));
|
||||
}
|
||||
|
||||
public void createToolWindow(final boolean dataFlowToThis, final SliceRootNode rootNode, boolean splitByLeafExpressions, String displayName) {
|
||||
public void createToolWindow(boolean dataFlowToThis, @NotNull SliceRootNode rootNode, boolean splitByLeafExpressions, @NotNull String displayName) {
|
||||
final SliceToolwindowSettings sliceToolwindowSettings = SliceToolwindowSettings.getInstance(myProject);
|
||||
final ContentManager contentManager = getContentManager(dataFlowToThis);
|
||||
final Content[] myContent = new Content[1];
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
@@ -64,7 +65,11 @@ public class SliceTreeBuilder extends AbstractTreeBuilder {
|
||||
}
|
||||
};
|
||||
|
||||
public SliceTreeBuilder(JTree tree, Project project, boolean dataFlowToThis, final SliceNode rootNode, boolean splitByLeafExpressions) {
|
||||
public SliceTreeBuilder(@NotNull JTree tree,
|
||||
@NotNull Project project,
|
||||
boolean dataFlowToThis,
|
||||
@NotNull SliceNode rootNode,
|
||||
boolean splitByLeafExpressions) {
|
||||
super(tree, (DefaultTreeModel)tree.getModel(), new SliceTreeStructure(project, rootNode), SLICE_NODE_COMPARATOR, false);
|
||||
this.dataFlowToThis = dataFlowToThis;
|
||||
this.splitByLeafExpressions = splitByLeafExpressions;
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.slicer;
|
||||
import com.intellij.ide.projectView.TreeStructureProvider;
|
||||
import com.intellij.ide.util.treeView.AbstractTreeStructureBase;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -28,7 +29,7 @@ import java.util.List;
|
||||
public class SliceTreeStructure extends AbstractTreeStructureBase {
|
||||
private final SliceNode myRoot;
|
||||
|
||||
public SliceTreeStructure(Project project, SliceNode rootNode) {
|
||||
public SliceTreeStructure(@NotNull Project project, @NotNull SliceNode rootNode) {
|
||||
super(project);
|
||||
myRoot = rootNode;
|
||||
}
|
||||
|
||||
@@ -17,15 +17,19 @@ package com.intellij.ui.content;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public interface ContentFactory {
|
||||
@NotNull
|
||||
Content createContent(JComponent component, String displayName, boolean isLockable);
|
||||
|
||||
ContentManager createContentManager(ContentUI contentUI, boolean canCloseContents, Project project);
|
||||
@NotNull
|
||||
ContentManager createContentManager(@NotNull ContentUI contentUI, boolean canCloseContents, @NotNull Project project);
|
||||
|
||||
ContentManager createContentManager(boolean canCloseContents, Project project);
|
||||
@NotNull
|
||||
ContentManager createContentManager(boolean canCloseContents, @NotNull Project project);
|
||||
|
||||
class SERVICE {
|
||||
private SERVICE() {
|
||||
|
||||
@@ -18,19 +18,26 @@ package com.intellij.ui.content;
|
||||
import com.intellij.ui.content.impl.ContentImpl;
|
||||
import com.intellij.ui.content.impl.ContentManagerImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ContentFactoryImpl implements ContentFactory {
|
||||
@NotNull
|
||||
@Override
|
||||
public ContentImpl createContent(JComponent component, String displayName, boolean isLockable) {
|
||||
return new ContentImpl(component, displayName, isLockable);
|
||||
}
|
||||
|
||||
public ContentManagerImpl createContentManager(ContentUI contentUI, boolean canCloseContents, Project project) {
|
||||
@NotNull
|
||||
@Override
|
||||
public ContentManagerImpl createContentManager(@NotNull ContentUI contentUI, boolean canCloseContents, @NotNull Project project) {
|
||||
return new ContentManagerImpl(contentUI, canCloseContents, project);
|
||||
}
|
||||
|
||||
public ContentManager createContentManager(boolean canCloseContents, Project project) {
|
||||
@NotNull
|
||||
@Override
|
||||
public ContentManager createContentManager(boolean canCloseContents, @NotNull Project project) {
|
||||
return createContentManager(new TabbedPaneContentUI(), canCloseContents, project);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,32 +69,39 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
myPinnable = isPinnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
return myComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComponent(JComponent component) {
|
||||
Component oldComponent = myComponent;
|
||||
myComponent = component;
|
||||
myChangeSupport.firePropertyChange(PROP_COMPONENT, oldComponent, myComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getPreferredFocusableComponent() {
|
||||
return myFocusRequest == null ? myComponent : myFocusRequest.compute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPreferredFocusableComponent(final JComponent c) {
|
||||
setPreferredFocusedComponent(new Computable<JComponent>() {
|
||||
@Override
|
||||
public JComponent compute() {
|
||||
return c;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPreferredFocusedComponent(final Computable<JComponent> computable) {
|
||||
myFocusRequest = computable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIcon(Icon icon) {
|
||||
Icon oldValue = getIcon();
|
||||
myIcon = icon;
|
||||
@@ -102,6 +109,7 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
myChangeSupport.firePropertyChange(PROP_ICON, oldValue, getIcon());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
if (myIsLocked) {
|
||||
return myIcon == null ? AllIcons.Nodes.PinToolWindow : myLayeredIcon;
|
||||
@@ -111,38 +119,46 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(String displayName) {
|
||||
String oldValue = myDisplayName;
|
||||
myDisplayName = displayName;
|
||||
myChangeSupport.firePropertyChange(PROP_DISPLAY_NAME, oldValue, myDisplayName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return myDisplayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTabName(String tabName) {
|
||||
myTabName = tabName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabName() {
|
||||
if (myTabName != null) return myTabName;
|
||||
return myDisplayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setToolwindowTitle(String toolwindowTitle) {
|
||||
myToolwindowTitle = toolwindowTitle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolwindowTitle() {
|
||||
if (myToolwindowTitle != null) return myToolwindowTitle;
|
||||
return myDisplayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Disposable getDisposer() {
|
||||
return myDisposer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisposer(Disposable disposer) {
|
||||
myDisposer = disposer;
|
||||
}
|
||||
@@ -157,20 +173,24 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
return myShouldDisposeContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDescription(String description) {
|
||||
String oldValue = myDescription;
|
||||
myDescription = description;
|
||||
myChangeSupport.firePropertyChange(PROP_DESCRIPTION, oldValue, myDescription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
myChangeSupport.addPropertyChangeListener(l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
myChangeSupport.removePropertyChangeListener(l);
|
||||
}
|
||||
@@ -179,27 +199,33 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
myManager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContentManager getManager() {
|
||||
return myManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected() {
|
||||
return myManager != null && myManager.isSelected(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void release() {
|
||||
Disposer.dispose(this);
|
||||
}
|
||||
|
||||
//TODO[anton,vova] investigate
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return myManager != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPinned() {
|
||||
return myIsLocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPinned(boolean locked) {
|
||||
if (isPinnable()) {
|
||||
Icon oldIcon = getIcon();
|
||||
@@ -209,18 +235,22 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPinnable() {
|
||||
return myPinnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCloseable() {
|
||||
return myCloseable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCloseable(final boolean closeable) {
|
||||
myCloseable = closeable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActions(final ActionGroup actions, String place, @Nullable JComponent contextComponent) {
|
||||
final ActionGroup oldActions = myActions;
|
||||
myActions = actions;
|
||||
@@ -229,14 +259,17 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
myChangeSupport.firePropertyChange(PROP_ACTIONS, oldActions, myActions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getActionsContextComponent() {
|
||||
return myActionsContextComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionGroup getActions() {
|
||||
return myActions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPlace() {
|
||||
return myPlace;
|
||||
}
|
||||
@@ -246,6 +279,7 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
return "Content name=" + myDisplayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (myShouldDisposeContent && myComponent instanceof Disposable) {
|
||||
Disposer.dispose((Disposable)myComponent);
|
||||
@@ -262,15 +296,18 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AlertIcon getAlertIcon() {
|
||||
return myAlertIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAlertIcon(@Nullable final AlertIcon icon) {
|
||||
myAlertIcon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireAlert() {
|
||||
myChangeSupport.firePropertyChange(PROP_ALERT, null, true);
|
||||
}
|
||||
@@ -305,10 +342,12 @@ public class ContentImpl extends UserDataHolderBase implements Content {
|
||||
return myBusyObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSearchComponent(@Nullable final JComponent comp) {
|
||||
mySearchComponent = comp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getSearchComponent() {
|
||||
return mySearchComponent;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.wm.FocusCommand;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy;
|
||||
import com.intellij.ui.UIBundle;
|
||||
import com.intellij.ui.components.panels.NonOpaquePanel;
|
||||
import com.intellij.ui.components.panels.Wrapper;
|
||||
import com.intellij.ui.content.*;
|
||||
@@ -75,7 +74,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
* WARNING: as this class adds listener to the ProjectManager which is removed on projectClosed event, all instances of this class
|
||||
* must be created on already OPENED projects, otherwise there will be memory leak!
|
||||
*/
|
||||
public ContentManagerImpl(ContentUI contentUI, boolean canCloseContents, Project project) {
|
||||
public ContentManagerImpl(@NotNull ContentUI contentUI, boolean canCloseContents, @NotNull Project project) {
|
||||
myProject = project;
|
||||
myCanCloseContents = canCloseContents;
|
||||
myContents = new ArrayList<Content>();
|
||||
@@ -87,10 +86,12 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
Disposer.register(this, contentUI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCloseContents() {
|
||||
return myCanCloseContents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
if (myComponent == null) {
|
||||
myComponent = new NonOpaquePanel(new BorderLayout());
|
||||
@@ -122,6 +123,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
myProviders.add(provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (PlatformDataKeys.CONTENT_MANAGER.is(dataId)) return ContentManagerImpl.this;
|
||||
@@ -141,6 +143,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SwitchTarget> getTargets(boolean onlyVisible, boolean originalProvider) {
|
||||
if (myUI instanceof SwitchProvider) {
|
||||
return ((SwitchProvider)myUI).getTargets(onlyVisible, false);
|
||||
@@ -148,6 +151,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return new ArrayList<SwitchTarget>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SwitchTarget getCurrentTarget() {
|
||||
if (myUI instanceof SwitchProvider) {
|
||||
return ((SwitchProvider)myUI).getCurrentTarget();
|
||||
@@ -156,6 +160,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JComponent getComponent() {
|
||||
if (myUI instanceof SwitchProvider) {
|
||||
return myUI.getComponent();
|
||||
@@ -164,6 +169,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCycleRoot() {
|
||||
if (myUI instanceof SwitchProvider) {
|
||||
return ((SwitchProvider)myUI).isCycleRoot();
|
||||
@@ -179,20 +185,24 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
setPreferredSize(new Dimension(0, 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
return myContentComponent.getData(dataId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContent(@NotNull Content content, final int order) {
|
||||
addContent(content, null, order);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContent(@NotNull Content content) {
|
||||
addContent(content, null, -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContent(@NotNull final Content content, final Object constraints) {
|
||||
addContent(content, constraints, -1);
|
||||
}
|
||||
@@ -217,13 +227,16 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
Disposer.register(this, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeContent(@NotNull Content content, final boolean dispose) {
|
||||
return removeContent(content, true, dispose);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback removeContent(@NotNull Content content, boolean dispose, final boolean trackFocus, final boolean forcedFocus) {
|
||||
final ActionCallback result = new ActionCallback();
|
||||
_removeContent(content, true, dispose).doWhenDone(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (trackFocus) {
|
||||
Content current = getSelectedContent();
|
||||
@@ -321,6 +334,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllContents(final boolean dispose) {
|
||||
Content[] contents = getContents();
|
||||
for (Content content : contents) {
|
||||
@@ -328,16 +342,19 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContentCount() {
|
||||
return myContents.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Content[] getContents() {
|
||||
return myContents.toArray(new Content[myContents.size()]);
|
||||
}
|
||||
|
||||
//TODO[anton,vova] is this method needed?
|
||||
@Override
|
||||
public Content findContent(String displayName) {
|
||||
for (Content content : myContents) {
|
||||
if (content.getDisplayName().equals(displayName)) {
|
||||
@@ -347,10 +364,12 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getContent(int index) {
|
||||
return index >= 0 && index < myContents.size() ? myContents.get(index) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getContent(JComponent component) {
|
||||
Content[] contents = getContents();
|
||||
for (Content content : contents) {
|
||||
@@ -361,14 +380,17 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndexOfContent(Content content) {
|
||||
return myContents.indexOf(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCloseActionName() {
|
||||
return myUI.getCloseActionName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCloseAllButThisActionName() {
|
||||
return myUI.getCloseAllButThisActionName();
|
||||
}
|
||||
@@ -383,10 +405,12 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return myUI.getNextContentActionName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AnAction> getAdditionalPopupActions(@NotNull final Content content) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCloseAllContents() {
|
||||
if (!canCloseContents()) {
|
||||
return false;
|
||||
@@ -399,6 +423,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addSelectedContent(@NotNull final Content content) {
|
||||
if (!checkSelectionChangeShouldBeProcessed(content, false)) return;
|
||||
|
||||
@@ -422,42 +447,51 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromSelection(@NotNull Content content) {
|
||||
if (!isSelected(content)) return;
|
||||
mySelection.remove(content);
|
||||
fireSelectionChanged(content, ContentManagerEvent.ContentOperation.remove);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelected(@NotNull Content content) {
|
||||
return mySelection.contains(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Content[] getSelectedContents() {
|
||||
return mySelection.toArray(new Content[mySelection.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Content getSelectedContent() {
|
||||
return mySelection.isEmpty() ? null : mySelection.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedContent(@NotNull Content content, boolean requestFocus) {
|
||||
setSelectedContentCB(content, requestFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback setSelectedContentCB(@NotNull final Content content, final boolean requestFocus) {
|
||||
return setSelectedContentCB(content, requestFocus, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedContent(@NotNull Content content, boolean requestFocus, boolean forcedFocus) {
|
||||
setSelectedContentCB(content, requestFocus, forcedFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback setSelectedContentCB(@NotNull final Content content, final boolean requestFocus, final boolean forcedFocus) {
|
||||
return setSelectedContent(content, requestFocus, forcedFocus, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback setSelectedContent(@NotNull final Content content, final boolean requestFocus, final boolean forcedFocus, boolean implicit) {
|
||||
if (isSelected(content) && requestFocus) {
|
||||
return requestFocus(content, forcedFocus);
|
||||
@@ -475,6 +509,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
final Content[] old = getSelectedContents();
|
||||
|
||||
final ActiveRunnable selection = new ActiveRunnable() {
|
||||
@Override
|
||||
public ActionCallback run() {
|
||||
if (myDisposed || getIndexOfContent(content) == -1) return new ActionCallback.Rejected();
|
||||
|
||||
@@ -497,6 +532,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
if (focused || requestFocus) {
|
||||
if (enabledFocus) {
|
||||
return getFocusManager().requestFocus(myFocusProxy, true).doWhenProcessed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
selection.run().notify(result);
|
||||
}
|
||||
@@ -522,14 +558,17 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return focused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback setSelectedContentCB(@NotNull Content content) {
|
||||
return setSelectedContentCB(content, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelectedContent(@NotNull final Content content) {
|
||||
setSelectedContentCB(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback selectPreviousContent() {
|
||||
int contentCount = getContentCount();
|
||||
LOG.assertTrue(contentCount > 1);
|
||||
@@ -543,6 +582,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return setSelectedContentCB(content, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback selectNextContent() {
|
||||
int contentCount = getContentCount();
|
||||
LOG.assertTrue(contentCount > 1);
|
||||
@@ -556,10 +596,12 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return setSelectedContentCB(content, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentManagerListener(@NotNull ContentManagerListener l) {
|
||||
myListeners.add(ContentManagerListener.class, l);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeContentManagerListener(@NotNull ContentManagerListener l) {
|
||||
myListeners.remove(ContentManagerListener.class, l);
|
||||
}
|
||||
@@ -601,6 +643,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionCallback requestFocus(final Content content, final boolean forced) {
|
||||
final Content toSelect = content == null ? getSelectedContent() : content;
|
||||
if (toSelect == null) return new ActionCallback.Rejected();
|
||||
@@ -608,6 +651,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
|
||||
|
||||
return getFocusManager().requestFocus(new FocusCommand(content, toSelect.getPreferredFocusableComponent()) {
|
||||
@Override
|
||||
public ActionCallback run() {
|
||||
return doRequestFocus(toSelect);
|
||||
}
|
||||
@@ -638,25 +682,30 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
return toFocus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDataProvider(@NotNull final DataProvider provider) {
|
||||
myContentComponent.addProvider(provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(final PropertyChangeEvent evt) {
|
||||
if (Content.PROP_COMPONENT.equals(evt.getPropertyName())) {
|
||||
myContentWithChangedComponent.add((Content)evt.getSource());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ContentFactory getFactory() {
|
||||
return ServiceManager.getService(ContentFactory.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTreeDispose() {
|
||||
myUI.beforeDispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
myDisposed = true;
|
||||
|
||||
@@ -667,10 +716,12 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
myListeners = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisposed() {
|
||||
return myDisposed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleSelection() {
|
||||
return myUI.isSingleSelection();
|
||||
}
|
||||
|
||||
@@ -380,7 +380,8 @@ public class UsageInfo2UsageAdapter implements UsageInModule,
|
||||
reference.handleElementRename(newName);
|
||||
}
|
||||
|
||||
public static UsageInfo2UsageAdapter[] convert(UsageInfo[] usageInfos) {
|
||||
@NotNull
|
||||
public static UsageInfo2UsageAdapter[] convert(@NotNull UsageInfo[] usageInfos) {
|
||||
UsageInfo2UsageAdapter[] result = new UsageInfo2UsageAdapter[usageInfos.length];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = new UsageInfo2UsageAdapter(usageInfos[i]);
|
||||
@@ -400,6 +401,7 @@ public class UsageInfo2UsageAdapter implements UsageInModule,
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private List<UsageInfo> getSelectedInfoList() {
|
||||
return myMergedUsageInfos;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GroupNode extends Node implements Navigatable, Comparable<GroupNode
|
||||
return children == null ? result : result + children.toString();
|
||||
}
|
||||
|
||||
public GroupNode addGroup(@NotNull UsageGroup group, int ruleIndex, Consumer<Runnable> edtQueue) {
|
||||
public GroupNode addGroup(@NotNull UsageGroup group, int ruleIndex, @NotNull Consumer<Runnable> edtQueue) {
|
||||
synchronized (lock) {
|
||||
GroupNode node = mySubgroupNodes.get(group);
|
||||
if (node == null) {
|
||||
@@ -154,7 +154,7 @@ public class GroupNode extends Node implements Navigatable, Comparable<GroupNode
|
||||
myTreeModel.nodeChanged(this);
|
||||
}
|
||||
|
||||
public UsageNode addUsage(@NotNull Usage usage, Consumer<Runnable> edtQueue) {
|
||||
public UsageNode addUsage(@NotNull Usage usage, @NotNull Consumer<Runnable> edtQueue) {
|
||||
final UsageNode node;
|
||||
synchronized (lock) {
|
||||
if (UsageViewSettings.getInstance().isFilterDuplicatedLine()) {
|
||||
@@ -343,9 +343,12 @@ public class GroupNode extends Node implements Navigatable, Comparable<GroupNode
|
||||
return myGroup.getText(view);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<GroupNode> getSubGroups() {
|
||||
return mySubgroupNodes.values();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<UsageNode> getUsageNodes() {
|
||||
return myUsageNodes;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class UsageNodeTreeBuilder {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
UsageNode appendUsage(@NotNull Usage usage, Consumer<Runnable> edtQueue) {
|
||||
UsageNode appendUsage(@NotNull Usage usage, @NotNull Consumer<Runnable> edtQueue) {
|
||||
if (!isVisible(usage)) return null;
|
||||
|
||||
GroupNode lastGroupNode = myRoot;
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -47,7 +48,7 @@ public class UsagePreviewPanel extends JPanel implements Disposable {
|
||||
private final Project myProject;
|
||||
private volatile boolean isDisposed = false;
|
||||
|
||||
public UsagePreviewPanel(final Project project) {
|
||||
public UsagePreviewPanel(@NotNull Project project) {
|
||||
myProject = project;
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(IdeBorderFactory.createBorder());
|
||||
@@ -90,7 +91,7 @@ public class UsagePreviewPanel extends JPanel implements Disposable {
|
||||
}
|
||||
|
||||
private static final Key<Boolean> IN_PREVIEW_USAGE_FLAG = Key.create("IN_PREVIEW_USAGE_FLAG");
|
||||
private void highlight(final List<UsageInfo> infos, final Editor editor) {
|
||||
private void highlight(@NotNull List<UsageInfo> infos, @NotNull Editor editor) {
|
||||
if (editor != myEditor) return; //already disposed
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
@@ -170,7 +171,7 @@ public class UsagePreviewPanel extends JPanel implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateLayout(final List<UsageInfo> infos) {
|
||||
public void updateLayout(@Nullable final List<UsageInfo> infos) {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user