mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -10,10 +10,10 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="lang-api" />
|
||||
<orderEntry type="library" name="JUnit4" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="JUnit4" level="project" />
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
<orderEntry type="module" module-name="testFramework" />
|
||||
<orderEntry type="module" module-name="testFramework" scope="TEST" />
|
||||
<orderEntry type="library" name="Jaxen" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -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.
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);
|
||||
}
|
||||
|
||||
+3
-7
@@ -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);
|
||||
|
||||
+2
-6
@@ -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];
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$APPLICATION_HOME_DIR$/community/lib/dev/compilerapi.jar!/" />
|
||||
<root url="jar://$MODULE_DIR$/../../../lib/dev/compilerapi.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.compiler.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactManager;
|
||||
import com.intellij.packaging.impl.compiler.ArtifactCompileScope;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class BuildAllArtifactsAction extends AnAction {
|
||||
public BuildAllArtifactsAction() {
|
||||
super("Build All Artifacts", "Build all configured artifacts", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(e.getData(PlatformDataKeys.PROJECT) != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
if (project == null) return;
|
||||
|
||||
List<Artifact> toBuild = new ArrayList<Artifact>();
|
||||
for (Artifact artifact : ArtifactManager.getInstance(project).getSortedArtifacts()) {
|
||||
if (!StringUtil.isEmpty(artifact.getOutputPath())) {
|
||||
toBuild.add(artifact);
|
||||
}
|
||||
}
|
||||
CompilerManager.getInstance(project).make(ArtifactCompileScope.createArtifactsScope(project, toBuild), null);
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,7 @@
|
||||
*/
|
||||
package com.intellij.compiler.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionGroup;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
@@ -50,6 +47,11 @@ public class BuildArtifactActionGroup extends ActionGroup {
|
||||
actions.add(new BuildArtifactAction(project, artifact));
|
||||
}
|
||||
}
|
||||
if (actions.size() > 1) {
|
||||
actions.add(0, new BuildAllArtifactsAction());
|
||||
actions.add(1, Separator.getInstance());
|
||||
}
|
||||
return actions.toArray(new AnAction[actions.size()]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||
|
||||
@@ -93,6 +93,10 @@ class PsiMethodListPopupStep implements ListPopupStep {
|
||||
return FINAL_CHOICE;
|
||||
}
|
||||
|
||||
public Runnable getFinalRunnable() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasSubstep(Object selectedValue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+4
-4
@@ -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>());
|
||||
|
||||
|
||||
+2
-8
@@ -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);
|
||||
}
|
||||
|
||||
+5
-8
@@ -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);
|
||||
}
|
||||
|
||||
+1
-5
@@ -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;
|
||||
|
||||
+5
-11
@@ -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;
|
||||
|
||||
+5
-6
@@ -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 {
|
||||
|
||||
+2
-6
@@ -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;
|
||||
|
||||
+2
-6
@@ -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");
|
||||
|
||||
+2
-6
@@ -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;
|
||||
|
||||
+23
-18
@@ -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();
|
||||
}
|
||||
|
||||
+3
-8
@@ -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;
|
||||
|
||||
-74
@@ -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;
|
||||
}
|
||||
}
|
||||
+1
-5
@@ -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;
|
||||
|
||||
+1
-6
@@ -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");
|
||||
|
||||
+12
-14
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -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";
|
||||
|
||||
+4
-5
@@ -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();
|
||||
|
||||
@@ -19,18 +19,11 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.configurations.CommandLineBuilder;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.configurations.JavaParameters;
|
||||
import com.intellij.execution.junit2.SegmentedInputStream;
|
||||
import com.intellij.execution.junit2.segments.DeferedActionsQueue;
|
||||
import com.intellij.execution.junit2.segments.DispatchListener;
|
||||
import com.intellij.execution.junit2.segments.PacketExtractorBase;
|
||||
import com.intellij.execution.junit2.segments.Extractor;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessTerminatedListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.rt.execution.junit.segments.PacketProcessor;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
@@ -50,18 +43,18 @@ public class JUnitProcessHandler extends OSProcessHandler {
|
||||
}
|
||||
|
||||
protected Reader createProcessOutReader() {
|
||||
return myOut.getReader();
|
||||
return myOut.createReader();
|
||||
}
|
||||
|
||||
protected Reader createProcessErrReader() {
|
||||
return myErr.getReader();
|
||||
return myErr.createReader();
|
||||
}
|
||||
|
||||
public PacketExtractorBase getErr() {
|
||||
public Extractor getErr() {
|
||||
return myErr;
|
||||
}
|
||||
|
||||
public PacketExtractorBase getOut() {
|
||||
public Extractor getOut() {
|
||||
return myOut;
|
||||
}
|
||||
|
||||
@@ -83,46 +76,4 @@ public class JUnitProcessHandler extends OSProcessHandler {
|
||||
ProcessTerminatedListener.attach(processHandler);
|
||||
return processHandler;
|
||||
}
|
||||
|
||||
private class Extractor extends PacketExtractorBase {
|
||||
private final SegmentedInputStream myStream;
|
||||
|
||||
public Extractor(final InputStream stream, final Charset charset) {
|
||||
myStream = new SegmentedInputStream(stream, charset);
|
||||
}
|
||||
|
||||
public void setPacketProcessor(final PacketProcessor packetProcessor) {
|
||||
myStream.setEventsDispatcher(new PacketProcessor() {
|
||||
public void processPacket(final String packet) {
|
||||
perform(new Runnable() {
|
||||
public void run() {
|
||||
packetProcessor.processPacket(packet);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setFulfilledWorkGate(final DeferedActionsQueue fulfilledWorkGate) {
|
||||
super.setFulfilledWorkGate(new DeferedActionsQueue() {
|
||||
public void addLast(final Runnable runnable) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
fulfilledWorkGate.addLast(runnable);
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
public void setDispactchListener(final DispatchListener listener) {
|
||||
fulfilledWorkGate.setDispactchListener(listener);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Reader getReader() {
|
||||
return new SegmentedInputStreamReader(myStream);
|
||||
//return new InputStreamReader(myStream, myCharset);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,21 +62,22 @@ public class SegmentedInputStream extends InputStream {
|
||||
while (true) {
|
||||
nextByte = readNext();
|
||||
if (nextByte != SegmentedStream.SPECIAL_SYMBOL) break;
|
||||
final boolean packetRead = readControlSequence();
|
||||
if (!packetRead) break;
|
||||
final Integer packetRead = readControlSequence();
|
||||
if (packetRead != null) break;
|
||||
}
|
||||
return nextByte;
|
||||
}
|
||||
|
||||
private boolean readControlSequence() throws IOException {
|
||||
private Integer readControlSequence() throws IOException {
|
||||
for (int idx = 1; idx < SegmentedStream.MARKER_PREFIX.length(); idx++) {
|
||||
if (readNext() != SegmentedStream.MARKER_PREFIX.charAt(idx)) {
|
||||
return false;
|
||||
final int readAhead = readNext();
|
||||
if (readAhead != SegmentedStream.MARKER_PREFIX.charAt(idx)) {
|
||||
return readAhead;
|
||||
}
|
||||
}
|
||||
final char[] marker = readMarker();
|
||||
if(myEventsDispatcher != null) myEventsDispatcher.processPacket(decode(marker));
|
||||
return true;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setEventsDispatcher(final PacketProcessor eventsDispatcher) {
|
||||
@@ -127,11 +128,11 @@ public class SegmentedInputStream extends InputStream {
|
||||
mySourceStream.pushBack(b);
|
||||
return 1;
|
||||
}
|
||||
final boolean packetRead = readControlSequence();
|
||||
if (!packetRead) {
|
||||
final Integer packetRead = readControlSequence();
|
||||
if (packetRead != null) {
|
||||
// push back quoted slash
|
||||
mySourceStream.pushBack(b);
|
||||
mySourceStream.pushBack(b);
|
||||
mySourceStream.pushBack(packetRead);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.execution.junit2.segments;
|
||||
|
||||
public interface DeferedActionsQueue {
|
||||
public interface DeferredActionsQueue {
|
||||
void addLast(Runnable runnable);
|
||||
|
||||
void setDispactchListener(DispatchListener listener);
|
||||
+1
-1
@@ -19,7 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class DeferedActionsQueueImpl implements DeferedActionsQueue {
|
||||
public class DeferredActionsQueueImpl implements DeferredActionsQueue {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.junit2.segments.DeferedActionsQueueImpl");
|
||||
private DispatchListener myListener = DispatchListener.DEAF;
|
||||
private int myCounter = 0;
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.execution.junit2.segments;
|
||||
|
||||
import com.intellij.execution.junit.SegmentedInputStreamReader;
|
||||
import com.intellij.execution.junit2.SegmentedInputStream;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.rt.execution.junit.segments.PacketProcessor;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* @author dyoma
|
||||
*/
|
||||
public class Extractor {
|
||||
private DeferredActionsQueue myFulfilledWorkGate = null;
|
||||
private final SegmentedInputStream myStream;
|
||||
|
||||
public Extractor(final InputStream stream, final Charset charset) {
|
||||
myStream = new SegmentedInputStream(stream, charset);
|
||||
}
|
||||
|
||||
public void setDispatchListener(final DispatchListener listener) {
|
||||
myFulfilledWorkGate.setDispactchListener(listener);
|
||||
}
|
||||
|
||||
public void setPacketDispatcher(final PacketProcessor packetProcessor, final DeferredActionsQueue queue) {
|
||||
myFulfilledWorkGate = new DeferredActionsQueue() { //todo make it all later
|
||||
public void addLast(final Runnable runnable) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
queue.addLast(runnable);
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
|
||||
public void setDispactchListener(final DispatchListener listener) {
|
||||
queue.setDispactchListener(listener);
|
||||
}
|
||||
};
|
||||
myStream.setEventsDispatcher(new PacketProcessor() {
|
||||
public void processPacket(final String packet) {
|
||||
myFulfilledWorkGate.addLast(new Runnable() {
|
||||
public void run() {
|
||||
packetProcessor.processPacket(packet);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Reader createReader() {
|
||||
return new SegmentedInputStreamReader(myStream);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,10 +18,8 @@ package com.intellij.execution.junit2.segments;
|
||||
import com.intellij.execution.ui.ConsoleViewContentType;
|
||||
|
||||
public interface InputConsumer {
|
||||
class DeafInputConsumer implements InputConsumer {
|
||||
public void onOutput(final String text, final ConsoleViewContentType contentType) {
|
||||
}
|
||||
}
|
||||
DeafInputConsumer DEAF = new DeafInputConsumer();
|
||||
InputConsumer DEAF = new InputConsumer() {
|
||||
public void onOutput(String text, ConsoleViewContentType contentType) {}
|
||||
};
|
||||
void onOutput(String text, ConsoleViewContentType contentType);
|
||||
}
|
||||
|
||||
-39
@@ -1,39 +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.execution.junit2.segments;
|
||||
|
||||
import com.intellij.rt.execution.junit.segments.PacketProcessor;
|
||||
|
||||
/**
|
||||
* @author dyoma
|
||||
*/
|
||||
public abstract class PacketExtractorBase {
|
||||
private DeferedActionsQueue myFulfilledWorkGate = null;
|
||||
|
||||
public void setFulfilledWorkGate(final DeferedActionsQueue fulfilledWorkGate) {
|
||||
myFulfilledWorkGate = fulfilledWorkGate;
|
||||
}
|
||||
|
||||
public abstract void setPacketProcessor(PacketProcessor packetProcessor);
|
||||
|
||||
public void setDispatchListener(final DispatchListener listener) {
|
||||
myFulfilledWorkGate.setDispactchListener(listener);
|
||||
}
|
||||
|
||||
protected void perform(final Runnable runnable) {
|
||||
myFulfilledWorkGate.addLast(runnable);
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiClassUtil;
|
||||
@@ -134,9 +135,16 @@ public class JavaExecutionUtil {
|
||||
|
||||
@Nullable
|
||||
public static PsiClass findMainClass(final Module module, final String mainClassName) {
|
||||
final PsiManager psiManager = PsiManager.getInstance(module.getProject());
|
||||
return findMainClass(module.getProject(), mainClassName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PsiClass findMainClass(final Project project, final String mainClassName, final GlobalSearchScope scope) {
|
||||
final PsiManager psiManager = PsiManager.getInstance(project);
|
||||
final String shortName = StringUtil.getShortName(mainClassName);
|
||||
final String packageName = StringUtil.getPackageName(mainClassName);
|
||||
return JavaPsiFacade.getInstance(psiManager.getProject())
|
||||
.findClass(mainClassName.replace('$', '.'), GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
|
||||
.findClass(StringUtil.getQualifiedName(packageName, shortName.replace('$', '.')), scope);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.JavaExecutionUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
@@ -57,7 +58,7 @@ public class JavaRunConfigurationModule extends RunConfigurationModule {
|
||||
else {
|
||||
scope = myClassesInLibraries ? GlobalSearchScope.allScope(getProject()) : GlobalSearchScope.projectScope(getProject());
|
||||
}
|
||||
return JavaPsiFacade.getInstance(getProject()).findClass(qualifiedName.replace('$', '.'), scope);
|
||||
return JavaExecutionUtil.findMainClass(getProject(), qualifiedName, scope);
|
||||
}
|
||||
|
||||
public static Collection<Module> getModulesForClass(@NotNull final Project project, final String className) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
+3
-3
@@ -19,14 +19,14 @@ import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.util.importProject.LibraryDescriptor;
|
||||
import com.intellij.ide.util.importProject.ModuleDescriptor;
|
||||
import com.intellij.ide.util.importProject.ModuleInsight;
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ProjectBuilder;
|
||||
import com.intellij.ide.util.projectWizard.SourcePathsBuilder;
|
||||
import com.intellij.ide.util.projectWizard.ModuleBuilder;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.module.*;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkType;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
@@ -307,6 +307,6 @@ public class ProjectFromSourcesBuilder extends ProjectBuilder implements SourceP
|
||||
|
||||
@Override
|
||||
public boolean isSuitableSdk(final Sdk sdk) {
|
||||
return sdk.getSdkType() instanceof JavaSdkType;
|
||||
return sdk.getSdkType() == JavaSdk.getInstance();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ import java.util.Map;
|
||||
|
||||
public class JavaContentEntriesEditor extends CommonContentEntriesEditor {
|
||||
public JavaContentEntriesEditor(String moduleName, ModuleConfigurationState state) {
|
||||
super(moduleName, state);
|
||||
super(moduleName, state, true, true);
|
||||
}
|
||||
|
||||
protected ContentEntryEditor createContentEntryEditor(final String contentEntryUrl) {
|
||||
@@ -54,7 +54,7 @@ public class JavaContentEntriesEditor extends CommonContentEntriesEditor {
|
||||
}
|
||||
|
||||
protected ContentEntryTreeEditor createContentEntryTreeEditor(Project project) {
|
||||
return new JavaContentEntryTreeEditor(project);
|
||||
return new ContentEntryTreeEditor(project, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public abstract class JavaContentEntryEditor extends ContentEntryEditor {
|
||||
private final CompilerModuleExtension myCompilerExtension;
|
||||
|
||||
public JavaContentEntryEditor(final String contentEntryUrl) {
|
||||
super(contentEntryUrl);
|
||||
super(contentEntryUrl, true, true);
|
||||
myCompilerExtension = getModel().getModuleExtension(CompilerModuleExtension.class);
|
||||
}
|
||||
|
||||
|
||||
-41
@@ -1,41 +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.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.actions.ToggleExcludedStateAction;
|
||||
import com.intellij.openapi.roots.ui.configuration.actions.ToggleSourcesStateAction;
|
||||
import com.intellij.openapi.actionSystem.CustomShortcutSet;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
public class JavaContentEntryTreeEditor extends ContentEntryTreeEditor {
|
||||
public JavaContentEntryTreeEditor(Project project) {
|
||||
super(project);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createEditingActions() {
|
||||
ToggleSourcesStateAction markSourcesAction = new ToggleSourcesStateAction(myTree, this, false);
|
||||
markSourcesAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.ALT_MASK)), myTree);
|
||||
|
||||
setupExcludedAction();
|
||||
setupTestsAction();
|
||||
|
||||
myEditingActionsGroup.add(markSourcesAction);
|
||||
}
|
||||
}
|
||||
+1
-48
@@ -17,26 +17,21 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.ContentFolder;
|
||||
import com.intellij.openapi.roots.ExcludeFolder;
|
||||
import com.intellij.openapi.roots.SourceFolder;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.roots.IconActionComponent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class JavaContentRootPanel extends ContentRootPanel {
|
||||
private static final Color SOURCES_COLOR = new Color(0x0A50A1);
|
||||
private static final Icon ADD_PREFIX_ICON = IconLoader.getIcon("/modules/setPackagePrefix.png");
|
||||
private static final Icon ADD_PREFIX_ROLLOVER_ICON = IconLoader.getIcon("/modules/setPackagePrefixRollover.png");
|
||||
|
||||
public JavaContentRootPanel(ActionCallback callback) {
|
||||
super(callback);
|
||||
super(callback, true, true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -66,46 +61,4 @@ public abstract class JavaContentRootPanel extends ContentRootPanel {
|
||||
panel.add(Box.createHorizontalStrut(3), BorderLayout.EAST);
|
||||
return panel;
|
||||
}
|
||||
|
||||
protected void addFolderGroupComponents() {
|
||||
final List<ContentFolder> sources = new ArrayList<ContentFolder>();
|
||||
final List<ContentFolder> testSources = new ArrayList<ContentFolder>();
|
||||
final List<ContentFolder> excluded = new ArrayList<ContentFolder>();
|
||||
final SourceFolder[] sourceFolders = getContentEntry().getSourceFolders();
|
||||
for (SourceFolder folder : sourceFolders) {
|
||||
if (folder.isSynthetic()) {
|
||||
continue;
|
||||
}
|
||||
final VirtualFile folderFile = folder.getFile();
|
||||
if (folderFile != null && (isExcluded(folderFile) || isUnderExcludedDirectory(folderFile))) {
|
||||
continue;
|
||||
}
|
||||
if (folder.isTestSource()) {
|
||||
testSources.add(folder);
|
||||
}
|
||||
else {
|
||||
sources.add(folder);
|
||||
}
|
||||
}
|
||||
|
||||
final ExcludeFolder[] excludeFolders = getContentEntry().getExcludeFolders();
|
||||
for (final ExcludeFolder excludeFolder : excludeFolders) {
|
||||
if (!excludeFolder.isSynthetic()) {
|
||||
excluded.add(excludeFolder);
|
||||
}
|
||||
}
|
||||
|
||||
if (sources.size() > 0) {
|
||||
final JComponent sourcesComponent = createFolderGroupComponent(ProjectBundle.message("module.paths.sources.group"), sources.toArray(new ContentFolder[sources.size()]), SOURCES_COLOR);
|
||||
this.add(sourcesComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 10, 0), 0, 0));
|
||||
}
|
||||
if (testSources.size() > 0) {
|
||||
final JComponent testSourcesComponent = createFolderGroupComponent(ProjectBundle.message("module.paths.test.sources.group"), testSources.toArray(new ContentFolder[testSources.size()]), TESTS_COLOR);
|
||||
this.add(testSourcesComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 10, 0), 0, 0));
|
||||
}
|
||||
if (excluded.size() > 0) {
|
||||
final JComponent excludedComponent = createFolderGroupComponent(ProjectBundle.message("module.paths.excluded.group"), excluded.toArray(new ContentFolder[excluded.size()]), EXCLUDED_COLOR);
|
||||
this.add(excludedComponent, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 10, 0), 0, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+2
-2
@@ -519,9 +519,9 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (KEY.getName().equals(dataId)) {
|
||||
if (KEY.is(dataId)) {
|
||||
return ProjectStructureConfigurable.this;
|
||||
} else if (History.KEY.getName().equals(dataId)) {
|
||||
} else if (History.KEY.is(dataId)) {
|
||||
return getHistory();
|
||||
} else {
|
||||
return null;
|
||||
|
||||
+2
-3
@@ -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];
|
||||
}
|
||||
|
||||
+3
-1
@@ -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) {
|
||||
|
||||
+7
-5
@@ -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;
|
||||
@@ -546,7 +548,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (DataKeys.MODULE_CONTEXT_ARRAY.getName().equals(dataId)){
|
||||
if (DataKeys.MODULE_CONTEXT_ARRAY.is(dataId)){
|
||||
final TreePath[] paths = myTree.getSelectionPaths();
|
||||
if (paths != null) {
|
||||
ArrayList<Module> modules = new ArrayList<Module>();
|
||||
@@ -562,10 +564,10 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
return !modules.isEmpty() ? modules.toArray(new Module[modules.size()]) : null;
|
||||
}
|
||||
}
|
||||
if (DataKeys.MODULE_CONTEXT.getName().equals(dataId)){
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -545,19 +545,26 @@ public class CodeStyleImportsPanel extends JPanel {
|
||||
}
|
||||
};
|
||||
if (areStaticImportsEnabled()) {
|
||||
result.fixColumnWidthToHeader(0);
|
||||
result.fixColumnWidthToHeader(2);
|
||||
fixColumnWidthToHeader(result, 0);
|
||||
fixColumnWidthToHeader(result, 2);
|
||||
result.getColumnModel().getColumn(1).setCellRenderer(packageRenderer);
|
||||
result.getColumnModel().getColumn(0).setCellRenderer(new BooleanTableCellRenderer());
|
||||
result.getColumnModel().getColumn(2).setCellRenderer(new BooleanTableCellRenderer());
|
||||
}
|
||||
else {
|
||||
result.fixColumnWidthToHeader(1);
|
||||
fixColumnWidthToHeader(result, 1);
|
||||
result.getColumnModel().getColumn(0).setCellRenderer(packageRenderer);
|
||||
result.getColumnModel().getColumn(1).setCellRenderer(new BooleanTableCellRenderer());
|
||||
}
|
||||
}
|
||||
|
||||
private static void fixColumnWidthToHeader(Table result, int columnIdx) {
|
||||
final TableColumn column = result.getColumnModel().getColumn(columnIdx);
|
||||
final int width = result.getTableHeader().getFontMetrics(result.getTableHeader().getFont()).stringWidth(result.getColumnName(columnIdx)) + 6;
|
||||
column.setMinWidth(width);
|
||||
column.setMaxWidth(width);
|
||||
}
|
||||
|
||||
private void updateButtons(){
|
||||
int selectedImport = myImportLayoutTable.getSelectedRow();
|
||||
myMoveUpButton.setEnabled(selectedImport >= 1);
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
+3
-32
@@ -1079,10 +1079,9 @@ public class GenericsHighlightUtil {
|
||||
if (((PsiModifierListOwner)element).hasModifierProperty(PsiModifier.STATIC)) return null;
|
||||
PsiClass containingClass = ((PsiMember)element).getContainingClass();
|
||||
if (containingClass != null && PsiUtil.isRawSubstitutor(containingClass, resolveResult.getSubstitutor())) {
|
||||
final String message;
|
||||
message = element instanceof PsiClass
|
||||
? JavaErrorMessages.message("generics.type.arguments.on.raw.type")
|
||||
: JavaErrorMessages.message("generics.type.arguments.on.raw.method");
|
||||
final String message = element instanceof PsiClass
|
||||
? JavaErrorMessages.message("generics.type.arguments.on.raw.type")
|
||||
: JavaErrorMessages.message("generics.type.arguments.on.raw.method");
|
||||
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, refParamList, message);
|
||||
}
|
||||
@@ -1192,33 +1191,5 @@ public class GenericsHighlightUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static HighlightInfo checkTopLevelMethodCallIntersectionTypeMaximalUpperBound(PsiMethodCallExpression methodCall,
|
||||
PsiReferenceExpression expression) {
|
||||
PsiElement parent = methodCall.getParent();
|
||||
if (parent instanceof PsiExpression) return null;
|
||||
PsiType type = expression.getType();
|
||||
if (!(type instanceof PsiIntersectionType)) {
|
||||
return null;
|
||||
}
|
||||
PsiType[] conjuncts = ((PsiIntersectionType)type).getConjuncts();
|
||||
PsiType lub = conjuncts[0];
|
||||
for (int i = 1; i < conjuncts.length; i++) {
|
||||
PsiType conjunct = conjuncts[i];
|
||||
PsiType bound = GenericsUtil.getLeastUpperBound(lub, conjunct, methodCall.getManager());
|
||||
if (bound == null || !TypeConversionUtil.isAssignable(lub, bound) || !TypeConversionUtil.isAssignable(conjunct, bound)) {
|
||||
PsiMethod method = methodCall.resolveMethod();
|
||||
if (method == null) return null;
|
||||
String message = JavaErrorMessages.message("failed.to.find.unique.maximal.instance",
|
||||
HighlightUtil.formatMethod(method),
|
||||
HighlightUtil.formatType(lub), HighlightUtil.formatType(conjunct));
|
||||
|
||||
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, expression, message);
|
||||
}
|
||||
lub = bound;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+34
-23
@@ -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;
|
||||
}
|
||||
|
||||
+2
-14
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -548,7 +548,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
myHolder.add(HighlightNamesUtil.highlightMethodName(method, element, false));
|
||||
}
|
||||
}
|
||||
catch (IndexNotReadyException e) {
|
||||
catch (IndexNotReadyException ignored) {
|
||||
}
|
||||
}
|
||||
else if (parent instanceof PsiImportStatement && ((PsiImportStatement)parent).isOnDemand()) {
|
||||
@@ -772,7 +772,6 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
|
||||
if (parent instanceof PsiMethodCallExpression && (methodCall = (PsiMethodCallExpression)parent).getMethodExpression() == expression) {
|
||||
myHolder.addAll(HighlightMethodUtil.checkMethodCall(methodCall, myResolveHelper));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkTopLevelMethodCallIntersectionTypeMaximalUpperBound(methodCall, expression));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user