Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ilya.Kazakevich
2014-02-06 18:32:55 +04:00
8 changed files with 132 additions and 9 deletions
@@ -0,0 +1,61 @@
/*
* Copyright 2000-2014 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;
import com.intellij.openapi.compiler.CompileTask;
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.AtomicNotNullLazyValue;
import com.intellij.util.xmlb.annotations.Attribute;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public class CompileTaskBean extends AbstractExtensionPointBean {
public static final ExtensionPointName<CompileTaskBean> EP_NAME = ExtensionPointName.create("com.intellij.compiler.task");
public enum CompileTaskExecutionPhase { BEFORE, AFTER }
private final Project myProject;
public CompileTaskBean(Project project) {
myProject = project;
}
@Attribute("execute")
public CompileTaskExecutionPhase myExecutionPhase = CompileTaskExecutionPhase.BEFORE;
@Attribute("implementation")
public String myImplementation;
private final AtomicNotNullLazyValue<CompileTask> myInstanceHolder = new AtomicNotNullLazyValue<CompileTask>() {
@NotNull
@Override
protected CompileTask compute() {
try {
return instantiate(myImplementation, myProject.getPicoContainer());
}
catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
};
public CompileTask getTaskInstance() {
return myInstanceHolder.getValue();
}
}
@@ -240,12 +240,22 @@ public class CompilerManagerImpl extends CompilerManager {
@NotNull
public CompileTask[] getBeforeTasks() {
return myBeforeTasks.toArray(new CompileTask[myBeforeTasks.size()]);
return getCompileTasks(myBeforeTasks, CompileTaskBean.CompileTaskExecutionPhase.BEFORE);
}
private CompileTask[] getCompileTasks(List<CompileTask> taskList, CompileTaskBean.CompileTaskExecutionPhase phase) {
List<CompileTask> beforeTasks = new ArrayList<CompileTask>(taskList);
for (CompileTaskBean extension : CompileTaskBean.EP_NAME.getExtensions(myProject)) {
if (extension.myExecutionPhase == phase) {
beforeTasks.add(extension.getTaskInstance());
}
}
return beforeTasks.toArray(new CompileTask[beforeTasks.size()]);
}
@NotNull
public CompileTask[] getAfterTasks() {
return myAfterTasks.toArray(new CompileTask[myAfterTasks.size()]);
return getCompileTasks(myAfterTasks, CompileTaskBean.CompileTaskExecutionPhase.AFTER);
}
public void compile(@NotNull VirtualFile[] files, CompileStatusNotification callback) {
@@ -15,6 +15,8 @@ import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
public class JavaBreakpointAdapter extends JavaBreakpointAdapterBase {
private static final Key<LineBreakpoint> OLD_JAVA_BREAKPOINT_KEY = Key.create("oldJavaBreakpoint");
@@ -26,6 +28,35 @@ public class JavaBreakpointAdapter extends JavaBreakpointAdapterBase {
protected void configureCreatedBreakpoint(LineBreakpoint oldBreakpoint, XLineBreakpoint<XBreakpointProperties> breakpoint) {
oldBreakpoint.SUSPEND_POLICY = transformSuspendPolicy(breakpoint);
applyCondition(oldBreakpoint, breakpoint);
applyFilters(oldBreakpoint, breakpoint);
}
private boolean applyFilters(LineBreakpoint oldBreakpoint, XLineBreakpoint<XBreakpointProperties> breakpoint) {
boolean changed = false;
JavaBreakpointProperties properties = (JavaBreakpointProperties)breakpoint.getProperties();
changed |= oldBreakpoint.COUNT_FILTER_ENABLED != properties.COUNT_FILTER_ENABLED;
oldBreakpoint.COUNT_FILTER_ENABLED = properties.COUNT_FILTER_ENABLED;
changed |= oldBreakpoint.COUNT_FILTER != properties.COUNT_FILTER;
oldBreakpoint.COUNT_FILTER = properties.COUNT_FILTER;
changed |= oldBreakpoint.CLASS_FILTERS_ENABLED != properties.CLASS_FILTERS_ENABLED;
oldBreakpoint.CLASS_FILTERS_ENABLED = properties.CLASS_FILTERS_ENABLED;
changed |= !Arrays.equals(oldBreakpoint.getClassFilters(), properties.getClassFilters());
oldBreakpoint.setClassFilters(properties.getClassFilters());
changed |= !Arrays.equals(oldBreakpoint.getClassExclusionFilters(), properties.getClassExclusionFilters());
oldBreakpoint.setClassExclusionFilters(properties.getClassExclusionFilters());
changed |= oldBreakpoint.INSTANCE_FILTERS_ENABLED != properties.INSTANCE_FILTERS_ENABLED;
oldBreakpoint.INSTANCE_FILTERS_ENABLED = properties.INSTANCE_FILTERS_ENABLED;
changed |= !Arrays.equals(oldBreakpoint.getInstanceFilters(), properties.getInstanceFilters());
oldBreakpoint.setInstanceFilters(properties.getInstanceFilters());
return changed;
}
private static void applyCondition(LineBreakpoint oldBreakpoint, XLineBreakpoint<XBreakpointProperties> breakpoint) {
@@ -60,6 +91,10 @@ public class JavaBreakpointAdapter extends JavaBreakpointAdapterBase {
changed = true;
}
if (applyFilters(jBreakpoint, breakpoint)) {
changed = true;
}
if (jBreakpoint.getSourcePosition().getLine() != breakpoint.getLine()) {
jBreakpoint.reload();
changed = true;
@@ -101,6 +136,7 @@ public class JavaBreakpointAdapter extends JavaBreakpointAdapterBase {
}
};
lineBreakpoint.setVisible(false);
lineBreakpoint.init();
return lineBreakpoint;
}
@@ -59,9 +59,9 @@ public class JavaBreakpointPropertiesPanel extends XBreakpointCustomPropertiesPa
private final FieldPanel myInstanceFiltersField;
private final FieldPanel myClassFiltersField;
private ClassFilter[] myClassFilters;
private ClassFilter[] myClassExclusionFilters;
private InstanceFilter[] myInstanceFilters;
private ClassFilter[] myClassFilters = ClassFilter.EMPTY_ARRAY;
private ClassFilter[] myClassExclusionFilters = ClassFilter.EMPTY_ARRAY;
private InstanceFilter[] myInstanceFilters = InstanceFilter.EMPTY_ARRAY;
protected final Project myProject;
private PsiClass myBreakpointPsiClass;
@@ -207,8 +207,8 @@ public class JavaBreakpointPropertiesPanel extends XBreakpointCustomPropertiesPa
XSourcePosition position = breakpoint.getSourcePosition();
// TODO: need to calculate psi class
//myBreakpointPsiClass = breakpoint.getPsiClass();
updateCheckboxes();
}
updateCheckboxes();
}
private void updateInstanceFilterEditor(boolean updateText) {
@@ -60,6 +60,12 @@ public class JavaBreakpointType extends XLineBreakpointTypeBase {
return new JavaBreakpointProperties();
}
@Nullable
@Override
public XBreakpointProperties createBreakpointProperties(@NotNull VirtualFile file, int line) {
return new JavaBreakpointProperties();
}
@Nullable
@Override
public XBreakpointCustomPropertiesPanel<XLineBreakpoint<XBreakpointProperties>> createCustomRightPropertiesPanel(@NotNull Project project) {
@@ -30,8 +30,19 @@ public abstract class DetectionExcludesConfiguration {
return ServiceManager.getService(project, DetectionExcludesConfiguration.class);
}
/**
* Suppress detection of framework {@code type} everywhere in the project
*/
public abstract void addExcludedFramework(@NotNull FrameworkType type);
public abstract void addExcludedFile(@NotNull VirtualFile file, @Nullable FrameworkType type);
/**
* Suppress detection of framework {@code type} in the specified file or directory
*/
public abstract void addExcludedFile(@NotNull VirtualFile fileOrDirectory, @Nullable FrameworkType type);
/**
* Suppress detection of framework {@code type} in the file or directory specified by {@code url}
*/
public abstract void addExcludedUrl(@NotNull String url, @Nullable FrameworkType type);
public abstract boolean isExcludedFromDetection(@NotNull VirtualFile file, @NotNull FrameworkType frameworkType);
@@ -1468,8 +1468,6 @@ public class AbstractPopup implements JBPopup {
public static Window setSize(JComponent content, final Dimension size) {
final Window popupWindow = SwingUtilities.windowForComponent(content);
final Point location = popupWindow.getLocation();
popupWindow.setLocation(location.x, location.y);
Insets insets = content.getInsets();
if (insets != null) {
size.width += insets.left + insets.right;
@@ -83,6 +83,7 @@
<extensionPoint name="compiler" area="IDEA_PROJECT" interface="com.intellij.openapi.compiler.Compiler"/>
<extensionPoint name="compilerFactory" area="IDEA_PROJECT" interface="com.intellij.openapi.compiler.CompilerFactory"/>
<extensionPoint name="compiler.task" area="IDEA_PROJECT" beanClass="com.intellij.compiler.CompileTaskBean"/>
<extensionPoint name="compilerSettingsFactory" area="IDEA_PROJECT" interface="com.intellij.compiler.CompilerSettingsFactory"/>
<extensionPoint name="compileServer.plugin" beanClass="com.intellij.compiler.server.CompileServerPlugin"/>
<extensionPoint name="buildProcess.parametersProvider" area="IDEA_PROJECT" interface="com.intellij.compiler.server.BuildProcessParametersProvider"/>