Merge remote branch 'origin/master'

This commit is contained in:
irengrig
2012-12-13 17:15:57 +04:00
21 changed files with 311 additions and 114 deletions
@@ -35,7 +35,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Ref;
import com.intellij.util.concurrency.Semaphore;
import org.jdom.Element;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -71,9 +70,6 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
@Override
public String getDescription(MakeBeforeRunTask task) {
if (task.myNoErrorCheck) {
return ExecutionBundle.message("before.launch.compile.step.no.error.check");
}
return ExecutionBundle.message("before.launch.compile.step");
}
@@ -94,15 +90,7 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
}
public boolean configureTask(RunConfiguration runConfiguration, MakeBeforeRunTask task) {
if (task == null)
return false;
task.myNoErrorCheck = !task.myNoErrorCheck;
return true;
}
@Override
public boolean skipFirstConfiguration() {
return true;
return false;
}
@Override
@@ -110,10 +98,11 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
return true;
}
public boolean executeTask(DataContext context,
final RunConfiguration configuration,
final ExecutionEnvironment env,
final MakeBeforeRunTask task) {
public boolean executeTask(DataContext context, final RunConfiguration configuration, final ExecutionEnvironment env, MakeBeforeRunTask task) {
return doMake(myProject, configuration, env, false);
}
static boolean doMake(final Project myProject, final RunConfiguration configuration, final ExecutionEnvironment env, final boolean ignoreErrors) {
if (!(configuration instanceof RunProfileWithCompileBeforeLaunchOption)) {
return true;
}
@@ -130,7 +119,7 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
done.down();
final CompileStatusNotification callback = new CompileStatusNotification() {
public void finished(final boolean aborted, final int errors, final int warnings, CompileContext compileContext) {
if ((errors == 0 || task.myNoErrorCheck) && !aborted) {
if ((errors == 0 || ignoreErrors) && !aborted) {
result.set(Boolean.TRUE);
}
done.up();
@@ -182,7 +171,7 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
}
public boolean isConfigurable() {
return true;
return false;
}
@Nullable
@@ -196,25 +185,9 @@ public class CompileStepBeforeRun extends BeforeRunTaskProvider<CompileStepBefor
}
public static class MakeBeforeRunTask extends BeforeRunTask<MakeBeforeRunTask> {
boolean myNoErrorCheck;
private MakeBeforeRunTask() {
super(ID);
setEnabled(true);
}
@Override
public void writeExternal(Element element) {
super.writeExternal(element);
if (myNoErrorCheck) {
element.setAttribute("no.error.check", String.valueOf(myNoErrorCheck));
}
}
@Override
public void readExternal(Element element) {
super.readExternal(element);
myNoErrorCheck = Boolean.parseBoolean(element.getAttributeValue("no.error.check", "false"));
}
}
}
@@ -0,0 +1,105 @@
/*
* Copyright 2000-2012 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.options;
import com.intellij.execution.BeforeRunTask;
import com.intellij.execution.BeforeRunTaskProvider;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.configurations.RunProfileWithCompileBeforeLaunchOption;
import com.intellij.execution.remote.RemoteConfiguration;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* User: Vassiliy.Kudryashov
*/
public class CompileStepBeforeRunNoErrorCheck
extends BeforeRunTaskProvider<CompileStepBeforeRunNoErrorCheck.MakeBeforeRunTaskNoErrorCheck> {
public static final Key<MakeBeforeRunTaskNoErrorCheck> ID = Key.create("MakeNoErrorCheck");
@NotNull private final Project myProject;
public CompileStepBeforeRunNoErrorCheck(@NotNull Project project) {
myProject = project;
}
public Key<MakeBeforeRunTaskNoErrorCheck> getId() {
return ID;
}
@Override
public String getDescription(MakeBeforeRunTaskNoErrorCheck task) {
return ExecutionBundle.message("before.launch.compile.step.no.error.check");
}
@Override
public Icon getIcon() {
return AllIcons.Actions.Compile;
}
@Override
public Icon getTaskIcon(MakeBeforeRunTaskNoErrorCheck task) {
return AllIcons.Actions.Compile;
}
@Override
public MakeBeforeRunTaskNoErrorCheck createTask(RunConfiguration runConfiguration) {
return !(runConfiguration instanceof RemoteConfiguration) && runConfiguration instanceof RunProfileWithCompileBeforeLaunchOption
? new MakeBeforeRunTaskNoErrorCheck()
: null;
}
@Override
public boolean configureTask(RunConfiguration runConfiguration, MakeBeforeRunTaskNoErrorCheck task) {
return false;
}
@Override
public boolean isConfigurable() {
return false;
}
@Override
public String getName() {
return ExecutionBundle.message("before.launch.compile.step.no.error.check");
}
@Override
public boolean canExecuteTask(RunConfiguration configuration, MakeBeforeRunTaskNoErrorCheck task) {
return true;
}
@Override
public boolean executeTask(DataContext context,
RunConfiguration configuration,
ExecutionEnvironment env,
MakeBeforeRunTaskNoErrorCheck task) {
return CompileStepBeforeRun.doMake(myProject, configuration, env, true);
}
public static class MakeBeforeRunTaskNoErrorCheck extends BeforeRunTask<MakeBeforeRunTaskNoErrorCheck> {
private MakeBeforeRunTaskNoErrorCheck() {
super(ID);
setEnabled(true);
}
}
}
@@ -51,7 +51,8 @@ public class BuildOutputConsumerImpl implements BuildOutputConsumer {
for (File outputRoot : myOutputs) {
String outputRootPath = FileUtil.toSystemIndependentName(outputRoot.getPath());
final String relativePath = FileUtil.getRelativePath(outputRootPath, outputFilePath, '/');
if (relativePath != null) {
if (relativePath != null && !relativePath.startsWith("../")) {
// the relative path must be under the root or equal to it
myFileGeneratedEvent.add(outputRootPath, relativePath);
}
}
@@ -57,13 +57,6 @@ public abstract class BeforeRunTaskProvider<T extends BeforeRunTask> {
public abstract boolean isConfigurable();
/**
* @return <code>true</code> if just created task must be configured by user.
*/
public boolean skipFirstConfiguration() {
return false;
}
/**
* @return 'before run' task for the configuration or null, if the task from this provider is not applicable to the specified configuration
*/
@@ -85,4 +85,21 @@ public abstract class RunManagerEx extends RunManager {
public abstract void addRunManagerListener(RunManagerListener listener);
public abstract void removeRunManagerListener(RunManagerListener listener);
public static void disableTasks(Project project, RunConfiguration settings, Key<? extends BeforeRunTask>... keys) {
for (Key<? extends BeforeRunTask> key : keys) {
List<? extends BeforeRunTask> tasks = getInstanceEx(project).getBeforeRunTasks(settings, key);
for (BeforeRunTask task : tasks) {
task.setEnabled(false);
}
}
}
public static int getTasksCount(Project project, RunConfiguration settings, Key<? extends BeforeRunTask>... keys) {
int result = 0;
for (Key<? extends BeforeRunTask> key : keys) {
result += getInstanceEx(project).getBeforeRunTasks(settings, key).size();
}
return result;
}
}
@@ -271,8 +271,7 @@ class BeforeRunStepsPanel extends JPanel {
public void actionPerformed(AnActionEvent e) {
BeforeRunTask task = provider.createTask(myRunConfiguration);
if (task != null) {
if (!provider.skipFirstConfiguration())
provider.configureTask(myRunConfiguration, task);
provider.configureTask(myRunConfiguration, task);
if (!provider.canExecuteTask(myRunConfiguration, task))
return;
} else {
@@ -309,6 +309,11 @@ public abstract class LanguagePerFileConfigurable<T> implements SearchableConfig
}
protected abstract void chosen(final VirtualFile file, final T t);
@Override
public boolean isDumbAware() {
return LanguagePerFileConfigurable.this.isDumbAware();
}
}
}
@@ -316,4 +321,8 @@ public abstract class LanguagePerFileConfigurable<T> implements SearchableConfig
protected Icon getIcon(T currentValue, T selectableValue) {
return null;
}
protected boolean isDumbAware() {
return true;
}
}
@@ -19,6 +19,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
@@ -26,7 +27,7 @@ import com.intellij.pom.Navigatable;
/**
* @author cdr
*/
public class ChangeEncodingUpdateGroup extends DefaultActionGroup {
public class ChangeEncodingUpdateGroup extends DefaultActionGroup implements DumbAware {
private boolean myUpdating;
@Override
@@ -22,7 +22,7 @@ import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.ui.AppUIUtil;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.text.DateFormatUtilRt;
import com.intellij.util.ui.UIUtil;
import javax.swing.*;
@@ -72,7 +72,7 @@ public class MainImpl {
final ApplicationInfo appInfo = ApplicationInfoImpl.getShadowInstance();
final ApplicationNamesInfo namesInfo = ApplicationNamesInfo.getInstance();
LOG.info("IDE: " + namesInfo.getFullProductName() + " (build #" + appInfo.getBuild() + ", " +
DateFormatUtil.formatBuildDate(appInfo.getBuildDate()) + ")");
DateFormatUtilRt.formatBuildDate(appInfo.getBuildDate()) + ")");
LOG.info("JRE: " + System.getProperty("java.runtime.version", "-") + " (" + System.getProperty("java.vendor", "-") + ")");
LOG.info("JVM: " + System.getProperty("java.vm.version", "-") + " (" + System.getProperty("java.vm.vendor", "-") + ")");
@@ -0,0 +1,31 @@
/*
* Copyright 2000-2012 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.util.text;
import org.jetbrains.annotations.NotNull;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
public class DateFormatUtilRt {
private static final SimpleDateFormat BUILD_DATE_FORMAT = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US);
@NotNull
public static String formatBuildDate(@NotNull Calendar cal) {
return BUILD_DATE_FORMAT.format(cal.getTime());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -33,16 +33,6 @@ import java.util.Locale;
public class DateFormatUtil {
private static final Logger LOG = Logger.getInstance("com.intellij.util.text.DateFormatUtil");
// do not expose this constants - they are very likely to be changed in future
private static final SyncDateFormat DATE_FORMAT = getFormat(DateFormat.SHORT, DateType.DATE);
private static final SyncDateFormat TIME_FORMAT = getFormat(DateFormat.SHORT, DateType.TIME);
private static final SyncDateFormat TIME_WITH_SECONDS_FORMAT = getFormat(DateFormat.MEDIUM, DateType.TIME);
private static final SyncDateFormat DATE_TIME_FORMAT = getFormat(DateFormat.SHORT, DateType.DATETIME);
// fixed formats - should be locale-independent
private static final SimpleDateFormat BUILD_DATE_FORMAT = new SimpleDateFormat("dd MMM yyyy HH:ss", Locale.US);
private static final DateFormat ABOUT_DATE_FORMAT = DateFormat.getDateInstance(DateFormat.LONG, Locale.US);
public static final long SECOND = 1000;
public static final long MINUTE = SECOND * 60;
public static final long HOUR = MINUTE * 60;
@@ -50,18 +40,34 @@ public class DateFormatUtil {
public static final long WEEK = DAY * 7;
public static final long MONTH = DAY * 30;
public static final long YEAR = DAY * 365;
private static final long[] DELIMS = new long[]{YEAR, MONTH, WEEK, DAY, HOUR, MINUTE};
public static final long DAY_FACTOR = 24L * 60 * 60 * 1000;
public static long getDifferenceInDays(final Date startDate, final Date endDate) {
return (endDate.getTime() - startDate.getTime() + DAY_FACTOR - 1000) / DAY_FACTOR;
}
// do not expose this constants - they are very likely to be changed in future
private static final SyncDateFormat DATE_FORMAT = getFormat(DateFormat.SHORT, DateType.DATE);
private static final SyncDateFormat TIME_FORMAT = getFormat(DateFormat.SHORT, DateType.TIME);
private static final SyncDateFormat TIME_WITH_SECONDS_FORMAT = getFormat(DateFormat.MEDIUM, DateType.TIME);
private static final SyncDateFormat DATE_TIME_FORMAT = getFormat(DateFormat.SHORT, DateType.DATETIME);
// fixed formats - should be locale-independent
private static final DateFormat ABOUT_DATE_FORMAT = DateFormat.getDateInstance(DateFormat.LONG, Locale.US);
private static final long[] DENOMINATORS = new long[]{YEAR, MONTH, WEEK, DAY, HOUR, MINUTE};
private enum Period {
YEAR, MONTH, WEEK, DAY, HOUR, MINUTE
}
private static final Period[] PERIOD = new Period[]{Period.YEAR, Period.MONTH, Period.WEEK, Period.DAY, Period.HOUR, Period.MINUTE};
private static final Period[] PERIODS = new Period[]{Period.YEAR, Period.MONTH, Period.WEEK, Period.DAY, Period.HOUR, Period.MINUTE};
private enum DateType {
TIME, DATE, DATETIME
}
private static final int MacFormatterNoStyle = 0;
private static final int MacFormatterShortStyle = 1;
private static final int MacFormatterMediumStyle = 2;
private static final int MacFormatterLongStyle = 3;
private static final int MacFormatterFullStyle = 4;
private static final int MacFormatterBehavior_10_4 = 1040;
private static SyncDateFormat getFormat(int format, DateType type) {
DateFormat result = null;
@@ -89,7 +95,10 @@ public class DateFormatUtil {
return new SyncDateFormat(result);
}
private DateFormatUtil() {
private DateFormatUtil() { }
public static long getDifferenceInDays(final Date startDate, final Date endDate) {
return (endDate.getTime() - startDate.getTime() + DAY_FACTOR - 1000) / DAY_FACTOR;
}
@NotNull
@@ -216,14 +225,14 @@ public class DateFormatUtil {
@NotNull
public static String formatDuration(long delta) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < DELIMS.length; i++) {
long delim = DELIMS[i];
int n = (int)(delta / delim);
StringBuilder buf = new StringBuilder();
for (int i = 0; i < DENOMINATORS.length; i++) {
long denominator = DENOMINATORS[i];
int n = (int)(delta / denominator);
if (n != 0) {
buf.append(composeDurationMessage(PERIOD[i], n));
buf.append(composeDurationMessage(PERIODS[i], n));
buf.append(' ');
delta = delta % delim;
delta = delta % denominator;
}
}
@@ -260,10 +269,10 @@ public class DateFormatUtil {
int n = -1;
int i;
for (i = 0; i < DELIMS.length; i++) {
long delim = DELIMS[i];
if (delta >= delim) {
n = (int)(delta / delim);
for (i = 0; i < DENOMINATORS.length; i++) {
long denominator = DENOMINATORS[i];
if (delta >= denominator) {
n = (int)(delta / denominator);
break;
}
}
@@ -273,7 +282,7 @@ public class DateFormatUtil {
return CommonBundle.message("date.format.a.few.moments.ago");
}
else {
return someTimeAgoMessage(PERIOD[i], n);
return someTimeAgoMessage(PERIODS[i], n);
}
}
else if (d2 < d1) {
@@ -281,7 +290,7 @@ public class DateFormatUtil {
return CommonBundle.message("date.format.in.a.few.moments");
}
else {
return composeInSomeTimeMessage(PERIOD[i], n);
return composeInSomeTimeMessage(PERIODS[i], n);
}
}
@@ -366,7 +375,9 @@ public class DateFormatUtil {
Foundation.invoke(dateFormatter, Foundation.createSelector("setTimeStyle:"), timeStyle);
Foundation.invoke(dateFormatter, Foundation.createSelector("setDateStyle:"), dateStyle);
return Foundation.toStringViaUTF8(Foundation.invoke(dateFormatter, Foundation.createSelector("dateFormat")));
String format = Foundation.toStringViaUTF8(Foundation.invoke(dateFormatter, Foundation.createSelector("dateFormat")));
assert format != null;
return format;
}
finally {
Foundation.invoke(autoReleasePool, Foundation.createSelector("release"));
@@ -382,7 +393,6 @@ public class DateFormatUtil {
for (int i = 0; i < macPattern.length(); i++) {
char c = macPattern.charAt(i);
char next = i < macPattern.length() - 1 ? macPattern.charAt(i + 1) : 0;
if (isSpecial) {
String replacement = null;
if (c == '%') replacement = "$";
@@ -464,20 +474,10 @@ public class DateFormatUtil {
}
}
private enum DateType {
TIME, DATE, DATETIME
}
private static final int MacFormatterNoStyle = 0;
private static final int MacFormatterShortStyle = 1;
private static final int MacFormatterMediumStyle = 2;
private static final int MacFormatterLongStyle = 3;
private static final int MacFormatterFullStyle = 4;
private static final int MacFormatterBehavior_10_4 = 1040;
@NotNull
/** @deprecated use {@linkplain DateFormatUtilRt#formatBuildDate(Calendar)} (to remove in IDEA 13) */
@SuppressWarnings("UnusedDeclaration")
public static String formatBuildDate(@NotNull Calendar cal) {
return BUILD_DATE_FORMAT.format(cal.getTime());
return DateFormatUtilRt.formatBuildDate(cal);
}
@NotNull
@@ -18,8 +18,10 @@ package com.siyeh.ig.inheritance;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ui.MultipleCheckboxOptionsPanel;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.psi.*;
import com.intellij.psi.javadoc.PsiDocComment;
import com.intellij.psi.util.TypeConversionUtil;
import com.intellij.util.IncorrectOperationException;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
@@ -204,8 +206,12 @@ public class AbstractMethodOverridesAbstractMethodInspection extends BaseInspect
if (type1 == null) {
return false;
}
final PsiClass superClass = method2.getContainingClass();
final PsiClass aClass = method1.getContainingClass();
if (aClass == null || superClass == null) return false;
final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, aClass, PsiSubstitutor.EMPTY);
final PsiType type2 = method2.getReturnType();
return type2 != null && type1.equals(type2);
return Comparing.equal(TypeConversionUtil.erasure(type1), TypeConversionUtil.erasure(substitutor.substitute(type2)));
}
private boolean isAbstract(PsiMethod method) {
@@ -29,3 +29,34 @@ abstract class Child extends AbstractMethodOverridesAbstractMethod
public abstract void three();
}
class MethodTypeParams {
interface Top
{
<T> List<T> getList();
}
interface Middle extends Top
{
<T> List<T> getList();
}
abstract class Bottom implements Middle
{
@Override
public abstract <T> ArrayList<T> getList();
}
}
class SuperclassSubst {
interface Top<T>
{
T getList();
}
abstract class Bottom implements Top<String>
{
@Override
public abstract String getList();
}
}
@@ -7,5 +7,17 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Abstract method overrides abstract method</problem_class>
<description>Abstract method &lt;code&gt;three()&lt;/code&gt; overrides abstract method #loc</description>
</problem>
<problem>
<file>AbstractMethodOverridesAbstractMethod.java</file>
<line>41</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Abstract method overrides abstract method</problem_class>
<description>Abstract method &lt;code&gt;getList()&lt;/code&gt; overrides abstract method #loc</description>
</problem>
<problem>
<file>AbstractMethodOverridesAbstractMethod.java</file>
<line>60</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Abstract method overrides abstract method</problem_class>
<description>Abstract method &lt;code&gt;getList()&lt;/code&gt; overrides abstract method #loc</description>
</problem>
</problems>
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.gradle.config;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck;
import com.intellij.execution.*;
import com.intellij.execution.configurations.JavaParameters;
import com.intellij.execution.configurations.RunProfile;
@@ -60,7 +61,6 @@ import javax.swing.*;
import java.io.File;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -97,12 +97,7 @@ public class GradleScriptType extends GroovyScriptType {
configuration.setScriptParameters(target);
configuration.setName(configuration.getName() + "." + target);
}
final List<CompileStepBeforeRun.MakeBeforeRunTask> runTasks =
RunManagerEx.getInstanceEx(file.getProject()).getBeforeRunTasks(configuration, CompileStepBeforeRun.ID);
for (CompileStepBeforeRun.MakeBeforeRunTask task : runTasks) {
task.setEnabled(false);
}
RunManagerEx.disableTasks(file.getProject(), configuration, CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID);
}
@Nullable
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.groovy.gant;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck;
import com.intellij.execution.Location;
import com.intellij.execution.RunManagerEx;
import com.intellij.openapi.module.Module;
@@ -97,11 +98,7 @@ public class GantScriptType extends GroovyScriptType {
configuration.setScriptParameters(target);
configuration.setName(configuration.getName() + "." + target);
}
final List<CompileStepBeforeRun.MakeBeforeRunTask> runTasks =
RunManagerEx.getInstanceEx(file.getProject()).getBeforeRunTasks(configuration, CompileStepBeforeRun.ID);
for (CompileStepBeforeRun.MakeBeforeRunTask task : runTasks) {
task.setEnabled(false);
}
RunManagerEx.disableTasks(file.getProject(), configuration, CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID);
}
public static List<VirtualFile> additionalScopeFiles(@NotNull GroovyFile file) {
@@ -17,6 +17,7 @@
package org.jetbrains.plugins.groovy.griffon;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck;
import com.intellij.execution.BeforeRunTask;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
@@ -43,7 +44,7 @@ public class GriffonRunConfigurationType implements ConfigurationType {
@Override
public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) {
if (providerID == CompileStepBeforeRun.ID) {
if (providerID == CompileStepBeforeRun.ID || providerID == CompileStepBeforeRunNoErrorCheck.ID) {
task.setEnabled(false);
}
}
@@ -17,6 +17,7 @@
package org.jetbrains.plugins.groovy.mvc;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck;
import com.intellij.execution.CantRunException;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.RunManagerEx;
@@ -358,10 +359,7 @@ public abstract class MvcFramework {
runManager.addConfiguration(runSettings, false);
runManager.setActiveConfiguration(runSettings);
final List<CompileStepBeforeRun.MakeBeforeRunTask> runTasks = runManager.getBeforeRunTasks(configuration, CompileStepBeforeRun.ID);
for (CompileStepBeforeRun.MakeBeforeRunTask task : runTasks) {
task.setEnabled(false);
}
RunManagerEx.disableTasks(module.getProject(), configuration, CompileStepBeforeRun.ID, CompileStepBeforeRunNoErrorCheck.ID);
}
public abstract String getFrameworkName();
@@ -16,6 +16,7 @@
package org.jetbrains.idea.maven.execution;
import com.intellij.compiler.options.CompileStepBeforeRun;
import com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck;
import com.intellij.execution.*;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
@@ -90,7 +91,7 @@ public class MavenRunConfigurationType implements ConfigurationType {
@Override
public void configureBeforeRunTaskDefaults(Key<? extends BeforeRunTask> providerID, BeforeRunTask task) {
if (providerID == CompileStepBeforeRun.ID) {
if (providerID == CompileStepBeforeRun.ID || providerID == CompileStepBeforeRunNoErrorCheck.ID) {
task.setEnabled(false);
}
}
+2 -1
View File
@@ -344,7 +344,8 @@
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRun" id="compileBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.packaging.impl.run.BuildArtifactsBeforeRunTaskProvider" order="after compileBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.compiler.options.CompileStepBeforeRunNoErrorCheck" id="compileBeforeRunNoErrorCheck" order="after compileBeforeRun"/>
<stepsBeforeRunProvider implementation="com.intellij.packaging.impl.run.BuildArtifactsBeforeRunTaskProvider" order="after compileBeforeRunNoErrorCheck"/>
<stepsBeforeRunProvider implementation="com.intellij.execution.impl.RunConfigurationBeforeRunProvider"/>
<programRunner id="defaultRunRunner" implementation="com.intellij.execution.impl.DefaultJavaProgramRunner"/>
@@ -5,6 +5,7 @@ import com.intellij.ide.highlighter.HtmlFileType;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.structureView.impl.xml.XmlTagTreeElement;
import com.intellij.ide.structureView.xml.XmlStructureViewElementProvider;
import com.intellij.navigation.LocationPresentation;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.xml.XmlTag;
import org.jetbrains.annotations.NotNull;
@@ -24,7 +25,7 @@ public class HtmlStructureViewElementProvider implements XmlStructureViewElement
return new HtmlTagTreeElement(tag);
}
static class HtmlTagTreeElement extends XmlTagTreeElement {
static class HtmlTagTreeElement extends XmlTagTreeElement implements LocationPresentation {
public HtmlTagTreeElement(final XmlTag tag) {
super(tag);
}
@@ -55,10 +56,27 @@ public class HtmlStructureViewElementProvider implements XmlStructureViewElement
final XmlTag tag = getElement();
if (tag == null) return null;
final String text = tag.getValue().getTrimmedText();
final String text = normalizeSpaces(tag.getValue().getTrimmedText());
return text.isEmpty() ? null : shortenTextIfLong(text);
}
private static String normalizeSpaces(final String text) {
final StringBuilder buf = new StringBuilder();
for (char ch : text.toCharArray()) {
if (ch <= ' ' || Character.isSpaceChar(ch)) {
if (buf.length() == 0 || buf.charAt(buf.length() - 1) != ' ') {
buf.append(' ');
}
}
else {
buf.append(ch);
}
}
return buf.toString();
}
private static String shortenTextIfLong(final String text) {
if (text.length() < MAX_TEXT_LENGTH) return text;
@@ -72,5 +90,13 @@ public class HtmlStructureViewElementProvider implements XmlStructureViewElement
final int endIndex = Character.isLetter(index) ? MAX_TEXT_LENGTH : index;
return text.substring(0, endIndex) + "...";
}
public String getLocationPrefix() {
return " ";
}
public String getLocationSuffix() {
return "";
}
}
}