Merge branch 'master' of git.labs.intellij.net:idea/community

This commit is contained in:
Maxim.Mossienko
2010-01-12 20:30:06 +03:00
879 changed files with 35329 additions and 4660 deletions
@@ -21,7 +21,6 @@ import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.codeInsight.lookup.TailTypeDecorator;
import com.intellij.patterns.ElementPattern;
import static com.intellij.patterns.PlatformPatterns.psiElement;
import com.intellij.psi.PsiElement;
import com.intellij.util.Icons;
import com.intellij.util.ProcessingContext;
@@ -32,12 +31,10 @@ import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import static com.intellij.patterns.PlatformPatterns.psiElement;
/**
* Created by IntelliJ IDEA.
* User: vnikolaenko
* Date: 22.09.2008
* Time: 12:14:14
* To change this template use File | Settings | File Templates.
* @author vnikolaenko
*/
public class RegExpCompletionContributor extends CompletionContributor {
private static final Icon emptyIcon = new EmptyIcon(Icons.PROPERTY_ICON.getIconWidth(), Icons.PROPERTY_ICON.getIconHeight());
@@ -26,11 +26,7 @@ import org.intellij.lang.regexp.psi.impl.RegExpPropertyImpl;
import org.jetbrains.annotations.Nullable;
/**
* Created by IntelliJ IDEA.
* User: vnikolaenko
* Date: 17.09.2008
* Time: 19:24:29
* To change this template use File | Settings | File Templates.
* @author vnikolaenko
*/
public class RegExpDocumentationProvider extends QuickDocumentationProvider {
@Override
Binary file not shown.
@@ -27,12 +27,12 @@ import org.intellij.images.ui.ImageComponentDecorator;
*/
public final class ToggleTransparencyChessboardAction extends ToggleAction {
public boolean isSelected(AnActionEvent e) {
ImageComponentDecorator decorator = (ImageComponentDecorator)e.getDataContext().getData(ImageComponentDecorator.class.getName());
ImageComponentDecorator decorator = ImageComponentDecorator.DATA_KEY.getData(e.getDataContext());
return decorator != null && decorator.isEnabledForActionPlace(e.getPlace()) && decorator.isTransparencyChessboardVisible();
}
public void setSelected(AnActionEvent e, boolean state) {
ImageComponentDecorator decorator = (ImageComponentDecorator)e.getDataContext().getData(ImageComponentDecorator.class.getName());
ImageComponentDecorator decorator = ImageComponentDecorator.DATA_KEY.getData(e.getDataContext());
if (decorator != null && decorator.isEnabledForActionPlace(e.getPlace())) {
decorator.setTransparencyChessboardVisible(state);
}
@@ -40,7 +40,7 @@ public final class ToggleTransparencyChessboardAction extends ToggleAction {
public void update(final AnActionEvent e) {
super.update(e);
ImageComponentDecorator decorator = (ImageComponentDecorator)e.getDataContext().getData(ImageComponentDecorator.class.getName());
ImageComponentDecorator decorator = ImageComponentDecorator.DATA_KEY.getData(e.getDataContext());
e.getPresentation().setEnabled(decorator != null && decorator.isEnabledForActionPlace(e.getPlace()));
e.getPresentation().setText(isSelected(e) ? "Hide Chessboard" : "Show Chessboard");
}
@@ -73,7 +73,7 @@ final class ImageEditorUI extends JPanel implements DataProvider {
final PsiActionSupportFactory factory = PsiActionSupportFactory.getInstance();
copyPasteSupport = factory.createPsiBasedCopyPasteSupport(editor.getProject(), this, new PsiActionSupportFactory.PsiElementSelector() {
public PsiElement[] getSelectedElements() {
return (PsiElement[]) getData(DataConstants.PSI_ELEMENT_ARRAY);
return LangDataKeys.PSI_ELEMENT_ARRAY.getData(ImageEditorUI.this);
}
});
@@ -342,26 +342,26 @@ final class ImageEditorUI extends JPanel implements DataProvider {
@Nullable
public Object getData(String dataId) {
if (DataConstants.PROJECT.equals(dataId)) {
if (PlatformDataKeys.PROJECT.is(dataId)) {
return editor.getProject();
} else if (DataConstants.VIRTUAL_FILE.equals(dataId)) {
} else if (PlatformDataKeys.VIRTUAL_FILE.is(dataId)) {
return editor.getFile();
} else if (DataConstants.VIRTUAL_FILE_ARRAY.equals(dataId)) {
} else if (PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
return new VirtualFile[]{editor.getFile()};
} else if (DataConstants.PSI_FILE.equals(dataId)) {
return getData(DataConstants.PSI_ELEMENT);
} else if (DataConstants.PSI_ELEMENT.equals(dataId)) {
} else if (LangDataKeys.PSI_FILE.is(dataId)) {
return getData(LangDataKeys.PSI_ELEMENT.getName());
} else if (LangDataKeys.PSI_ELEMENT.is(dataId)) {
VirtualFile file = editor.getFile();
return file != null && file.isValid() ? PsiManager.getInstance(editor.getProject()).findFile(file) : null;
} else if (DataConstants.PSI_ELEMENT_ARRAY.equals(dataId)) {
return new PsiElement[]{(PsiElement) getData(DataConstants.PSI_ELEMENT)};
} else if (DataConstants.COPY_PROVIDER.equals(dataId)) {
} else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
return new PsiElement[]{(PsiElement) getData(LangDataKeys.PSI_ELEMENT.getName())};
} else if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
return copyPasteSupport.getCopyProvider();
} else if (DataConstants.CUT_PROVIDER.equals(dataId)) {
} else if (PlatformDataKeys.CUT_PROVIDER.is(dataId)) {
return copyPasteSupport.getCutProvider();
} else if (DataConstants.DELETE_ELEMENT_PROVIDER.equals(dataId)) {
} else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return deleteProvider;
} else if (ImageComponentDecorator.class.getName().equals(dataId)) {
} else if (ImageComponentDecorator.DATA_KEY.is(dataId)) {
return editor;
}
@@ -16,6 +16,7 @@
package org.intellij.images.thumbnail;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.intellij.images.ImagesBundle;
@@ -28,45 +29,47 @@ import org.jetbrains.annotations.NotNull;
* @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
*/
public interface ThumbnailView extends Disposable, ImageComponentDecorator {
String TOOLWINDOW_ID = ImagesBundle.message("thumbnails.toolwindow.name");
DataKey<ThumbnailView> DATA_KEY = DataKey.create(ThumbnailView.class.getName());
@NotNull
Project getProject();
String TOOLWINDOW_ID = ImagesBundle.message("thumbnails.toolwindow.name");
/**
* Add virtual files to view
*
* @param root Root
*/
void setRoot(@NotNull VirtualFile root);
@NotNull
Project getProject();
/**
* Return current root
*
* @return Current root
*/
VirtualFile getRoot();
/**
* Add virtual files to view
*
* @param root Root
*/
void setRoot(@NotNull VirtualFile root);
boolean isRecursive();
/**
* Return current root
*
* @return Current root
*/
VirtualFile getRoot();
void setRecursive(boolean recursive);
boolean isRecursive();
void setSelected(@NotNull VirtualFile file, boolean selected);
void setRecursive(boolean recursive);
boolean isSelected(@NotNull VirtualFile file);
void setSelected(@NotNull VirtualFile file, boolean selected);
@NotNull
VirtualFile[] getSelection();
boolean isSelected(@NotNull VirtualFile file);
/**
* Scroll to selection. If ToolWindow is not active, then
* it will perform activatation before scroll.
*/
void scrollToSelection();
@NotNull
VirtualFile[] getSelection();
void setVisible(boolean visible);
/**
* Scroll to selection. If ToolWindow is not active, then
* it will perform activatation before scroll.
*/
void scrollToSelection();
boolean isVisible();
void setVisible(boolean visible);
void activate();
boolean isVisible();
void activate();
}
@@ -16,7 +16,6 @@
package org.intellij.images.thumbnail.actionSystem;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.Presentation;
import org.intellij.images.thumbnail.ThumbnailView;
@@ -44,8 +43,7 @@ public final class ThumbnailViewActionUtil {
}
public static ThumbnailView getThumbnailView(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
return (ThumbnailView) dataContext.getData(ThumbnailView.class.getName());
return ThumbnailView.DATA_KEY.getData(e.getDataContext());
}
/**
@@ -90,7 +90,7 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
final PsiActionSupportFactory factory = PsiActionSupportFactory.getInstance();
copyPasteSupport = factory.createPsiBasedCopyPasteSupport(thumbnailView.getProject(), this, new PsiActionSupportFactory.PsiElementSelector() {
public PsiElement[] getSelectedElements() {
return (PsiElement[]) getData(DataConstants.PSI_ELEMENT_ARRAY);
return (PsiElement[]) getData(LangDataKeys.PSI_ELEMENT_ARRAY.getName());
}
});
@@ -410,32 +410,32 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
@Nullable
public Object getData(String dataId) {
if (DataConstants.PROJECT.equals(dataId)) {
if (PlatformDataKeys.PROJECT.is(dataId)) {
return thumbnailView.getProject();
} else if (DataConstants.VIRTUAL_FILE.equals(dataId)) {
} else if (PlatformDataKeys.VIRTUAL_FILE.is(dataId)) {
VirtualFile[] selectedFiles = getSelectedFiles();
return selectedFiles.length > 0 ? selectedFiles[0] : null;
} else if (DataConstants.VIRTUAL_FILE_ARRAY.equals(dataId)) {
} else if (PlatformDataKeys.VIRTUAL_FILE_ARRAY.is(dataId)) {
return getSelectedFiles();
} else if (DataConstants.PSI_FILE.equals(dataId)) {
return getData(DataConstants.PSI_ELEMENT);
} else if (DataConstants.PSI_ELEMENT.equals(dataId)) {
} else if (LangDataKeys.PSI_FILE.is(dataId)) {
return getData(LangDataKeys.PSI_ELEMENT.getName());
} else if (LangDataKeys.PSI_ELEMENT.is(dataId)) {
VirtualFile[] selectedFiles = getSelectedFiles();
return selectedFiles.length > 0 ? PsiManager.getInstance(thumbnailView.getProject()).findFile(selectedFiles[0]) : null;
} else if (DataConstants.PSI_ELEMENT_ARRAY.equals(dataId)) {
} else if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
return getSelectedElements();
} else if (DataConstants.NAVIGATABLE.equals(dataId)) {
} else if (PlatformDataKeys.NAVIGATABLE.is(dataId)) {
VirtualFile[] selectedFiles = getSelectedFiles();
return new ThumbnailNavigatable(selectedFiles.length > 0 ? selectedFiles[0] : null);
} else if (DataConstants.COPY_PROVIDER.equals(dataId)) {
} else if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
return copyPasteSupport.getCopyProvider();
} else if (DataConstants.CUT_PROVIDER.equals(dataId)) {
} else if (PlatformDataKeys.CUT_PROVIDER.is(dataId)) {
return copyPasteSupport.getCutProvider();
} else if (DataConstants.PASTE_PROVIDER.equals(dataId)) {
} else if (PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
return copyPasteSupport.getPasteProvider();
} else if (DataConstants.DELETE_ELEMENT_PROVIDER.equals(dataId)) {
} else if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return deleteProvider;
} else if (DataConstants.NAVIGATABLE_ARRAY.equals(dataId)) {
} else if (PlatformDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
VirtualFile[] selectedFiles = getSelectedFiles();
Set<Navigatable> navigatables = new HashSet<Navigatable>(selectedFiles.length);
for (VirtualFile selectedFile : selectedFiles) {
@@ -444,9 +444,9 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
}
}
return navigatables.toArray(EMPTY_NAVIGATABLE_ARRAY);
} else if (ThumbnailView.class.getName().equals(dataId)) {
} else if (ThumbnailView.DATA_KEY.is(dataId)) {
return thumbnailView;
} else if (ImageComponentDecorator.class.getName().equals(dataId)) {
} else if (ImageComponentDecorator.DATA_KEY.is(dataId)) {
return thumbnailView;
}
@@ -466,7 +466,7 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
psiElements.add(element);
}
}
return psiElements.toArray(PsiElement.EMPTY_ARRAY);
return psiElements.toArray(new PsiElement[psiElements.size()]);
}
@NotNull
@@ -15,21 +15,25 @@
*/
package org.intellij.images.ui;
import com.intellij.openapi.actionSystem.DataKey;
/**
* Image Component manager. It can toggle backround transparency, grid, etc.
*
* @author Alexey Efimov
*/
public interface ImageComponentDecorator {
void setTransparencyChessboardVisible(boolean visible);
DataKey<ImageComponentDecorator> DATA_KEY = DataKey.create(ImageComponentDecorator.class.getName());
boolean isTransparencyChessboardVisible();
void setTransparencyChessboardVisible(boolean visible);
/**
* Return <code>true</code> if this decorator is enabled for this action place.
*
* @param place Action place
* @return <code>true</code> is decorator is enabled
*/
boolean isEnabledForActionPlace(String place);
boolean isTransparencyChessboardVisible();
/**
* Return <code>true</code> if this decorator is enabled for this action place.
*
* @param place Action place
* @return <code>true</code> is decorator is enabled
*/
boolean isEnabledForActionPlace(String place);
}
@@ -15,24 +15,20 @@
*/
package com.intellij.uiDesigner.compiler;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.commons.Method;
import org.objectweb.asm.Type;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* User: yole
* Date: 22.11.2005
* Time: 17:46:41
* To change this template use File | Settings | File Templates.
* @author yole
*/
public class InsetsPropertyCodeGenerator extends PropertyCodeGenerator {
private final Type myInsetsType = Type.getType(Insets.class);
public void generatePushValue(final GeneratorAdapter generator, final Object value) {
final Insets insets = (Insets) value;
final Insets insets = (Insets)value;
generator.newInstance(myInsetsType);
generator.dup();
generator.push(insets.top);
@@ -22,11 +22,7 @@ import javax.swing.*;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* User: yole
* Date: 23.11.2005
* Time: 13:47:38
* To change this template use File | Settings | File Templates.
* @author yole
*/
public class GridBagConverterTest extends TestCase {
/**
@@ -892,7 +888,7 @@ public class GridBagConverterTest extends TestCase {
assertEquals(100, field3.getHeight());
}
private void applyConversionResults(final JPanel panel, final GridBagConverter converter) {
private static void applyConversionResults(final JPanel panel, final GridBagConverter converter) {
GridBagConverter.Result[] results = converter.convert();
for(int i=0; i<results.length; i++) {
GridBagConverter.Result result = results [i];
@@ -16,8 +16,8 @@
package com.intellij.compiler.actions;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataConstants;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.compiler.CompilerManager;
import com.intellij.openapi.project.Project;
@@ -34,6 +34,6 @@ public class CompileDirtyAction extends CompileActionBase {
if (!presentation.isEnabled()) {
return;
}
presentation.setEnabled(event.getDataContext().getData(DataConstants.PROJECT) != null);
presentation.setEnabled(PlatformDataKeys.PROJECT.getData(event.getDataContext()) != null);
}
}
@@ -26,7 +26,7 @@ public class MakeModuleAction extends CompileActionBase {
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.actions.MakeModuleAction");
protected void doAction(DataContext dataContext, Project project) {
Module[] modules = (Module[])dataContext.getData(DataConstants.MODULE_CONTEXT_ARRAY);
Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext);
Module module;
if (modules == null) {
module = LangDataKeys.MODULE.getData(dataContext);
@@ -51,7 +51,7 @@ public class MakeModuleAction extends CompileActionBase {
}
final DataContext dataContext = event.getDataContext();
final Module module = LangDataKeys.MODULE.getData(dataContext);
Module[] modules = (Module[])dataContext.getData(DataConstants.MODULE_CONTEXT_ARRAY);
Module[] modules = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext);
final boolean isEnabled = module != null || modules != null;
presentation.setEnabled(isEnabled);
final String actionName = getTemplatePresentation().getTextWithMnemonic();
@@ -81,4 +81,4 @@ public class MakeModuleAction extends CompileActionBase {
presentation.setText(presentationText);
presentation.setVisible(isEnabled || !ActionPlaces.PROJECT_VIEW_POPUP.equals(event.getPlace()));
}
}
}
@@ -66,7 +66,7 @@ public class AddToWatchAction extends DebuggerAction {
}
}
else {
final Editor editor = (Editor)context.getData(PlatformDataKeys.EDITOR.getName());
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
enabled = DebuggerUtilsEx.getEditorText(editor) != null;
}
e.getPresentation().setEnabled(enabled);
@@ -99,7 +99,7 @@ public class AddToWatchAction extends DebuggerAction {
addFromNodes(debuggerContext, watchPanel, selectedNodes);
}
else {
final Editor editor = (Editor)context.getData(PlatformDataKeys.EDITOR.getName());
final Editor editor = e.getData(PlatformDataKeys.EDITOR);
if (editor != null) {
final TextWithImports editorText = DebuggerUtilsEx.getEditorText(editor);
if (editorText != null) {
@@ -176,4 +176,4 @@ public class AddToWatchAction extends DebuggerAction {
}
}
}
}
@@ -45,12 +45,12 @@ public abstract class DebuggerAction extends AnAction {
@Nullable
public static DebuggerTree getTree(DataContext dataContext){
return (DebuggerTree)dataContext.getData(DebuggerActions.DEBUGGER_TREE);
return DebuggerTree.DATA_KEY.getData(dataContext);
}
@Nullable
public static DebuggerTreePanel getPanel(DataContext dataContext){
return (DebuggerTreePanel)dataContext.getData(DebuggerActions.DEBUGGER_TREE_PANEL);
return DebuggerTreePanel.DATA_KEY.getData(dataContext);
}
@Nullable
@@ -80,11 +80,11 @@ public abstract class DebuggerAction extends AnAction {
if (paths == null || paths.length == 0) {
return EMPTY_TREE_NODE_ARRAY;
}
List<Object> nodes = new ArrayList<Object>(paths.length);
List<DebuggerTreeNodeImpl> nodes = new ArrayList<DebuggerTreeNodeImpl>(paths.length);
for (TreePath path : paths) {
Object component = path.getLastPathComponent();
if (component instanceof DebuggerTreeNodeImpl) {
nodes.add(component);
nodes.add((DebuggerTreeNodeImpl) component);
}
}
return nodes.toArray(new DebuggerTreeNodeImpl[nodes.size()]);
@@ -20,6 +20,8 @@
*/
package com.intellij.debugger.actions;
import com.intellij.debugger.ui.impl.DebuggerTreePanel;
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import org.jetbrains.annotations.NonNls;
@@ -30,8 +32,8 @@ public interface DebuggerActions extends XDebuggerActions {
@NonNls String INSPECT_PANEL_POPUP = "Debugger.InspectPanelPopup";
@NonNls String THREADS_PANEL_POPUP = "Debugger.ThreadsPanelPopup";
@NonNls String WATCH_PANEL_POPUP = "Debugger.WatchesPanelPopup";
@NonNls String DEBUGGER_TREE = "DebuggerTree";
@NonNls String DEBUGGER_TREE_PANEL = "DebuggerPanel";
@Deprecated @NonNls String DEBUGGER_TREE = DebuggerTree.DATA_KEY.getName();
@Deprecated @NonNls String DEBUGGER_TREE_PANEL = DebuggerTreePanel.DATA_KEY.getName();
@NonNls String REMOVE_WATCH = "Debugger.RemoveWatch";
@NonNls String NEW_WATCH = "Debugger.NewWatch";
@NonNls String ADD_TO_WATCH = "Debugger.AddToWatch";
@@ -47,4 +49,4 @@ public interface DebuggerActions extends XDebuggerActions {
@NonNls String EXPORT_THREADS = "ExportThreads";
@NonNls String DUMP_THREADS = "DumpThreads";
}
}
@@ -20,11 +20,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.IdeActions;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 14, 2004
* Time: 11:15:59 AM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class EditFrameSourceAction extends GotoFrameSourceAction{
public void update(AnActionEvent e) {
@@ -25,44 +25,45 @@ import com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl;
import com.intellij.openapi.actionSystem.AnActionEvent;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 14, 2004
* Time: 3:35:58 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class FreezeThreadAction extends DebuggerAction{
public class FreezeThreadAction extends DebuggerAction {
public void actionPerformed(final AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
for (int i = 0; i < selectedNode.length; i++) {
final DebuggerTreeNodeImpl debuggerTreeNode = selectedNode[i];
for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl)debuggerTreeNode.getDescriptor());
final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
if(!threadDescriptor.isFrozen()) {
if (!threadDescriptor.isFrozen()) {
debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(debuggerContext.getSuspendContext()) {
public void contextAction() throws Exception {
debugProcess.createFreezeThreadCommand(thread).run();
debuggerTreeNode.calcValue();
}
});
public void contextAction() throws Exception {
debugProcess.createFreezeThreadCommand(thread).run();
debuggerTreeNode.calcValue();
}
});
}
}
}
public void update(AnActionEvent e) {
DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
if (selectedNode == null) {
return;
}
DebugProcessImpl debugProcess = getDebuggerContext(e.getDataContext()).getDebugProcess();
boolean visible = false;
if(debugProcess != null) {
if (debugProcess != null) {
visible = true;
for (int i = 0; i < selectedNode.length; i++) {
NodeDescriptorImpl threadDescriptor = selectedNode[i].getDescriptor();
if(!(threadDescriptor instanceof ThreadDescriptorImpl) || ((ThreadDescriptorImpl)threadDescriptor).isFrozen()) {
for (DebuggerTreeNodeImpl aSelectedNode : selectedNode) {
NodeDescriptorImpl threadDescriptor = aSelectedNode.getDescriptor();
if (!(threadDescriptor instanceof ThreadDescriptorImpl) || ((ThreadDescriptorImpl)threadDescriptor).isFrozen()) {
visible = false;
break;
}
@@ -24,11 +24,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 14, 2004
* Time: 10:36:59 AM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class GotoFrameSourceAction extends DebuggerAction{
public void actionPerformed(AnActionEvent e) {
@@ -26,11 +26,7 @@ import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Jun 26, 2003
* Time: 12:52:01 PM
* To change this template use Options | File Templates.
* @author lex
*/
public class HotSwapAction extends AnAction{
@@ -107,12 +107,12 @@ public class ToggleFieldBreakpointAction extends AnAction {
else if(DebuggerAction.isContextView(event)) {
presentation.setText(DebuggerBundle.message("action.add.field.watchpoint.text"));
Project project = event.getData(PlatformDataKeys.PROJECT);
if(place != null) {
if(project != null && place != null) {
Document document = PsiDocumentManager.getInstance(project).getDocument(place.getFile());
if (document != null) {
final int offset = place.getOffset();
final BreakpointManager breakpointManager = (DebuggerManagerEx.getInstanceEx(project)).getBreakpointManager();
final Breakpoint fieldBreakpoint = offset >= 0 ? (FieldBreakpoint)breakpointManager.findBreakpoint(document, offset, FieldBreakpoint.CATEGORY) : null;
final Breakpoint fieldBreakpoint = offset >= 0 ? breakpointManager.findBreakpoint(document, offset, FieldBreakpoint.CATEGORY) : null;
if (fieldBreakpoint != null) {
presentation.setEnabled(false);
return;
@@ -147,7 +147,7 @@ public class ToggleFieldBreakpointAction extends AnAction {
}
if(DebuggerAction.isContextView(event)) {
DebuggerTree tree = (DebuggerTree)dataContext.getData(DebuggerActions.DEBUGGER_TREE);
DebuggerTree tree = DebuggerTree.DATA_KEY.getData(dataContext);
if(tree != null && tree.getSelectionPath() != null) {
DebuggerTreeNodeImpl node = ((DebuggerTreeNodeImpl)tree.getSelectionPath().getLastPathComponent());
if(node != null && node.getDescriptor() instanceof FieldDescriptorImpl) {
@@ -188,4 +188,4 @@ public class ToggleFieldBreakpointAction extends AnAction {
return null;
}
}
}
@@ -15,17 +15,12 @@
*/
package com.intellij.debugger.engine;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.execution.configurations.RunProfileState;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 26, 2004
* Time: 4:11:18 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class DebugProcessAdapterImpl implements DebugProcessListener {
//executed in manager thread
@@ -46,11 +46,7 @@ import com.sun.jdi.request.EventRequest;
import com.sun.jdi.request.MethodExitRequest;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 25, 2004
* Time: 4:39:03 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class DebugProcessEvents extends DebugProcessImpl {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.DebugProcessEvents");
@@ -16,19 +16,12 @@
package com.intellij.debugger.engine;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.openapi.project.Project;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 2, 2004
* Time: 3:50:51 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public interface JVMName {
String getName(DebugProcessImpl process) throws EvaluateException;
String getDisplayName(DebugProcessImpl debugProcess);
}
@@ -41,11 +41,7 @@ import java.util.Collections;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 2, 2004
* Time: 8:33:41 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class PositionManagerImpl implements PositionManager {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.PositionManagerImpl");
@@ -29,11 +29,7 @@ import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 29, 2004
* Time: 6:27:18 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class RemoteStateState implements RemoteState {
private final Project myProject;
@@ -34,11 +34,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 24, 2004
* Time: 8:04:50 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class SuspendContextImpl implements SuspendContext {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.SuspendContextImpl");
@@ -25,18 +25,16 @@ import com.sun.jdi.request.EventRequest;
import java.util.*;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 24, 2004
* Time: 8:04:01 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class SuspendManagerImpl implements SuspendManager {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.SuspendManager");
private final LinkedList<SuspendContextImpl> myEventContexts = new LinkedList<SuspendContextImpl>();
// contexts, paused at breakpoint or another debugger event requests. Note that thread, explicitly paused by user is not considered as
// "paused at breakpoint" and JDI prohibits data queries on its stackframes
/**
* contexts, paused at breakpoint or another debugger event requests. Note that thread, explicitly paused by user is not considered as
* "paused at breakpoint" and JDI prohibits data queries on its stackframes
*/
private final LinkedList<SuspendContextImpl> myPausedContexts = new LinkedList<SuspendContextImpl>();
private final Set<ThreadReferenceProxyImpl> myFrozenThreads = Collections.synchronizedSet(new HashSet<ThreadReferenceProxyImpl>());
@@ -15,16 +15,10 @@
*/
package com.intellij.debugger.engine.evaluation;
import com.intellij.debugger.engine.evaluation.EvaluateException;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Jan 14, 2004
* Time: 2:18:59 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class EvaluateRuntimeException extends RuntimeException{
public class EvaluateRuntimeException extends RuntimeException {
public EvaluateRuntimeException(EvaluateException e) {
super(e);
}
@@ -20,13 +20,10 @@ import com.intellij.debugger.engine.SuspendContextImpl;
import java.util.EventListener;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 3, 2004
* Time: 7:19:30 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public interface EvaluationListener extends EventListener{
public void evaluationStarted(SuspendContextImpl context);
public void evaluationFinished(SuspendContextImpl context);
public interface EvaluationListener extends EventListener {
void evaluationStarted(SuspendContextImpl context);
void evaluationFinished(SuspendContextImpl context);
}
@@ -22,11 +22,7 @@ import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.sun.jdi.*;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 24, 2004
* Time: 11:10:41 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class AssignmentEvaluator implements Evaluator{
private final Evaluator myLeftEvaluator;
@@ -15,19 +15,14 @@
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateException;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 5:21:10 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class BlockStatementEvaluator implements Evaluator{
protected Evaluator [] myStatements;
public class BlockStatementEvaluator implements Evaluator {
protected Evaluator[] myStatements;
public BlockStatementEvaluator(Evaluator[] statements) {
myStatements = statements;
@@ -35,8 +30,7 @@ public class BlockStatementEvaluator implements Evaluator{
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object result = context.getSuspendContext().getDebugProcess().getVirtualMachineProxy().mirrorOf();
for (int i = 0; i < myStatements.length; i++) {
Evaluator statement = myStatements[i];
for (Evaluator statement : myStatements) {
result = statement.evaluate(context);
}
return result;
@@ -18,13 +18,12 @@ package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 7:27:10 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class BreakContinueStatementEvaluator implements Evaluator{
public class BreakContinueStatementEvaluator {
private BreakContinueStatementEvaluator() {
}
public static Evaluator createBreakEvaluator(final String labelName) {
return new Evaluator() {
public Object evaluate(EvaluationContextImpl context) throws BreakException {
@@ -15,15 +15,11 @@
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.engine.evaluation.EvaluateException;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 7:12:47 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class BreakException extends EvaluateException{
private final String myLabelName;
@@ -15,10 +15,10 @@
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.containers.HashMap;
import com.sun.jdi.Value;
@@ -26,11 +26,7 @@ import com.sun.jdi.Value;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 24, 2004
* Time: 10:45:50 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class CodeFragmentEvaluator extends BlockStatementEvaluator{
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.evaluation.expression.CodeFragmentEvaluator");
@@ -15,15 +15,11 @@
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.engine.evaluation.EvaluateException;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 7:12:47 PM
* To change this template use File | Settings | File Templates.
* @authorlex
*/
public class ContinueException extends EvaluateException{
private final String myLabelName;
@@ -22,11 +22,7 @@ import com.intellij.openapi.util.Comparing;
import com.sun.jdi.BooleanValue;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 5:03:47 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class ForStatementEvaluator implements Evaluator {
private final Evaluator myInitializationEvaluator;
@@ -35,9 +31,13 @@ public class ForStatementEvaluator implements Evaluator {
private final Evaluator myBodyEvaluator;
private Modifier myModifier;
private final String myLabelName;
private final String myLabelName;
public ForStatementEvaluator(Evaluator initializationEvaluator, Evaluator conditionEvaluator, Evaluator updateEvaluator, Evaluator bodyEvaluator, String labelName) {
public ForStatementEvaluator(Evaluator initializationEvaluator,
Evaluator conditionEvaluator,
Evaluator updateEvaluator,
Evaluator bodyEvaluator,
String labelName) {
myInitializationEvaluator = initializationEvaluator;
myConditionEvaluator = conditionEvaluator;
myUpdateEvaluator = updateEvaluator;
@@ -51,19 +51,20 @@ public class ForStatementEvaluator implements Evaluator {
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value = context.getDebugProcess().getVirtualMachineProxy().mirrorOf();
if(myInitializationEvaluator != null) {
if (myInitializationEvaluator != null) {
value = myInitializationEvaluator.evaluate(context);
myModifier = myInitializationEvaluator.getModifier();
}
for (;;) {
if(myConditionEvaluator != null) {
while (true) {
if (myConditionEvaluator != null) {
value = myConditionEvaluator.evaluate(context);
myModifier = myConditionEvaluator.getModifier();
if(!(value instanceof BooleanValue)) {
if (!(value instanceof BooleanValue)) {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
} else {
if(!((BooleanValue)value).booleanValue()) {
}
else {
if (!((BooleanValue)value).booleanValue()) {
break;
}
}
@@ -73,19 +74,23 @@ public class ForStatementEvaluator implements Evaluator {
myBodyEvaluator.evaluate(context);
}
catch (BreakException e) {
if(Comparing.equal(e.getLabelName(), myLabelName)) {
if (Comparing.equal(e.getLabelName(), myLabelName)) {
break;
} else
}
else {
throw e;
}
}
catch (ContinueException e) {
if(Comparing.equal(e.getLabelName(), myLabelName)) {
if (Comparing.equal(e.getLabelName(), myLabelName)) {
//continue;
} else
}
else {
throw e;
}
}
if(myUpdateEvaluator != null) {
if (myUpdateEvaluator != null) {
value = myUpdateEvaluator.evaluate(context);
myModifier = myUpdateEvaluator.getModifier();
}
@@ -15,18 +15,13 @@
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.sun.jdi.BooleanValue;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 5:03:47 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class IfStatementEvaluator implements Evaluator {
private final Evaluator myConditionEvaluator;
@@ -1,74 +0,0 @@
/*
* Copyright 2000-2009 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.
*/
package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.openapi.diagnostic.Logger;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 24, 2004
* Time: 10:36:12 PM
* To change this template use File | Settings | File Templates.
*/
public class MapStack<Key, Value> {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.evaluation.expression.MapStack");
private final LinkedList<HashMap<Key, Value>> myStack;
public MapStack() {
myStack = new LinkedList<HashMap<Key,Value>>();
push();
}
public void push(){
myStack.addFirst(new HashMap<Key, Value>());
}
public void pop(){
myStack.removeFirst();
LOG.assertTrue(myStack.size() > 0);
}
private HashMap<Key, Value> current() {
return myStack.getFirst();
}
public void put(Key key, Value value) {
current().put(key, value);
}
public boolean containsKey(Key key){
for (Iterator<HashMap<Key, Value>> iterator = myStack.iterator(); iterator.hasNext();) {
HashMap<Key, Value> hashMap = iterator.next();
if(hashMap.containsKey(key))return true;
}
return false;
}
public Value get(Key key) {
for (Iterator<HashMap<Key, Value>> iterator = myStack.iterator(); iterator.hasNext();) {
HashMap<Key, Value> hashMap = iterator.next();
Value value = hashMap.get(key);
if(value != null) return value;
}
return null;
}
}
@@ -23,11 +23,7 @@ import com.sun.jdi.Value;
import org.jetbrains.annotations.NonNls;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 5:34:50 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class PostfixOperationEvaluator implements Evaluator{
private final Evaluator myOperandEvaluator;
@@ -18,18 +18,13 @@ package com.intellij.debugger.engine.evaluation.expression;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
import com.intellij.debugger.ui.impl.watch.NodeManagerImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.sun.jdi.Type;
import com.sun.jdi.Value;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 25, 2004
* Time: 2:53:29 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class SyntheticVariableEvaluator implements Evaluator{
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.engine.evaluation.expression.SyntheticVariableEvaluator");
@@ -22,11 +22,7 @@ import com.intellij.openapi.util.Comparing;
import com.sun.jdi.BooleanValue;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 20, 2004
* Time: 5:03:47 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class WhileStatementEvaluator implements Evaluator {
private final Evaluator myConditionEvaluator;
@@ -45,12 +41,13 @@ public class WhileStatementEvaluator implements Evaluator {
public Object evaluate(EvaluationContextImpl context) throws EvaluateException {
Object value;
for (;;) {
while (true) {
value = myConditionEvaluator.evaluate(context);
if(!(value instanceof BooleanValue)) {
if (!(value instanceof BooleanValue)) {
throw EvaluateExceptionUtil.BOOLEAN_EXPECTED;
} else {
if(!((BooleanValue)value).booleanValue()) {
}
else {
if (!((BooleanValue)value).booleanValue()) {
break;
}
}
@@ -58,16 +55,17 @@ public class WhileStatementEvaluator implements Evaluator {
myBodyEvaluator.evaluate(context);
}
catch (BreakException e) {
if(Comparing.equal(e.getLabelName(), myLabelName)) {
if (Comparing.equal(e.getLabelName(), myLabelName)) {
break;
} else
}
else {
throw e;
}
}
catch (ContinueException e) {
if(Comparing.equal(e.getLabelName(), myLabelName)) {
continue;
} else
if (!Comparing.equal(e.getLabelName(), myLabelName)) {
throw e;
}
}
}
@@ -18,11 +18,7 @@ package com.intellij.debugger.engine.events;
import com.intellij.debugger.impl.DebuggerTaskImpl;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 5, 2004
* Time: 6:04:07 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class DebuggerCommandImpl extends DebuggerTaskImpl {
protected abstract void action() throws Exception;
@@ -16,14 +16,12 @@
package com.intellij.debugger.impl;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 7, 2004
* Time: 2:40:47 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public interface DebuggerTask extends PrioritizedTask{
public interface DebuggerTask extends PrioritizedTask {
void release();
void hold();
void waitFor();
}
@@ -16,11 +16,7 @@
package com.intellij.debugger.impl;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 27, 2004
* Time: 12:56:52 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class DebuggerTaskImpl implements DebuggerTask {
private boolean myOnHold = false;
@@ -16,11 +16,7 @@
package com.intellij.debugger.impl;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 19, 2004
* Time: 8:48:37 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class EventQueueClosedException extends Exception{
public class EventQueueClosedException extends Exception {
}
@@ -15,23 +15,19 @@
*/
package com.intellij.debugger.impl;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Feb 24, 2004
* Time: 3:27:55 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class InvokeAndWaitThread<E extends DebuggerTask> extends InvokeThread<E>{
public abstract class InvokeAndWaitThread<E extends DebuggerTask> extends InvokeThread<E> {
public InvokeAndWaitThread() {
super();
}
//Do not remove this code
//Otherwise it will be impossible to override schedule method
/**
* !!! Do not remove this code !!!
* Otherwise it will be impossible to override schedule method
*/
public void schedule(E e) {
super.schedule(e);
}
@@ -22,11 +22,7 @@ import com.sun.jdi.VMDisconnectedException;
import java.util.concurrent.*;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 19, 2004
* Time: 11:42:03 AM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class InvokeThread<E extends PrioritizedTask> {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.impl.InvokeThread");
@@ -47,7 +43,7 @@ public abstract class InvokeThread<E extends PrioritizedTask> {
try {
wait();
}
catch (InterruptedException e) {
catch (InterruptedException ignore) {
}
}
}
@@ -33,15 +33,12 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Mar 10, 2004
* Time: 7:12:57 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
class ReloadClassesWorker {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.impl.ReloadClassesWorker");
@@ -62,10 +59,6 @@ class ReloadClassesWorker {
return myDebuggerSession.getProcess();
}
private Project getProject() {
return myDebuggerSession.getProject();
}
private void processException(Throwable e) {
if (e.getMessage() != null) {
myProgress.addMessage(myDebuggerSession, MessageCategory.ERROR, e.getMessage());
@@ -120,7 +113,7 @@ class ReloadClassesWorker {
virtualMachineProxy.suspend();
try {
final Map<ReferenceType, byte[]> redefineMap = new java.util.HashMap<ReferenceType,byte[]>();
final Map<ReferenceType, byte[]> redefineMap = new HashMap<ReferenceType,byte[]>();
int processedClassesCount = 0;
final IOException[] _ex = new IOException[] {null};
for (final String qualifiedName : modifiedClasses.keySet()) {
@@ -34,11 +34,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 12, 2004
* Time: 2:46:02 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class DebuggerEditorImpl extends CompletionEditor{
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerEditorImpl");
@@ -86,7 +82,9 @@ public abstract class DebuggerEditorImpl extends CompletionEditor{
if (document != null) {
PsiDocumentManager.getInstance(project).commitDocument(document);
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
return createText(psiFile.getText(), ((JavaCodeFragment)psiFile).importsToString());
if (psiFile != null) {
return createText(psiFile.getText(), ((JavaCodeFragment)psiFile).importsToString());
}
}
return createText("");
@@ -37,11 +37,7 @@ import java.util.List;
import java.util.ListIterator;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 12, 2004
* Time: 2:39:17 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class DebuggerStatementEditor extends DebuggerEditorImpl {
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.DebuggerStatementEditor");
@@ -46,11 +46,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 12, 2004
* Time: 4:28:52 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class StatementEvaluationDialog extends EvaluationDialog{
private final JPanel myPanel;
@@ -79,7 +75,7 @@ public class StatementEvaluationDialog extends EvaluationDialog{
splitter.setFirstComponent(editorPanel);
final EvaluationDialog.MyEvaluationPanel evaluationPanel = getEvaluationPanel();
final MyEvaluationPanel evaluationPanel = getEvaluationPanel();
final JPanel ep = new JPanel(new BorderLayout());
final JLabel resultLabel = new JLabel(DebuggerBundle.message("label.evaluate.dialog.result"));
ep.add(resultLabel, BorderLayout.NORTH);
@@ -166,6 +162,9 @@ public class StatementEvaluationDialog extends EvaluationDialog{
private void updateSwitchButton(Document document) {
PsiDocumentManager.getInstance(getProject()).commitDocument(document);
PsiFile psiFile = PsiDocumentManager.getInstance(getProject()).getPsiFile(document);
if (psiFile == null) {
return;
}
PsiElement[] children = psiFile.getChildren();
int nonWhite = 0;
for (PsiElement child : children) {
@@ -215,7 +214,7 @@ public class StatementEvaluationDialog extends EvaluationDialog{
private class SwitchAction extends AbstractAction {
public SwitchAction() {
putValue(Action.NAME, DebuggerBundle.message("action.evaluate.statement.dialog.switch.mode.description"));
putValue(NAME, DebuggerBundle.message("action.evaluate.statement.dialog.switch.mode.description"));
}
public void actionPerformed(ActionEvent e) {
@@ -24,10 +24,7 @@ import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.debugger.impl.DebuggerStateManager;
import com.intellij.debugger.ui.impl.watch.DebuggerTree;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionPopupMenu;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
@@ -39,6 +36,8 @@ import java.awt.*;
import java.awt.event.KeyEvent;
public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements DataProvider {
public static final DataKey<DebuggerTreePanel> DATA_KEY = DataKey.create("DebuggerPanel");
protected final DebuggerTree myTree;
public DebuggerTreePanel(Project project, DebuggerStateManager stateManager) {
@@ -101,7 +100,7 @@ public abstract class DebuggerTreePanel extends UpdatableDebuggerView implements
}
public Object getData(String dataId) {
if (DebuggerActions.DEBUGGER_TREE_PANEL.equals(dataId)) {
if (DebuggerTreePanel.DATA_KEY.is(dataId)) {
return this;
}
return null;
@@ -28,7 +28,7 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.ActionPopupMenu;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NonNls;
@@ -72,7 +72,7 @@ public class ThreadsPanel extends DebuggerTreePanel{
}
public Object getData(String dataId) {
if (DataConstantsEx.HELP_ID.equals(dataId)) {
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return HELP_ID;
}
return super.getData(dataId);
@@ -86,4 +86,4 @@ public class ThreadsPanel extends DebuggerTreePanel{
public ThreadsDebuggerTree getThreadsTree() {
return (ThreadsDebuggerTree) getTree();
}
}
}
@@ -38,11 +38,7 @@ import java.awt.*;
import java.awt.event.*;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Jan 29, 2004
* Time: 4:23:11 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class TipManager implements Disposable, PopupMenuListener {
@@ -53,7 +49,7 @@ public class TipManager implements Disposable, PopupMenuListener {
private MouseEvent myLastMouseEvent;
public static interface TipFactory {
public interface TipFactory {
JComponent createToolTip (MouseEvent e);
MouseEvent createTooltipEvent(MouseEvent candiateEvent);
boolean isFocusOwner();
@@ -152,8 +148,8 @@ public class TipManager implements Disposable, PopupMenuListener {
private boolean isInsideComponent(final MouseEvent e) {
final Rectangle compBounds = myComponent.getBounds();
final Point compPoint = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), myComponent);
final boolean insideCoponent = compBounds.contains(compPoint);
return insideCoponent;
return compBounds.contains(compPoint);
}
@@ -58,7 +58,7 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider{
}
public Object getData(String dataId) {
if (DataConstants.HELP_ID.equals(dataId)) {
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return HELP_ID;
}
return super.getData(dataId);
@@ -69,4 +69,4 @@ public class VariablesPanel extends DebuggerTreePanel implements DataProvider{
return (FrameDebuggerTree) getTree();
}
}
}
@@ -30,7 +30,7 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
import com.intellij.debugger.ui.impl.watch.WatchItemDescriptor;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.ActionPopupMenu;
import com.intellij.openapi.actionSystem.DataConstants;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NonNls;
@@ -71,7 +71,7 @@ public abstract class WatchPanel extends DebuggerTreePanel {
}
public Object getData(String dataId) {
if (DataConstants.HELP_ID.equals(dataId)) {
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return HELP_ID;
}
return super.getData(dataId);
@@ -80,4 +80,4 @@ public abstract class WatchPanel extends DebuggerTreePanel {
public WatchDebuggerTree getWatchTree() {
return (WatchDebuggerTree) getTree();
}
}
}
@@ -22,7 +22,6 @@ package com.intellij.debugger.ui.impl.watch;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
@@ -44,6 +43,7 @@ import com.intellij.debugger.ui.tree.NodeDescriptor;
import com.intellij.debugger.ui.tree.render.ChildrenBuilder;
import com.intellij.debugger.ui.tree.render.NodeRenderer;
import com.intellij.debugger.ui.tree.render.NodeRendererSettingsListener;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -67,6 +67,8 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
private static final Logger LOG = Logger.getInstance("#com.intellij.debugger.ui.impl.watch.DebuggerTree");
protected static final Key<Rectangle> VISIBLE_RECT = Key.create("VISIBLE_RECT");
public static final DataKey<DebuggerTree> DATA_KEY = DataKey.create("DebuggerTree");
private final Project myProject;
protected final NodeManagerImpl myNodeManager;
@@ -182,7 +184,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
}
public Object getData(String dataId) {
if (DebuggerActions.DEBUGGER_TREE.equals(dataId)) {
if (DebuggerTree.DATA_KEY.is(dataId)) {
return this;
}
return null;
@@ -705,4 +707,4 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
public void hideTooltip() {
myTipManager.hideTooltip();
}
}
}
@@ -42,11 +42,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 12, 2004
* Time: 5:24:17 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class EvaluationDescriptor extends ValueDescriptorImpl{
private Modifier myModifier;
@@ -25,30 +25,29 @@ import com.intellij.psi.PsiClass;
import com.intellij.util.Function;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 29, 2004
* Time: 6:33:26 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public abstract class DebuggerManager implements ProjectComponent, JDOMExternalizable{
public abstract class DebuggerManager implements ProjectComponent, JDOMExternalizable {
public static DebuggerManager getInstance(Project project) {
return project.getComponent(DebuggerManager.class);
}
public abstract DebugProcess getDebugProcess(ProcessHandler processHandler);
public abstract void addDebugProcessListener (ProcessHandler processHandler, DebugProcessListener listener);
public abstract void addDebugProcessListener(ProcessHandler processHandler, DebugProcessListener listener);
public abstract void removeDebugProcessListener(ProcessHandler processHandler, DebugProcessListener listener);
public abstract boolean isDebuggerManagerThread();
public abstract void addClassNameMapper(NameMapper mapper);
public abstract void removeClassNameMapper(NameMapper mapper);
public abstract String getVMClassQualifiedName(PsiClass aClass);
public abstract void registerPositionManagerFactory(Function<DebugProcess,PositionManager> factory);
public abstract String getVMClassQualifiedName(PsiClass aClass);
public abstract void registerPositionManagerFactory(Function<DebugProcess, PositionManager> factory);
public abstract void unregisterPositionManagerFactory(Function<DebugProcess, PositionManager> factory);
}
@@ -32,11 +32,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 2, 2004
* Time: 7:17:18 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public interface DebugProcess {
@NonNls String JAVA_STRATUM = "Java";
@@ -19,11 +19,7 @@ import com.intellij.debugger.DebuggerBundle;
import com.sun.jdi.*;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 8, 2004
* Time: 4:38:36 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public class EvaluateExceptionUtil {
public static final EvaluateException INCONSISTEND_DEBUG_INFO = createEvaluateException(DebuggerBundle.message("evaluation.error.inconsistent.debug.info"));
@@ -38,6 +34,9 @@ public class EvaluateExceptionUtil {
public static final EvaluateException THREAD_WAS_RESUMED = createEvaluateException(DebuggerBundle.message("evaluation.error.thread.resumed"));
public static final EvaluateException DEBUG_INFO_UNAVAILABLE = createEvaluateException(DebuggerBundle.message("evaluation.error.debug.info.unavailable"));
private EvaluateExceptionUtil() {
}
public static EvaluateException createEvaluateException(Throwable th) {
return createEvaluateException(null, th);
}
@@ -21,11 +21,7 @@ import com.sun.jdi.ReferenceType;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: lex
* Date: Apr 2, 2004
* Time: 8:49:42 PM
* To change this template use File | Settings | File Templates.
* @author lex
*/
public interface VirtualMachineProxy {
List<ReferenceType> allClasses();
@@ -15,10 +15,7 @@
*/
package com.intellij.ide.actions;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataConstants;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
@@ -31,11 +28,11 @@ public class ShowModulePropertiesAction extends AnAction{
public void actionPerformed(AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final Project project = (Project)dataContext.getData(DataConstants.PROJECT);
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) {
return;
}
final Module module = (Module)dataContext.getData(DataConstants.MODULE_CONTEXT);
final Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
if (module == null) {
return;
}
@@ -45,8 +42,8 @@ public class ShowModulePropertiesAction extends AnAction{
public void update(AnActionEvent e) {
super.update(e);
final DataContext dataContext = e.getDataContext();
final Project project = (Project)dataContext.getData(DataConstants.PROJECT);
final Module module = (Module)dataContext.getData(DataConstants.MODULE_CONTEXT);
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
final Module module = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
e.getPresentation().setVisible(project != null && module != null);
}
}
@@ -158,7 +158,7 @@ public class PaletteGroupHeader extends JCheckBox implements DataProvider {
@Nullable public Object getData(String dataId) {
Object data = myPaletteWindow.getData(dataId);
if (data != null) return data;
Project project = (Project)myPaletteWindow.getData(DataConstants.PROJECT);
Project project = PlatformDataKeys.PROJECT.getData(myPaletteWindow);
return myGroup.getData(project, dataId);
}
@@ -45,7 +45,7 @@ public class PaletteWindow extends JPanel implements DataProvider {
private final Project myProject;
private final ArrayList<PaletteGroupHeader> myGroupHeaders = new ArrayList<PaletteGroupHeader>();
private final PaletteItemProvider[] myProviders;
private final PaletteWindow.MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
private final MyPropertyChangeListener myPropertyChangeListener = new MyPropertyChangeListener();
private final Set<PaletteGroup> myGroups = new HashSet<PaletteGroup>();
private final JTabbedPane myTabbedPane = new JTabbedPane();
private final JScrollPane myScrollPane = new JScrollPane();
@@ -190,10 +190,10 @@ public class PaletteWindow extends JPanel implements DataProvider {
}
@Nullable public Object getData(String dataId) {
if (dataId.equals(DataConstants.HELP_ID)) {
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return ourHelpID;
}
if (dataId.equals(DataConstants.PROJECT)) {
if (PlatformDataKeys.PROJECT.is(dataId)) {
return myProject;
}
PaletteItem item = getActiveItem();
@@ -1065,7 +1065,7 @@ public class ClasspathPanel extends JPanel {
private static FileChooserDescriptor createFileChooserDescriptor(Component parent) {
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, true, false, false, true);
final Module contextModule = (Module)DataManager.getInstance().getDataContext(parent).getData(DataConstants.MODULE_CONTEXT);
final Module contextModule = LangDataKeys.MODULE_CONTEXT.getData(DataManager.getInstance().getDataContext(parent));
descriptor.putUserData(LangDataKeys.MODULE_CONTEXT, contextModule);
return descriptor;
}
@@ -17,8 +17,8 @@ package com.intellij.openapi.roots.ui.configuration;
import com.intellij.facet.impl.ProjectFacetsConfigurator;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataConstants;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleConfigurationEditor;
@@ -556,7 +556,7 @@ public abstract class ModuleEditor implements Place.Navigator, Disposable {
}
public Object getData(String dataId) {
if (dataId.equals(DataConstants.MODULE_CONTEXT)) {
if (LangDataKeys.MODULE_CONTEXT.is(dataId)) {
return getModule();
}
return null;
@@ -18,7 +18,6 @@ package com.intellij.openapi.roots.ui.configuration.actions;
import com.intellij.ide.projectView.impl.ModuleGroup;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DataKeys;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.impl.ModuleManagerImpl;
@@ -29,7 +28,7 @@ public class NewModuleInGroupAction extends NewModuleAction {
@Override
public void update(final AnActionEvent e) {
super.update(e);
final ModuleGroup[] moduleGroups = (ModuleGroup[])e.getDataContext().getData(DataConstantsEx.MODULE_GROUP_ARRAY);
final ModuleGroup[] moduleGroups = ModuleGroup.ARRAY_DATA_KEY.getData(e.getDataContext());
final Module[] modules = e.getData(DataKeys.MODULE_CONTEXT_ARRAY);
e.getPresentation().setVisible((moduleGroups != null && moduleGroups.length > 0) ||
(modules != null && modules.length > 0));
@@ -37,7 +36,7 @@ public class NewModuleInGroupAction extends NewModuleAction {
@Override
protected Object prepareDataFromContext(final AnActionEvent e) {
final ModuleGroup[] moduleGroups = (ModuleGroup[])e.getDataContext().getData(DataConstantsEx.MODULE_GROUP_ARRAY);
final ModuleGroup[] moduleGroups = ModuleGroup.ARRAY_DATA_KEY.getData(e.getDataContext());
if (moduleGroups != null && moduleGroups.length > 0) {
return moduleGroups [0];
}
@@ -43,7 +43,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.List;
/**
* @author nik
@@ -238,7 +240,7 @@ public class FacetStructureConfigurable extends BaseStructureConfigurable {
}
public String getHelpTopic() {
final Object component = DataManager.getInstance().getDataContext().getData(DataKeys.CONTEXT_COMPONENT.getName());
final Component component = DataKeys.CONTEXT_COMPONENT.getData(DataManager.getInstance().getDataContext());
if (myTree.equals(component)) {
final NamedConfigurable selectedConfugurable = getSelectedConfugurable();
if (selectedConfugurable instanceof FacetTypeConfigurable) {
@@ -28,7 +28,6 @@ import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.ide.util.projectWizard.NamePathComponent;
import com.intellij.ide.util.projectWizard.ProjectWizardUtil;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
@@ -47,7 +46,10 @@ import com.intellij.openapi.roots.ui.configuration.ClasspathEditor;
import com.intellij.openapi.roots.ui.configuration.ModuleEditor;
import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.*;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryProjectStructureElement;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer;
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.NamedConfigurable;
@@ -565,7 +567,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
if (DataKeys.MODULE_CONTEXT.is(dataId)){
return getSelectedModule();
}
if (DataConstantsEx.MODIFIABLE_MODULE_MODEL.equals(dataId)){
if (LangDataKeys.MODIFIABLE_MODULE_MODEL.is(dataId)){
return myContext.myModulesConfigurator.getModuleModel();
}
@@ -20,11 +20,7 @@ import com.intellij.psi.PsiType;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
* User: ven
* Date: Jul 14, 2004
* Time: 4:45:46 PM
* To change this template use File | Settings | File Templates.
* @author ven
*/
public interface ExpectedTypeInfo {
int TYPE_STRICTLY = 0;
@@ -35,19 +31,19 @@ public interface ExpectedTypeInfo {
PsiMethod getCalledMethod();
@NotNull
PsiType getType ();
PsiType getType();
PsiType getDefaultType ();
PsiType getDefaultType();
int getKind();
boolean equals (ExpectedTypeInfo info);
boolean equals(ExpectedTypeInfo info);
String toString();
ExpectedTypeInfo[] intersect(ExpectedTypeInfo info);
boolean isArrayTypeInfo ();
boolean isArrayTypeInfo();
TailType getTailType();
@@ -186,24 +186,29 @@ public class HighlightMethodUtil {
PsiMethod method = methodSignature.getMethod();
for (MethodSignatureBackedByPsiMethod superMethodSignature : superMethodSignatures) {
PsiMethod superMethod = superMethodSignature.getMethod();
// strange things happen when super method is from Object and method from interface
if (superMethod.hasModifierProperty(PsiModifier.FINAL)) {
String message = JavaErrorMessages.message("final.method.override",
HighlightUtil.formatMethod(method),
HighlightUtil.formatMethod(superMethod),
HighlightUtil.formatClass(superMethod.getContainingClass()));
TextRange textRange = HighlightNamesUtil.getMethodDeclarationTextRange(method);
HighlightInfo errorResult = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
textRange,
message);
IntentionAction fix = QUICK_FIX_FACTORY.createModifierListFix(superMethod, PsiModifier.FINAL, false, true);
QuickFixAction.registerQuickFixAction(errorResult, fix);
return errorResult;
}
HighlightInfo info = checkSuperMethodIsFinal(method, superMethod);
if (info != null) return info;
}
return null;
}
private static HighlightInfo checkSuperMethodIsFinal(PsiMethod method, PsiMethod superMethod) {
// strange things happen when super method is from Object and method from interface
if (superMethod.hasModifierProperty(PsiModifier.FINAL)) {
String message = JavaErrorMessages.message("final.method.override",
HighlightUtil.formatMethod(method),
HighlightUtil.formatMethod(superMethod),
HighlightUtil.formatClass(superMethod.getContainingClass()));
TextRange textRange = HighlightNamesUtil.getMethodDeclarationTextRange(method);
HighlightInfo errorResult = HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR,
textRange,
message);
IntentionAction fix = QUICK_FIX_FACTORY.createModifierListFix(superMethod, PsiModifier.FINAL, false, true);
QuickFixAction.registerQuickFixAction(errorResult, fix);
return errorResult;
}
return null;
}
public static HighlightInfo checkMethodIncompatibleThrows(MethodSignatureBackedByPsiMethod methodSignature,
List<HierarchicalMethodSignature> superMethodSignatures,
@@ -822,19 +827,24 @@ public class HighlightMethodUtil {
? null
: MethodSignatureUtil.findMethodBySignature(superClass, method, true);
HighlightInfo highlightInfo = checkStaticMethodOverride(aClass, method, superClass, superMethod);
boolean isStatic = method.hasModifierProperty(PsiModifier.STATIC);
HighlightInfo highlightInfo = checkStaticMethodOverride(aClass, method, isStatic,superClass, superMethod);
if (highlightInfo != null) return highlightInfo;
if (!isStatic) {
// all methods in interface are instance, so no possible errors in this case
return null;
}
PsiClass[] interfaces = aClass.getInterfaces();
for (PsiClass aInterfaces : interfaces) {
superClass = aInterfaces;
superMethod = MethodSignatureUtil.findMethodBySignature(superClass, method, true);
highlightInfo = checkStaticMethodOverride(aClass, method, superClass, superMethod);
if (highlightInfo != null) return highlightInfo;
}
return highlightInfo;
superClass = aInterfaces;
superMethod = MethodSignatureUtil.findMethodBySignature(superClass, method, true);
highlightInfo = checkStaticMethodOverride(aClass, method, true, superClass, superMethod);
if (highlightInfo != null) return highlightInfo;
}
return null;
}
private static HighlightInfo checkStaticMethodOverride(PsiClass aClass, PsiMethod method, PsiClass superClass, PsiMethod superMethod) {
private static HighlightInfo checkStaticMethodOverride(PsiClass aClass, PsiMethod method, boolean isMethodStatic, PsiClass superClass, PsiMethod superMethod) {
if (superMethod == null) return null;
PsiManager manager = superMethod.getManager();
PsiModifierList superModifierList = superMethod.getModifierList();
@@ -844,7 +854,6 @@ public class HighlightMethodUtil {
&& !JavaPsiFacade.getInstance(manager.getProject()).arePackagesTheSame(aClass, superClass)) {
return null;
}
boolean isMethodStatic = modifierList.hasModifierProperty(PsiModifier.STATIC);
boolean isSuperMethodStatic = superModifierList.hasModifierProperty(PsiModifier.STATIC);
if (isMethodStatic != isSuperMethodStatic) {
TextRange textRange = HighlightNamesUtil.getMethodDeclarationTextRange(method);
@@ -876,6 +885,8 @@ public class HighlightMethodUtil {
String accessModifier = PsiUtil.getAccessModifier(accessLevel);
HighlightInfo info = isWeaker(method, modifierList, accessModifier, accessLevel, superMethod, true);
if (info != null) return info;
info = checkSuperMethodIsFinal(method, superMethod);
if (info != null) return info;
}
return null;
}
@@ -23,21 +23,18 @@ package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.codeInsight.ExceptionUtil;
import com.intellij.codeInsight.daemon.JavaErrorMessages;
import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
import com.intellij.codeInsight.daemon.impl.quickfix.*;
import com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.intention.QuickFixFactory;
import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider;
import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider;
import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider;
import com.intellij.lang.StdLanguages;
import com.intellij.lang.findUsages.LanguageFindUsages;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
@@ -1873,17 +1870,8 @@ public class HighlightUtil {
if (PsiUtil.isInsideJavadocComment(ref)) return null;
HighlightInfo info = HighlightInfo.createHighlightInfo(type, refName, description);
QuickFixActionRegistrar registrar = new QuickFixActionRegistrarImpl(info);
final boolean dumb = DumbService.getInstance(ref.getProject()).isDumb();
UnresolvedReferenceQuickFixProvider[] fixProviders = Extensions.getExtensions(UnresolvedReferenceQuickFixProvider.EXTENSION_NAME);
for (UnresolvedReferenceQuickFixProvider each : fixProviders) {
if (dumb && !(each instanceof DumbAware)) {
continue;
}
each.registerFixes(ref, registrar);
}
UnresolvedReferenceQuickFixProvider.registerReferenceFixes(ref, new QuickFixActionRegistrarImpl(info));
return info;
}
@@ -22,8 +22,9 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
public class DefaultQuickFixProvider implements UnresolvedReferenceQuickFixProvider{
public class DefaultQuickFixProvider extends UnresolvedReferenceQuickFixProvider<PsiJavaCodeReferenceElement> {
public void registerFixes(PsiJavaCodeReferenceElement ref, QuickFixActionRegistrar registrar) {
registrar.register(new ImportClassFix(ref));
registrar.register(SetupJDKFix.getInstnace());
@@ -60,4 +61,9 @@ public class DefaultQuickFixProvider implements UnresolvedReferenceQuickFixProvi
registrar.register(new CreateInnerClassFromUsageFix(ref, CreateClassKind.CLASS));
}
}
@NotNull
public Class<PsiJavaCodeReferenceElement> getReferenceClass() {
return PsiJavaCodeReferenceElement.class;
}
}
@@ -99,6 +99,7 @@ public class ModifierFix extends IntentionAndQuickFixAction {
return myModifierList != null &&
myModifierList.isValid() &&
myModifierList.getManager().isInProject(myModifierList) &&
myModifierList.hasModifierProperty(myModifier) != myShouldHave &&
(myVariable == null || myVariable.isValid());
}
@@ -22,7 +22,7 @@ import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.ide.DataManager;
import com.intellij.ide.util.PackageUtil;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.module.Module;
@@ -43,6 +43,9 @@ import org.jetbrains.annotations.NotNull;
* @author cdr
*/
public class MoveClassToModuleFix {
private MoveClassToModuleFix() {
}
public static void registerFixes(QuickFixActionRegistrar registrar, final PsiJavaCodeReferenceElement reference) {
final PsiElement psiElement = reference.getElement();
@NonNls final String referenceName = reference.getRangeInElement().substring(psiElement.getText());
@@ -102,8 +105,11 @@ public class MoveClassToModuleFix {
DataManager dataManager = DataManager.getInstance();
DataContext dataContext = dataManager.getDataContext();
PsiDirectory directory = PackageUtil.findOrCreateDirectoryForPackage(currentModule, packageName, sourceRoot, true);
DataContext context = SimpleDataContext.getSimpleContext(DataConstantsEx.TARGET_PSI_ELEMENT, directory, dataContext);
DataContext context = SimpleDataContext.getSimpleContext(LangDataKeys.TARGET_PSI_ELEMENT.getName(), directory, dataContext);
String qualifiedName = aClass.getQualifiedName();
if (qualifiedName == null) {
return;
}
moveHandler.invoke(project, new PsiElement[]{aClass}, context);
PsiReference reference = file.findReferenceAt(editor.getCaretModel().getOffset());
PsiClass newClass = JavaPsiFacade.getInstance(project).findClass(qualifiedName, GlobalSearchScope.moduleScope(currentModule));
@@ -15,18 +15,14 @@
*/
package com.intellij.codeInsight.editorActions.smartEnter;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.IncorrectOperationException;
/**
* Created by IntelliJ IDEA.
* User: Maxim.Mossienko
* Date: Jul 5, 2004
* Time: 8:44:32 PM
* To change this template use File | Settings | File Templates.
* @author Maxim.Mossienko
*/
public class MissingForeachBodyFixer implements Fixer {
public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException {
@@ -15,20 +15,16 @@
*/
package com.intellij.codeInsight.hint.api.impls;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.lang.parameterInfo.*;
import com.intellij.psi.*;
import com.intellij.util.text.CharArrayUtil;
import com.intellij.codeInsight.lookup.LookupElement;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* Created by IntelliJ IDEA.
* User: Maxim.Mossienko
* Date: Feb 1, 2006
* Time: 3:16:16 PM
* To change this template use File | Settings | File Templates.
* @author Maxim.Mossienko
*/
public class AnnotationParameterInfoHandler implements ParameterInfoHandler<PsiAnnotationParameterList,PsiAnnotationMethod> {
public @Nullable Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
@@ -15,22 +15,18 @@
*/
package com.intellij.codeInsight.hint.api.impls;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.lang.parameterInfo.*;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.util.Function;
import com.intellij.codeInsight.lookup.LookupElement;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
/**
* Created by IntelliJ IDEA.
* User: Maxim.Mossienko
* Date: Feb 1, 2006
* Time: 3:16:09 PM
* To change this template use File | Settings | File Templates.
* @author Maxim.Mossienko
*/
public class ReferenceParameterInfoHandler implements ParameterInfoHandler<PsiReferenceParameterList,PsiTypeParameter> {
public Object[] getParametersForLookup(final LookupElement item, final ParameterInfoContext context) {
@@ -22,11 +22,7 @@ import com.intellij.codeInsight.template.Result;
import com.intellij.codeInsight.template.TextResult;
/**
* Created by IntelliJ IDEA.
* User: Maxim
* Date: Nov 7, 2006
* Time: 12:17:39 AM
* To change this template use File | Settings | File Templates.
* @author Maxim
*/
public class TextExpression extends Expression {
private final String myString;
@@ -19,6 +19,7 @@ package com.intellij.codeInsight.template.macro;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.codeInsight.template.*;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiManager;
@@ -28,17 +29,14 @@ import com.intellij.psi.search.searches.AnnotatedMembersSearch;
import com.intellij.util.Query;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.LinkedHashSet;
import java.util.Set;
/**
* Created by IntelliJ IDEA.
* User: Maxim.Mossienko
* Date: 11.06.2009
* Time: 0:20:54
* To change this template use File | Settings | File Templates.
*/
* @author Maxim.Mossienko
*/
public class AnnotatedMacro implements Macro {
@NonNls
@@ -55,7 +53,8 @@ public class AnnotatedMacro implements Macro {
return "";
}
private Query<PsiMember> findAnnotated(ExpressionContext context, Expression[] params) {
@Nullable
private static Query<PsiMember> findAnnotated(ExpressionContext context, Expression[] params) {
if (params == null || params.length == 0) return null;
PsiManager instance = PsiManager.getInstance(context.getProject());
@@ -94,8 +93,10 @@ public class AnnotatedMacro implements Macro {
Set<LookupElement> set = new LinkedHashSet<LookupElement>();
final String secondParamValue = params.length > 1 ? params[1].calculateResult(context).toString() : null;
final boolean isShortName = secondParamValue != null && !Boolean.valueOf(secondParamValue);
final PsiClass findInClass =
secondParamValue != null ? JavaPsiFacade.getInstance(context.getProject()).findClass(secondParamValue) : null;
final Project project = context.getProject();
final PsiClass findInClass = secondParamValue != null
? JavaPsiFacade.getInstance(project).findClass(secondParamValue, GlobalSearchScope.allScope(project))
: null;
for (PsiMember object : query.findAll()) {
if (findInClass != null && !object.getContainingClass().equals(findInClass)) continue;
@@ -92,10 +92,6 @@ public class ControlFlow {
myFields = fields;
}
public void dump(PrintStream p) {
p.println(toString());
}
public String toString() {
StringBuilder result = new StringBuilder();
@@ -48,7 +48,7 @@ public class CyclicDependenciesAction extends AnAction{
public void update(AnActionEvent event) {
Presentation presentation = event.getPresentation();
presentation.setEnabled(
getInspectionScope(event.getDataContext()) != null || event.getDataContext().getData(DataConstants.PSI_FILE) != null);
getInspectionScope(event.getDataContext()) != null || event.getData(LangDataKeys.PSI_FILE) != null);
}
public void actionPerformed(AnActionEvent e) {
@@ -82,7 +82,7 @@ public class CyclicDependenciesAction extends AnAction{
}
private AnalysisScope getInspectionScope(final DataContext dataContext) {
private static AnalysisScope getInspectionScope(final DataContext dataContext) {
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) return null;
@@ -91,19 +91,19 @@ public class CyclicDependenciesAction extends AnAction{
return scope != null && scope.getScopeType() != AnalysisScope.INVALID ? scope : null;
}
private AnalysisScope getInspectionScopeImpl(DataContext dataContext) {
private static AnalysisScope getInspectionScopeImpl(DataContext dataContext) {
//Possible scopes: package, project, module.
Project projectContext = PlatformDataKeys.PROJECT_CONTEXT.getData(dataContext);
if (projectContext != null) {
return new AnalysisScope(projectContext);
}
Module moduleContext = (Module)dataContext.getData(DataConstants.MODULE_CONTEXT);
Module moduleContext = LangDataKeys.MODULE_CONTEXT.getData(dataContext);
if (moduleContext != null) {
return new AnalysisScope(moduleContext);
}
Module [] modulesArray = (Module[])dataContext.getData(DataConstants.MODULE_CONTEXT_ARRAY);
Module [] modulesArray = LangDataKeys.MODULE_CONTEXT_ARRAY.getData(dataContext);
if (modulesArray != null) {
return new AnalysisScope(modulesArray);
}
@@ -117,7 +117,7 @@ public class CyclicDependenciesAction extends AnAction{
else if (psiTarget instanceof PsiPackage) {
PsiPackage pack = (PsiPackage)psiTarget;
PsiDirectory[] dirs = pack.getDirectories(GlobalSearchScope.projectScope(pack.getProject()));
if (dirs == null || dirs.length == 0) return null;
if (dirs.length == 0) return null;
return new JavaAnalysisScope(pack, LangDataKeys.MODULE.getData(dataContext));
} else if (psiTarget != null){
return null;
@@ -127,12 +127,20 @@ public class CyclicDependenciesAction extends AnAction{
return getProjectScope(dataContext);
}
private AnalysisScope getProjectScope(DataContext dataContext) {
return new AnalysisScope(PlatformDataKeys.PROJECT.getData(dataContext));
private static AnalysisScope getProjectScope(DataContext dataContext) {
final Project data = PlatformDataKeys.PROJECT.getData(dataContext);
if (data == null) {
return null;
}
return new AnalysisScope(data);
}
private AnalysisScope getModuleScope(DataContext dataContext) {
return new AnalysisScope(LangDataKeys.MODULE.getData(dataContext));
private static AnalysisScope getModuleScope(DataContext dataContext) {
final Module data = LangDataKeys.MODULE.getData(dataContext);
if (data == null) {
return null;
}
return new AnalysisScope(data);
}
private class ProjectModuleOrPackageDialog extends DialogWrapper {
@@ -388,7 +388,7 @@ public class CyclicDependenciesPanel extends JPanel implements Disposable, DataP
@Nullable
@NonNls
public Object getData(@NonNls String dataId) {
if (dataId.equals(DataConstants.HELP_ID)) {
if (PlatformDataKeys.HELP_ID.is(dataId)) {
return "dependency.viewer.tool.window";
}
return null;
@@ -497,7 +497,7 @@ public class CyclicDependenciesPanel extends JPanel implements Disposable, DataP
private static class MyTree extends Tree implements DataProvider {
public Object getData(String dataId) {
PackageDependenciesNode node = getSelectedNode();
if (DataConstants.NAVIGATABLE.equals(dataId)) {
if (PlatformDataKeys.NAVIGATABLE.is(dataId)) {
return node;
}
return null;
@@ -1,34 +0,0 @@
/*
* Copyright 2000-2009 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.
*/
package com.intellij.ide;
import com.intellij.psi.*;
import com.intellij.openapi.actionSystem.DataContext;
public class JavaDataAccessors {
public static final DataAccessor<PsiPackage> FILE_PACKAGE = new DataAccessor<PsiPackage>() {
public PsiPackage getImpl(DataContext dataContext) throws NoDataException {
PsiFile psiFile = DataAccessors.PSI_FILE.getNotNull(dataContext);
PsiDirectory containingDirectory = psiFile.getContainingDirectory();
if (containingDirectory == null || !containingDirectory.isValid()) return null;
return JavaDirectoryService.getInstance().getPackage(containingDirectory);
}
};
public static final DataAccessor<PsiJavaFile> PSI_JAVA_FILE = DataAccessor.SubClassDataAccessor.create(DataAccessors.PSI_FILE, PsiJavaFile.class);
private JavaDataAccessors() {
}
}
@@ -30,7 +30,6 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.Project;
@@ -89,9 +88,9 @@ public class PsiPackageFavoriteNodeProvider extends FavoriteNodeProvider {
}
}
} else {
final Object data = context.getData(DataConstantsEx.MODULE_GROUP_ARRAY);
if (data instanceof ModuleGroup[]) {
for (ModuleGroup moduleGroup : ((ModuleGroup[])data)) {
final ModuleGroup[] data = ModuleGroup.ARRAY_DATA_KEY.getData(context);
if (data != null) {
for (ModuleGroup moduleGroup : data) {
if (currentViewId.equals(ProjectViewPane.ID)) {
result.add(new ProjectViewModuleGroupNode(project, moduleGroup, viewSettings));
}
@@ -198,4 +197,4 @@ public class PsiPackageFavoriteNodeProvider extends FavoriteNodeProvider {
}
return super.getPsiElement(element);
}
}
}
@@ -45,7 +45,7 @@ abstract class OverrideImplementMethodAction extends AnAction {
public final void actionPerformed(final AnActionEvent event) {
final DataContext dataContext = event.getDataContext();
final MethodHierarchyBrowser methodHierarchyBrowser = (MethodHierarchyBrowser)dataContext.getData(MethodHierarchyBrowserBase.METHOD_HIERARCHY_BROWSER_DATA_KEY);
final MethodHierarchyBrowser methodHierarchyBrowser = (MethodHierarchyBrowser)MethodHierarchyBrowserBase.DATA_KEY.getData(dataContext);
if (methodHierarchyBrowser == null) return;
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
if (project == null) return;
@@ -98,7 +98,7 @@ abstract class OverrideImplementMethodAction extends AnAction {
final Presentation presentation = e.getPresentation();
final DataContext dataContext = e.getDataContext();
final MethodHierarchyBrowser methodHierarchyBrowser = (MethodHierarchyBrowser)dataContext.getData(MethodHierarchyBrowser.METHOD_HIERARCHY_BROWSER_DATA_KEY);
final MethodHierarchyBrowser methodHierarchyBrowser = (MethodHierarchyBrowser)MethodHierarchyBrowserBase.DATA_KEY.getData(dataContext);
if (methodHierarchyBrowser == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
@@ -15,11 +15,12 @@
*/
package com.intellij.ide.macro;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiJavaFile;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.JavaDataAccessors;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.LangDataKeys;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiJavaFile;
public final class FileClassMacro extends Macro {
public String getName() {
@@ -43,15 +44,14 @@ public final class FileClassMacro extends Macro {
//if (!(psiFile instanceof PsiJavaFile)) {
// return null;
//}
final PsiJavaFile javaFile = JavaDataAccessors.PSI_JAVA_FILE.from(dataContext);
if (javaFile == null) return null;
PsiClass[] classes = javaFile.getClasses();
final PsiFile javaFile = LangDataKeys.PSI_FILE.getData(dataContext);
if (!(javaFile instanceof PsiJavaFile)) return null;
PsiClass[] classes = ((PsiJavaFile) javaFile).getClasses();
if (classes.length == 1) {
return classes[0].getQualifiedName();
}
String fileName = javaFile.getVirtualFile().getNameWithoutExtension();
for (int i = 0; i < classes.length; i++) {
PsiClass aClass = classes[i];
for (PsiClass aClass : classes) {
String name = aClass.getName();
if (fileName.equals(name)) {
return aClass.getQualifiedName();
@@ -15,14 +15,13 @@
*/
package com.intellij.ide.macro;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.psi.PsiPackage;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.JavaDataAccessors;
public class FileFQPackage extends Macro {
public String expand(DataContext dataContext) throws Macro.ExecutionCancelledException {
PsiPackage aPackage = JavaDataAccessors.FILE_PACKAGE.from(dataContext);
public String expand(DataContext dataContext) {
PsiPackage aPackage = FilePackageMacro.getFilePackage(dataContext);
if (aPackage == null) return null;
return aPackage.getQualifiedName();
}
@@ -15,10 +15,14 @@
*/
package com.intellij.ide.macro;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.psi.PsiPackage;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.JavaDataAccessors;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataKeys;
import com.intellij.psi.JavaDirectoryService;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiPackage;
import org.jetbrains.annotations.Nullable;
public final class FilePackageMacro extends Macro {
public String getName() {
@@ -30,8 +34,17 @@ public final class FilePackageMacro extends Macro {
}
public String expand(DataContext dataContext) {
PsiPackage aPackage = JavaDataAccessors.FILE_PACKAGE.from(dataContext);
PsiPackage aPackage = getFilePackage(dataContext);
if (aPackage == null) return null;
return aPackage.getName();
}
@Nullable
static PsiPackage getFilePackage(DataContext dataContext) {
PsiFile psiFile = DataKeys.PSI_FILE.getData(dataContext);
if (psiFile == null) return null;
PsiDirectory containingDirectory = psiFile.getContainingDirectory();
if (containingDirectory == null || !containingDirectory.isValid()) return null;
return JavaDirectoryService.getInstance().getPackage(containingDirectory);
}
}
@@ -32,7 +32,6 @@ import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.ide.util.treeView.AbstractTreeUpdater;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.OrderEntry;
@@ -40,7 +39,10 @@ import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.JavaDirectoryService;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPackage;
import com.intellij.psi.search.GlobalSearchScope;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -89,10 +91,10 @@ public final class PackageViewPane extends AbstractProjectViewPSIPane {
@Override
public Object getData(final String dataId) {
if (DataConstantsEx.PACKAGE_ELEMENT.equals(dataId)) {
if (PackageElement.DATA_KEY.is(dataId)) {
final PackageElement packageElement = getSelectedPackageElement();
}
if (DataConstants.MODULE.equals(dataId)) {
if (LangDataKeys.MODULE.is(dataId)) {
final PackageElement packageElement = getSelectedPackageElement();
if (packageElement != null) {
return packageElement.getModule();
@@ -288,4 +290,4 @@ public final class PackageViewPane extends AbstractProjectViewPSIPane {
return modules.toArray(new Module[modules.size()]);
}
}
}
}
@@ -15,6 +15,7 @@
*/
package com.intellij.ide.projectView.impl.nodes;
import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.module.Module;
import com.intellij.psi.PsiPackage;
@@ -24,6 +25,8 @@ import com.intellij.psi.PsiPackage;
* Time: 3:51:02 PM
*/
public final class PackageElement {
public static final DataKey<PackageElement> DATA_KEY = DataKey.create("package.element");
private final Module myModule;
private final PsiPackage myElement;
private final boolean myIsLibraryElement;
@@ -24,11 +24,7 @@ import java.lang.ref.SoftReference;
import java.util.ResourceBundle;
/**
* Created by IntelliJ IDEA.
* User: yole
* Date: 01.09.2005
* Time: 14:37:13
* To change this template use File | Settings | File Templates.
* @author yole
*/
public class JavadocBundle {
private static Reference<ResourceBundle> ourBundle;
@@ -38,7 +34,7 @@ public class JavadocBundle {
private JavadocBundle() {
}
public static String message(@PropertyKey(resourceBundle = BUNDLE)String key, Object... params) {
public static String message(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
@@ -23,8 +23,8 @@ import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.runners.ProgramRunner;
import com.intellij.execution.util.ExecutionErrorDialog;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.DataConstants;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
import com.intellij.openapi.components.AbstractProjectComponent;
import com.intellij.openapi.module.Module;
@@ -57,7 +57,7 @@ public final class JavadocGenerationManager extends AbstractProjectComponent imp
}
public void generateJavadoc(final PsiDirectory directory, DataContext dataContext) {
Component component = (Component)dataContext.getData(DataConstants.CONTEXT_COMPONENT);
Component component = PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
final PsiPackage aPackage = directory != null ? JavaDirectoryService.getInstance().getPackage(directory) : null;
String packageFQName = aPackage != null ? aPackage.getQualifiedName() : null;
@@ -126,4 +126,4 @@ public final class JavadocGenerationManager extends AbstractProjectComponent imp
return myConfiguration;
}
}
}
@@ -33,7 +33,7 @@ public final class GenerateJavadocAction extends AnAction{
public void update(AnActionEvent event){
final Presentation presentation = event.getPresentation();
presentation.setEnabled(event.getDataContext().getData(DataConstants.PROJECT) != null);
presentation.setEnabled(PlatformDataKeys.PROJECT.getData(event.getDataContext()) != null);
}
private static PsiDirectory getDirectoryFromContext(final DataContext dataContext) {
@@ -63,4 +63,4 @@ public final class GenerateJavadocAction extends AnAction{
return null;
}
}
}
@@ -61,11 +61,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.*;
/**
* Created by IntelliJ IDEA.
* User: Maxim.Mossienko
* Date: Apr 11, 2006
* Time: 7:45:12 PM
* To change this template use File | Settings | File Templates.
* @author Maxim.Mossienko
*/
public class JavaDocumentationProvider implements CodeDocumentationProvider {
private static final String LINE_SEPARATOR = "\n";
@@ -608,7 +604,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider {
return CodeInsightBundle.message("javadoc.candidates.not.found", text);
}
private void createElementLink(@NonNls final StringBuffer sb, final PsiElement element, final String str) {
private static void createElementLink(@NonNls final StringBuffer sb, final PsiElement element, final String str) {
sb.append("&nbsp;&nbsp;<a href=\"psi_element://");
sb.append(JavaDocUtil.getReferenceText(element.getProject(), element));
sb.append("\">");
@@ -649,7 +645,7 @@ public class JavaDocumentationProvider implements CodeDocumentationProvider {
JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<String>("Choose javadoc root", ArrayUtil.toStringArray(set)) {
public PopupStep onChosen(final String selectedValue, final boolean finalChoice) {
BrowserUtil.launchBrowser(selectedValue);
return PopupStep.FINAL_CHOICE;
return FINAL_CHOICE;
}
}).showInBestPositionFor(DataManager.getInstance().getDataContext());
}
@@ -26,11 +26,7 @@ import com.intellij.pom.java.LanguageLevel;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
* User: max
* Date: Jan 22, 2005
* Time: 11:16:59 PM
* To change this template use File | Settings | File Templates.
* @author max
*/
public class JavaLanguage extends Language {
public JavaLanguage() {
@@ -38,7 +34,8 @@ public class JavaLanguage extends Language {
SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(this, new SyntaxHighlighterFactory() {
@NotNull
public SyntaxHighlighter getSyntaxHighlighter(final Project project, final VirtualFile virtualFile) {
return new JavaFileHighlighter(virtualFile != null ? LanguageLevelUtil.getLanguageLevelForFile(virtualFile) : LanguageLevel.HIGHEST);
return new JavaFileHighlighter(
virtualFile != null ? LanguageLevelUtil.getLanguageLevelForFile(virtualFile) : LanguageLevel.HIGHEST);
}
});
}
@@ -35,11 +35,7 @@ import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
/**
* Created by IntelliJ IDEA.
* User: max
* Date: Jan 26, 2005
* Time: 12:40:22 PM
* To change this template use File | Settings | File Templates.
* @author max
*/
public class JavaParserDefinition implements ParserDefinition {
private final TokenSet myStringLiteralElementSet = TokenSet.create(JavaElementType.LITERAL_EXPRESSION);
@@ -15,10 +15,8 @@
*/
package com.intellij.psi.impl.compiled;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiInvalidElementAccessException;
import com.intellij.psi.PsiManager;
import com.intellij.psi.*;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.stubs.PsiFileStub;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.ArrayUtil;
@@ -26,13 +24,17 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
public abstract class ClsRepositoryPsiElement<T extends StubElement> extends ClsElementImpl {
public abstract class ClsRepositoryPsiElement<T extends StubElement> extends ClsElementImpl implements StubBasedPsiElement<T> {
private final T myStub;
protected ClsRepositoryPsiElement(final T stub) {
myStub = stub;
}
public IStubElementType getElementType() {
return myStub.getStubType();
}
public PsiElement getParent() {
return myStub.getParentStub().getPsi();
}

Some files were not shown because too many files have changed in this diff Show More