mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
+3
@@ -46,6 +46,9 @@ public abstract class FrameworkSupportInModuleConfigurable implements Disposable
|
||||
return FrameworkLibraryVersionFilter.ALL;
|
||||
}
|
||||
|
||||
public void onFrameworkSelectionChanged(boolean selected) {
|
||||
}
|
||||
|
||||
public boolean isOnlyLibraryAdded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
+5
-5
@@ -81,12 +81,11 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
if (!(node instanceof FrameworkSupportNode)) return;
|
||||
|
||||
final FrameworkSupportNode frameworkSupportNode = (FrameworkSupportNode)node;
|
||||
updateOptionsPanel();
|
||||
final FrameworkSupportInModuleConfigurable configurable = frameworkSupportNode.getConfigurable();
|
||||
if (configurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) {
|
||||
((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper)configurable).getConfigurable().onFrameworkSelectionChanged(
|
||||
node.isChecked());
|
||||
if (frameworkSupportNode == getSelectedNode()) {
|
||||
updateOptionsPanel();
|
||||
}
|
||||
final FrameworkSupportInModuleConfigurable configurable = frameworkSupportNode.getConfigurable();
|
||||
configurable.onFrameworkSelectionChanged(node.isChecked());
|
||||
myModel.onFrameworkSelectionChanged(frameworkSupportNode);
|
||||
onFrameworkStateChanged();
|
||||
}
|
||||
@@ -144,6 +143,7 @@ public class AddSupportForFrameworksPanel implements Disposable {
|
||||
initializeOptionsPanel(node);
|
||||
showCard(node.getProvider().getFrameworkType().getId());
|
||||
UIUtil.setEnabled(myOptionsPanel, node.isChecked(), true);
|
||||
node.getConfigurable().onFrameworkSelectionChanged(node.isChecked());
|
||||
}
|
||||
else {
|
||||
showCard(EMPTY_CARD);
|
||||
|
||||
+5
@@ -151,6 +151,11 @@ public class OldFrameworkSupportProviderWrapper extends FrameworkSupportInModule
|
||||
return myConfigurable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFrameworkSelectionChanged(boolean selected) {
|
||||
myConfigurable.onFrameworkSelectionChanged(selected);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return myConfigurable.isVisible();
|
||||
|
||||
+3
-2
@@ -89,12 +89,13 @@ public abstract class FacetBasedPackagingSourceItemsProvider<F extends Facet, E
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof FacetBasedSourceItem && myFacet.equals(((FacetBasedSourceItem)obj).myFacet);
|
||||
return obj instanceof FacetBasedSourceItem && myFacet.equals(((FacetBasedSourceItem)obj).myFacet)
|
||||
&& myProvider.equals(((FacetBasedSourceItem)obj).myProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myFacet.hashCode();
|
||||
return myFacet.hashCode() + 31*myProvider.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+6
-2
@@ -23,6 +23,7 @@ package com.intellij.openapi.roots.ui.configuration.libraryEditor;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkType;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ui.SdkPathEditor;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
@@ -36,11 +37,14 @@ import java.awt.*;
|
||||
public class SourcesOrderRootTypeUIFactory implements OrderRootTypeUIFactory {
|
||||
|
||||
@Override
|
||||
public SdkPathEditor createPathEditor(Sdk sdk) {
|
||||
public SdkPathEditor createPathEditor(final Sdk sdk) {
|
||||
return new SdkPathEditor(ProjectBundle.message("sdk.configure.sourcepath.tab"), OrderRootType.SOURCES, new FileChooserDescriptor(true, true, true, false, true, true)) {
|
||||
@Override
|
||||
protected VirtualFile[] adjustAddedFileSet(final Component component, final VirtualFile[] files) {
|
||||
return PathUIUtils.scanAndSelectDetectedJavaSourceRoots(component, files);
|
||||
if (sdk.getSdkType() instanceof JavaSdkType) {
|
||||
return PathUIUtils.scanAndSelectDetectedJavaSourceRoots(component, files);
|
||||
}
|
||||
return super.adjustAddedFileSet(component, files);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -372,4 +372,13 @@ public class PackageUtil {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static PsiDirectory findOrCreateSubdirectory(@NotNull PsiDirectory directory, @NotNull String directoryName) {
|
||||
PsiDirectory subDirectory = directory.findSubdirectory(directoryName);
|
||||
if (subDirectory == null) {
|
||||
subDirectory = directory.createSubdirectory(directoryName);
|
||||
}
|
||||
return subDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,6 +351,10 @@ public class JavaRearranger implements Rearranger<JavaElementArrangementEntry>,
|
||||
n.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
}
|
||||
});
|
||||
Object key = typeRef.get() == null ? NO_TYPE : typeRef.get();
|
||||
Set<ArrangementModifier> modifiers = MODIFIERS_BY_TYPE.get(key);
|
||||
|
||||
@@ -42,6 +42,8 @@ import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class JavaDirectoryServiceImpl extends CoreJavaDirectoryService {
|
||||
@@ -72,7 +74,15 @@ public class JavaDirectoryServiceImpl extends CoreJavaDirectoryService {
|
||||
@NotNull String name,
|
||||
@NotNull String templateName,
|
||||
boolean askForUndefinedVariables) throws IncorrectOperationException {
|
||||
return createClassFromTemplate(dir, name, templateName, askForUndefinedVariables);
|
||||
return createClass(dir, name, templateName, askForUndefinedVariables, Collections.<String, String>emptyMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClass createClass(@NotNull PsiDirectory dir,
|
||||
@NotNull String name,
|
||||
@NotNull String templateName,
|
||||
boolean askForUndefinedVariables, @NotNull final Map<String, String> additionalProperties) throws IncorrectOperationException {
|
||||
return createClassFromTemplate(dir, name, templateName, askForUndefinedVariables, additionalProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -109,13 +119,13 @@ public class JavaDirectoryServiceImpl extends CoreJavaDirectoryService {
|
||||
}
|
||||
|
||||
private static PsiClass createClassFromTemplate(@NotNull PsiDirectory dir, String name, String templateName) throws IncorrectOperationException {
|
||||
return createClassFromTemplate(dir, name, templateName, false);
|
||||
return createClassFromTemplate(dir, name, templateName, false, Collections.<String, String>emptyMap());
|
||||
}
|
||||
|
||||
private static PsiClass createClassFromTemplate(@NotNull PsiDirectory dir,
|
||||
String name,
|
||||
String templateName,
|
||||
boolean askToDefineVariables) throws IncorrectOperationException {
|
||||
boolean askToDefineVariables, @NotNull Map<String, String> additionalProperties) throws IncorrectOperationException {
|
||||
//checkCreateClassOrInterface(dir, name);
|
||||
|
||||
FileTemplate template = FileTemplateManager.getInstance().getInternalTemplate(templateName);
|
||||
@@ -123,6 +133,9 @@ public class JavaDirectoryServiceImpl extends CoreJavaDirectoryService {
|
||||
Properties defaultProperties = FileTemplateManager.getInstance().getDefaultProperties(dir.getProject());
|
||||
Properties properties = new Properties(defaultProperties);
|
||||
properties.setProperty(FileTemplate.ATTRIBUTE_NAME, name);
|
||||
for (Map.Entry<String, String> entry : additionalProperties.entrySet()) {
|
||||
properties.setProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
String ext = StdFileTypes.JAVA.getDefaultExtension();
|
||||
String fileName = name + "." + ext;
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class JavaDirectoryService {
|
||||
public static JavaDirectoryService getInstance() {
|
||||
return ServiceManager.getService(JavaDirectoryService.class);
|
||||
@@ -75,6 +77,15 @@ public abstract class JavaDirectoryService {
|
||||
*/
|
||||
public abstract PsiClass createClass(@NotNull PsiDirectory dir, @NotNull String name, @NotNull String templateName, boolean askForUndefinedVariables) throws IncorrectOperationException;
|
||||
|
||||
/**
|
||||
* @param additionalProperties additional properties to be substituted in the template
|
||||
*/
|
||||
public abstract PsiClass createClass(@NotNull PsiDirectory dir,
|
||||
@NotNull String name,
|
||||
@NotNull String templateName,
|
||||
boolean askForUndefinedVariables,
|
||||
@NotNull final Map<String, String> additionalProperties) throws IncorrectOperationException;
|
||||
|
||||
/**
|
||||
* Checks if it's possible to create a class with the specified name in the directory,
|
||||
* and throws an exception if the creation is not possible. Does not actually modify
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
@@ -85,6 +86,14 @@ public class CoreJavaDirectoryService extends JavaDirectoryService {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiClass createClass(@NotNull PsiDirectory dir,
|
||||
@NotNull String name,
|
||||
@NotNull String templateName,
|
||||
boolean askForUndefinedVariables, @NotNull final Map<String, String> additionalProperties) throws IncorrectOperationException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkCreateClass(@NotNull PsiDirectory dir, @NotNull String name) throws IncorrectOperationException {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
+1
-4
@@ -99,10 +99,7 @@ public abstract class FrameworkSupportProviderTestCase extends IdeaTestCase {
|
||||
protected FrameworkSupportInModuleConfigurable selectFramework(@NotNull FrameworkSupportInModuleProvider provider) {
|
||||
final FrameworkSupportInModuleConfigurable configurable = getOrCreateConfigurable(provider);
|
||||
myNodes.get(provider.getFrameworkType()).setChecked(true);
|
||||
if (configurable instanceof OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper) {
|
||||
((OldFrameworkSupportProviderWrapper.FrameworkSupportConfigurableWrapper)configurable).getConfigurable().onFrameworkSelectionChanged(
|
||||
true);
|
||||
}
|
||||
configurable.onFrameworkSelectionChanged(true);
|
||||
return configurable;
|
||||
}
|
||||
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* 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.psi.codeStyle.arrangement
|
||||
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier
|
||||
import org.junit.Before
|
||||
|
||||
import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.PROTECTED
|
||||
import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.PUBLIC
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
* @since 11/14/12 1:29 PM
|
||||
*/
|
||||
class JavaRearrangerByNameTest extends AbstractJavaRearrangerTest {
|
||||
|
||||
@Before
|
||||
void setUp() {
|
||||
super.setUp()
|
||||
commonSettings.BLANK_LINES_AROUND_METHOD = 0
|
||||
commonSettings.BLANK_LINES_AROUND_CLASS = 0
|
||||
}
|
||||
|
||||
void "test only name condition"() {
|
||||
doTest(
|
||||
initial: '''\
|
||||
class Test {
|
||||
public void setI() {}
|
||||
public void getI() {}
|
||||
public void test() {}
|
||||
}''',
|
||||
expected: '''\
|
||||
class Test {
|
||||
public void getI() {}
|
||||
public void setI() {}
|
||||
public void test() {}
|
||||
}''',
|
||||
rules: [rule("get.*")]
|
||||
)
|
||||
}
|
||||
|
||||
void "test name condition and others"() {
|
||||
doTest(
|
||||
initial: '''\
|
||||
class Test {
|
||||
private void getInner() {}
|
||||
public void getOuter() {}
|
||||
protected void test() {}
|
||||
}''',
|
||||
expected: '''\
|
||||
class Test {
|
||||
public void getOuter() {}
|
||||
protected void test() {}
|
||||
private void getInner() {}
|
||||
}''',
|
||||
rules: [rule("get.*", PUBLIC), rule(PROTECTED)]
|
||||
)
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 324 B |
+16
-5
@@ -18,6 +18,7 @@ package com.intellij.psi.codeStyle.arrangement;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -32,13 +33,19 @@ import java.util.Set;
|
||||
public class ArrangementConditionInfo {
|
||||
|
||||
@NotNull private final Set<ArrangementAtomMatchCondition> myAtomConditions = ContainerUtilRt.newHashSet();
|
||||
@NotNull private final Set<Object> myConditions = ContainerUtilRt.newHashSet();
|
||||
@NotNull private final Set<Object> myConditions = ContainerUtilRt.newHashSet();
|
||||
|
||||
@Nullable private ArrangementNameMatchCondition myNameCondition;
|
||||
|
||||
public void setNameCondition(@Nullable ArrangementNameMatchCondition condition) {
|
||||
myNameCondition = condition;
|
||||
}
|
||||
|
||||
public void addAtomCondition(@NotNull ArrangementAtomMatchCondition condition) {
|
||||
myAtomConditions.add(condition);
|
||||
myConditions.add(condition.getValue());
|
||||
}
|
||||
|
||||
|
||||
public boolean hasCondition(@NotNull Object condition) {
|
||||
return myConditions.contains(condition);
|
||||
}
|
||||
@@ -59,13 +66,17 @@ public class ArrangementConditionInfo {
|
||||
@Nullable
|
||||
public ArrangementMatchCondition buildCondition() {
|
||||
if (myAtomConditions.isEmpty()) {
|
||||
return null;
|
||||
return myNameCondition == null ? null : myNameCondition;
|
||||
}
|
||||
if (myAtomConditions.size() == 1) {
|
||||
else if (myAtomConditions.size() == 1 && myNameCondition == null) {
|
||||
return myAtomConditions.iterator().next();
|
||||
}
|
||||
else {
|
||||
return new ArrangementCompositeMatchCondition(myAtomConditions);
|
||||
ArrangementCompositeMatchCondition result = new ArrangementCompositeMatchCondition(myAtomConditions);
|
||||
if (myNameCondition != null) {
|
||||
result.addOperand(myNameCondition);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,11 @@ public class ArrangementUtil {
|
||||
operand.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
result.addOperand(condition);
|
||||
}
|
||||
};
|
||||
for (ArrangementMatchCondition node : nodes) {
|
||||
node.invite(visitor);
|
||||
@@ -175,6 +180,11 @@ public class ArrangementUtil {
|
||||
operand.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
result.setNameCondition(condition);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
+24
-14
@@ -16,6 +16,7 @@
|
||||
package com.intellij.psi.codeStyle.arrangement.match;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.*;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
@@ -74,7 +75,8 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
private static final Logger LOG = Logger.getInstance("#" + DefaultArrangementEntryMatcherSerializer.class.getName());
|
||||
|
||||
@NotNull private static final String COMPOSITE_CONDITION_NAME = "AND";
|
||||
|
||||
@NotNull private static final String PATTERN_CONDITION_NAME = "NAME";
|
||||
|
||||
private static final Set<String> ATOM_SETTINGS_TYPES = new HashSet<String>();
|
||||
|
||||
static {
|
||||
@@ -113,7 +115,10 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
@Nullable
|
||||
private static ArrangementMatchCondition deserializeCondition(@NotNull Element matcherElement) {
|
||||
String name = matcherElement.getName();
|
||||
if (!COMPOSITE_CONDITION_NAME.equals(name)) {
|
||||
if (PATTERN_CONDITION_NAME.equals(name)) {
|
||||
return new ArrangementNameMatchCondition(StringUtil.unescapeStringCharacters(matcherElement.getText()));
|
||||
}
|
||||
else if (!COMPOSITE_CONDITION_NAME.equals(name)) {
|
||||
if (ATOM_SETTINGS_TYPES.contains(name)) {
|
||||
return deserializeAtomCondition(matcherElement);
|
||||
}
|
||||
@@ -163,23 +168,13 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
|
||||
Element element = new Element(condition.getType().toString()).setText(condition.getValue().toString());
|
||||
if (result == null) {
|
||||
result = element;
|
||||
}
|
||||
if (parent != null) {
|
||||
parent.addContent(element);
|
||||
}
|
||||
register(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
|
||||
Element composite = new Element(COMPOSITE_CONDITION_NAME);
|
||||
if (result == null) {
|
||||
result = composite;
|
||||
}
|
||||
if (parent != null) {
|
||||
parent.addContent(composite);
|
||||
}
|
||||
register(composite);
|
||||
parent = composite;
|
||||
List<ArrangementMatchCondition> operands = new ArrayList<ArrangementMatchCondition>(condition.getOperands());
|
||||
ContainerUtil.sort(operands, CONDITION_COMPARATOR);
|
||||
@@ -187,5 +182,20 @@ public class DefaultArrangementEntryMatcherSerializer {
|
||||
c.invite(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
Element element = new Element(PATTERN_CONDITION_NAME).setText(StringUtil.escapeStringCharacters(condition.getPattern()));
|
||||
register(element);
|
||||
}
|
||||
|
||||
private void register(@NotNull Element element) {
|
||||
if (result == null) {
|
||||
result = element;
|
||||
}
|
||||
if (parent != null) {
|
||||
parent.addContent(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+38
-12
@@ -16,13 +16,10 @@
|
||||
package com.intellij.psi.codeStyle.arrangement.match;
|
||||
|
||||
import com.intellij.psi.codeStyle.arrangement.ArrangementEntry;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.*;
|
||||
import com.intellij.util.containers.ContainerUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -88,11 +85,12 @@ public class StdArrangementEntryMatcher implements ArrangementEntryMatcher {
|
||||
|
||||
private static class MyVisitor implements ArrangementMatchConditionVisitor {
|
||||
|
||||
@NotNull private final List<ArrangementEntryMatcher> myMatchers = new ArrayList<ArrangementEntryMatcher>();
|
||||
@NotNull private final Set<ArrangementEntryType> myTypes = EnumSet.noneOf(ArrangementEntryType.class);
|
||||
@NotNull private final Set<ArrangementModifier> myModifiers = EnumSet.noneOf(ArrangementModifier.class);
|
||||
@NotNull private final List<ArrangementEntryMatcher> myMatchers = ContainerUtilRt.newArrayList();
|
||||
@NotNull private final Set<ArrangementEntryType> myTypes = EnumSet.noneOf(ArrangementEntryType.class);
|
||||
@NotNull private final Set<ArrangementModifier> myModifiers = EnumSet.noneOf(ArrangementModifier.class);
|
||||
@NotNull private final List<String> myNamePatterns = ContainerUtilRt.newArrayList();
|
||||
|
||||
private boolean nestedComposite;
|
||||
private boolean nestedComposite;
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
|
||||
@@ -118,16 +116,31 @@ public class StdArrangementEntryMatcher implements ArrangementEntryMatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
myNamePatterns.add(condition.getPattern());
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@NotNull
|
||||
public ArrangementEntryMatcher getMatcher() {
|
||||
ByTypeArrangementEntryMatcher byType = myTypes.isEmpty() ? null : new ByTypeArrangementEntryMatcher(myTypes);
|
||||
ByModifierArrangementEntryMatcher byModifiers = myModifiers.isEmpty() ? null : new ByModifierArrangementEntryMatcher(myModifiers);
|
||||
if (byType == null && byModifiers == null && myMatchers.isEmpty()) {
|
||||
ByNameArrangementEntryMatcher byName = myNamePatterns.size() != 1 ? null : new ByNameArrangementEntryMatcher(myNamePatterns.get(0));
|
||||
int i = countNonNulls(byType, byModifiers, byName);
|
||||
if (i == 0 && myMatchers.isEmpty()) {
|
||||
return ArrangementEntryMatcher.EMPTY;
|
||||
}
|
||||
if (myMatchers.isEmpty() && (byType == null ^ byModifiers == null)) {
|
||||
return byModifiers == null ? byType : byModifiers;
|
||||
if (myMatchers.isEmpty() && i == 1) {
|
||||
if (byType != null) {
|
||||
return byType;
|
||||
}
|
||||
else if (byModifiers != null) {
|
||||
return byModifiers;
|
||||
}
|
||||
else {
|
||||
return byName;
|
||||
}
|
||||
}
|
||||
else if (myMatchers.size() == 1) {
|
||||
return myMatchers.get(0);
|
||||
@@ -143,8 +156,21 @@ public class StdArrangementEntryMatcher implements ArrangementEntryMatcher {
|
||||
if (byModifiers != null) {
|
||||
result.addMatcher(byModifiers);
|
||||
}
|
||||
if (byName != null) {
|
||||
result.addMatcher(byName);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static int countNonNulls(Object... data) {
|
||||
int result = 0;
|
||||
for (Object o : data) {
|
||||
if (o != null) {
|
||||
result++;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -52,10 +52,6 @@ public class ArrangementAtomMatchCondition implements ArrangementMatchCondition
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
public boolean isInverted() {
|
||||
return myInverted;
|
||||
}
|
||||
|
||||
public void setInverted(boolean inverted) {
|
||||
myInverted = inverted;
|
||||
}
|
||||
|
||||
+2
@@ -26,4 +26,6 @@ public interface ArrangementMatchConditionVisitor {
|
||||
void visit(@NotNull ArrangementAtomMatchCondition condition);
|
||||
|
||||
void visit(@NotNull ArrangementCompositeMatchCondition condition);
|
||||
|
||||
void visit(@NotNull ArrangementNameMatchCondition condition);
|
||||
}
|
||||
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.psi.codeStyle.arrangement.model;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.arrangement.NameAwareArrangementEntry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Condition which works on {@link NameAwareArrangementEntry}
|
||||
*
|
||||
* @author Denis Zhdanov
|
||||
* @since 11/14/12 12:18 PM
|
||||
*/
|
||||
public class ArrangementNameMatchCondition implements ArrangementMatchCondition {
|
||||
|
||||
@NotNull private final String myPattern;
|
||||
|
||||
public ArrangementNameMatchCondition(@NotNull String pattern) {
|
||||
myPattern = pattern;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getPattern() {
|
||||
return myPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invite(@NotNull ArrangementMatchConditionVisitor visitor) {
|
||||
visitor.visit(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrangementMatchCondition clone() {
|
||||
return new ArrangementNameMatchCondition(myPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return myPattern.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
ArrangementNameMatchCondition condition = (ArrangementNameMatchCondition)o;
|
||||
return myPattern.equals(condition.myPattern);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("name like '%s'", StringUtil.escapeStringCharacters(myPattern));
|
||||
}
|
||||
}
|
||||
+16
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.Test;
|
||||
@@ -106,6 +107,21 @@ public class DefaultArrangementEntryMatcherSerializerTest {
|
||||
checkElements(element, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nameConditionOnly() {
|
||||
ArrangementNameMatchCondition condition = new ArrangementNameMatchCondition("get*");
|
||||
doTest(condition);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void compositeConditionWithName() {
|
||||
ArrangementCompositeMatchCondition condition = new ArrangementCompositeMatchCondition();
|
||||
condition.addOperand(new ArrangementAtomMatchCondition(TYPE, METHOD));
|
||||
condition.addOperand(new ArrangementAtomMatchCondition(MODIFIER, SYNCHRONIZED));
|
||||
condition.addOperand(new ArrangementNameMatchCondition("get*"));
|
||||
doTest(condition);
|
||||
}
|
||||
|
||||
private static void checkElements(@NotNull Element expected, @NotNull Element actual) {
|
||||
assertTrue(
|
||||
String.format("Tag name mismatch - expected: '%s', actual: '%s'", expected.getName(), actual.getName()),
|
||||
|
||||
+11
-13
@@ -20,10 +20,7 @@ import com.intellij.application.options.codeStyle.arrangement.ArrangementConstan
|
||||
import com.intellij.application.options.codeStyle.arrangement.ArrangementNodeDisplayManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.*;
|
||||
import com.intellij.util.ui.GridBag;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -61,16 +58,11 @@ public class ArrangementAndMatchConditionComponent extends JPanel implements Arr
|
||||
setOpaque(false);
|
||||
setLayout(new GridBagLayout());
|
||||
final Map<Object, ArrangementMatchCondition> operands = new HashMap<Object, ArrangementMatchCondition>();
|
||||
final List<ArrangementNameMatchCondition> nameConditions = new ArrayList<ArrangementNameMatchCondition>();
|
||||
ArrangementMatchConditionVisitor visitor = new ArrangementMatchConditionVisitor() {
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementAtomMatchCondition condition) {
|
||||
operands.put(condition.getValue(), condition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
|
||||
operands.put(condition, condition);
|
||||
}
|
||||
@Override public void visit(@NotNull ArrangementAtomMatchCondition condition) { operands.put(condition.getValue(), condition); }
|
||||
@Override public void visit(@NotNull ArrangementCompositeMatchCondition condition) { operands.put(condition, condition); }
|
||||
@Override public void visit(@NotNull ArrangementNameMatchCondition condition) { nameConditions.add(condition); }
|
||||
};
|
||||
for (ArrangementMatchCondition operand : setting.getOperands()) {
|
||||
operand.invite(visitor);
|
||||
@@ -86,6 +78,12 @@ public class ArrangementAndMatchConditionComponent extends JPanel implements Arr
|
||||
JComponent uiComponent = component.getUiComponent();
|
||||
add(uiComponent, constraints);
|
||||
}
|
||||
for (ArrangementNameMatchCondition condition : nameConditions) {
|
||||
ArrangementMatchConditionComponent component = factory.getComponent(condition, rule, true);
|
||||
myComponents.add(component);
|
||||
JComponent uiComponent = component.getUiComponent();
|
||||
add(uiComponent, constraints);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
-4
@@ -24,10 +24,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementCompositeMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchConditionVisitor;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.*;
|
||||
import com.intellij.util.Consumer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -83,6 +80,11 @@ public class ArrangementMatchNodeComponentFactory {
|
||||
public void visit(@NotNull ArrangementCompositeMatchCondition condition) {
|
||||
ref.set(new ArrangementAndMatchConditionComponent(rule, condition, ArrangementMatchNodeComponentFactory.this, myDisplayManager));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visit(@NotNull ArrangementNameMatchCondition condition) {
|
||||
ref.set(new ArrangementNameConditionComponent(condition));
|
||||
}
|
||||
});
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
+11
-2
@@ -294,12 +294,21 @@ public class ArrangementMatchingRulesControl extends JBTable {
|
||||
}
|
||||
|
||||
public void showEditor(int rowToEdit) {
|
||||
if (myEditorRow == rowToEdit + 1) {
|
||||
return;
|
||||
}
|
||||
if (myEditorRow >= 0) {
|
||||
if (myEditorRow < rowToEdit) {
|
||||
rowToEdit--;
|
||||
}
|
||||
hideEditor();
|
||||
}
|
||||
myEditorRow = rowToEdit + 1;
|
||||
ArrangementEditorComponent editor = new ArrangementEditorComponent(this, myEditorRow, myEditor);
|
||||
Container parent = getParent();
|
||||
int width = getBounds().width;
|
||||
if (parent instanceof JViewport) {
|
||||
width -=((JScrollPane)parent.getParent()).getVerticalScrollBar().getWidth();
|
||||
width -= ((JScrollPane)parent.getParent()).getVerticalScrollBar().getWidth();
|
||||
}
|
||||
editor.applyAvailableWidth(width);
|
||||
myEditor.updateState(rowToEdit);
|
||||
@@ -310,7 +319,7 @@ public class ArrangementMatchingRulesControl extends JBTable {
|
||||
finally {
|
||||
mySkipSelectionChange = false;
|
||||
}
|
||||
|
||||
|
||||
Rectangle bounds = getRowsBounds(rowToEdit, myEditorRow);
|
||||
if (bounds != null) {
|
||||
myRepresentationCallback.ensureVisible(bounds);
|
||||
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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.application.options.codeStyle.arrangement.match;
|
||||
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition;
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
* @since 11/14/12 12:24 PM
|
||||
*/
|
||||
public class ArrangementNameConditionComponent implements ArrangementMatchConditionComponent {
|
||||
|
||||
@NotNull private final ArrangementNameMatchCondition myCondition;
|
||||
|
||||
public ArrangementNameConditionComponent(@NotNull ArrangementNameMatchCondition condition) {
|
||||
myCondition = condition;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrangementMatchCondition getMatchCondition() {
|
||||
return myCondition;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent getUiComponent() {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle getScreenBounds() {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSelected(boolean selected) {
|
||||
// TODO den implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle onMouseMove(@NotNull MouseEvent event) {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMouseRelease(@NotNull MouseEvent event) {
|
||||
// TODO den implement
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle onMouseExited() {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Rectangle onMouseEntered(@NotNull MouseEvent e) {
|
||||
// TODO den implement
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+13
-2
@@ -37,13 +37,14 @@ import com.intellij.codeInspection.offlineViewer.OfflineInspectionRVContentProvi
|
||||
import com.intellij.codeInspection.offlineViewer.OfflineViewParseUtil;
|
||||
import com.intellij.codeInspection.reference.RefManagerImpl;
|
||||
import com.intellij.codeInspection.ui.InspectionResultsView;
|
||||
import com.intellij.ide.util.BrowseFilesListener;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
@@ -83,7 +84,17 @@ public class ViewOfflineResultsAction extends AnAction implements DumbAware {
|
||||
|
||||
LOG.assertTrue(project != null);
|
||||
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false);
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, false){
|
||||
@Override
|
||||
public Icon getIcon(VirtualFile file) {
|
||||
if (file.isDirectory()) {
|
||||
if (file.findChild(InspectionApplication.DESCRIPTIONS + "." + StdFileTypes.XML.getDefaultExtension()) != null) {
|
||||
return AllIcons.Nodes.InspectionResults;
|
||||
}
|
||||
}
|
||||
return super.getIcon(file);
|
||||
}
|
||||
};
|
||||
descriptor.setTitle("Select Path");
|
||||
descriptor.setDescription("Select directory which contains exported inspections results");
|
||||
final VirtualFile virtualFile = FileChooser.chooseFile(descriptor, project, null);
|
||||
|
||||
+8
-8
@@ -39,19 +39,19 @@
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="dd95a" class="javax.swing.JButton" binding="myReloadButton">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="&Reload"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="cb5b0">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<grid id="8f5fd" binding="myActionPanel" layout-manager="CardLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
<component id="7efaf" class="javax.swing.JLabel">
|
||||
|
||||
+82
-14
@@ -3,6 +3,11 @@ package com.intellij.lang.javascript.boilerplate;
|
||||
import com.google.common.collect.ImmutableCollection;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionButton;
|
||||
import com.intellij.openapi.ui.ValidationInfo;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.platform.WebProjectGenerator;
|
||||
@@ -10,13 +15,13 @@ import com.intellij.platform.templates.github.GithubTagInfo;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.AsyncProcessIcon;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.*;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -27,13 +32,21 @@ import java.util.Set;
|
||||
*/
|
||||
public class GithubProjectGeneratorPeer implements WebProjectGenerator.GeneratorPeer<GithubTagInfo> {
|
||||
|
||||
private static final String CONTROL_PLACE = "Github.Project.Generator.Reload";
|
||||
|
||||
private enum UpdateStatus {
|
||||
UPDATING, IDLE
|
||||
}
|
||||
|
||||
private final List<WebProjectGenerator.SettingsStateListener> myListeners = ContainerUtil.newArrayList();
|
||||
private final GithubTagInfo myMasterTag;
|
||||
private final GithubTagListProvider myTagListProvider;
|
||||
private final AsyncProcessIcon myLoadingVersionIcon = new AsyncProcessIcon("Getting github tags");
|
||||
private JComboBox myComboBox;
|
||||
private JComponent myComponent;
|
||||
private JLabel myErrorMessage;
|
||||
private JButton myReloadButton;
|
||||
private JPanel myVersionPanel;
|
||||
private JPanel myActionPanel;
|
||||
|
||||
public GithubProjectGeneratorPeer(@NotNull AbstractGithubTagDownloadedProjectGenerator generator) {
|
||||
String ghUserName = generator.getGithubUserName();
|
||||
@@ -52,23 +65,19 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
|
||||
}
|
||||
});
|
||||
|
||||
final GithubTagListProvider provider = new GithubTagListProvider(ghUserName, ghRepoName);
|
||||
ImmutableSet<GithubTagInfo> cachedTags = provider.getCachedTags();
|
||||
myTagListProvider = new GithubTagListProvider(ghUserName, ghRepoName);
|
||||
fillActionPanel();
|
||||
ImmutableSet<GithubTagInfo> cachedTags = myTagListProvider.getCachedTags();
|
||||
if (cachedTags != null) {
|
||||
updateTagList(cachedTags);
|
||||
tagsUpdated(cachedTags);
|
||||
}
|
||||
|
||||
myErrorMessage.setText(null);
|
||||
myReloadButton.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
provider.updateTagListAsynchronously(GithubProjectGeneratorPeer.this);
|
||||
}
|
||||
});
|
||||
provider.updateTagListAsynchronously(this);
|
||||
reloadTagsInBackground();
|
||||
}
|
||||
|
||||
void updateTagList(@NotNull ImmutableSet<GithubTagInfo> tags) {
|
||||
void tagsUpdated(@NotNull ImmutableSet<GithubTagInfo> tags) {
|
||||
show(UpdateStatus.IDLE);
|
||||
if (!shouldUpdate(tags)) {
|
||||
return;
|
||||
}
|
||||
@@ -170,4 +179,63 @@ public class GithubProjectGeneratorPeer implements WebProjectGenerator.Generator
|
||||
myListeners.add(listener);
|
||||
}
|
||||
|
||||
private void reloadTagsInBackground() {
|
||||
show(UpdateStatus.UPDATING);
|
||||
myTagListProvider.updateTagListAsynchronously(this);
|
||||
}
|
||||
|
||||
private void show(@NotNull UpdateStatus status) {
|
||||
CardLayout cardLayout = (CardLayout) myActionPanel.getLayout();
|
||||
cardLayout.show(myActionPanel, status.name());
|
||||
if (status == UpdateStatus.UPDATING) {
|
||||
myLoadingVersionIcon.resume();
|
||||
}
|
||||
}
|
||||
|
||||
private void fillActionPanel() {
|
||||
myActionPanel.add(createReloadButtonPanel(), UpdateStatus.IDLE.name());
|
||||
myActionPanel.add(createReloadInProgressPanel(), UpdateStatus.UPDATING.name());
|
||||
show(UpdateStatus.IDLE);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JPanel createReloadButtonPanel() {
|
||||
ReloadAction reloadAction = new ReloadAction();
|
||||
ActionButton reloadButton = new ActionButton(
|
||||
reloadAction,
|
||||
reloadAction.getTemplatePresentation().clone(),
|
||||
CONTROL_PLACE,
|
||||
ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE
|
||||
);
|
||||
JPanel panel = new JPanel(new BorderLayout(0, 0));
|
||||
panel.add(reloadButton, BorderLayout.WEST);
|
||||
return panel;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JPanel createReloadInProgressPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout(3, 0));
|
||||
myLoadingVersionIcon.suspend();
|
||||
panel.add(myLoadingVersionIcon, BorderLayout.CENTER);
|
||||
panel.add(new JLabel("Loading..."), BorderLayout.EAST);
|
||||
return panel;
|
||||
}
|
||||
|
||||
private class ReloadAction extends AnAction {
|
||||
|
||||
private ReloadAction() {
|
||||
super("Reload versions", null, AllIcons.Actions.Refresh);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
GithubProjectGeneratorPeer.this.reloadTagsInBackground();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public class GithubTagListProvider {
|
||||
LOG.info(getGeneratorName() + "Cache has been successfully updated");
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
public void run() {
|
||||
peer.updateTagList(tags);
|
||||
peer.tagsUpdated(tags);
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
||||
+1
-1
@@ -217,7 +217,7 @@ public class ArrangementEngine {
|
||||
}
|
||||
else {
|
||||
if (dependencies.size() == 1 && dependencies.get(0) == entry.getParent()) {
|
||||
// Handle a situation when the entry is condifured to be at the first parent's children.
|
||||
// Handle a situation when the entry is configured to be at the first parent's children.
|
||||
arranged.add(entry);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
@@ -143,6 +143,10 @@ public class GenericInlineHandler {
|
||||
Collection<? extends PsiReference> allReferences) {
|
||||
final Map<Language, InlineHandler.Inliner> inliners = new HashMap<Language, InlineHandler.Inliner>();
|
||||
for (PsiReference ref : allReferences) {
|
||||
if (ref == null) {
|
||||
LOG.error("element: " + element.getClass()+ ", allReferences contains null!");
|
||||
continue;
|
||||
}
|
||||
PsiElement refElement = ref.getElement();
|
||||
LOG.assertTrue(refElement != null, ref.getClass().getName());
|
||||
|
||||
|
||||
+18
-5
@@ -29,6 +29,7 @@ import com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher
|
||||
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementMatchCondition
|
||||
import com.intellij.psi.codeStyle.arrangement.model.ArrangementNameMatchCondition
|
||||
import com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase
|
||||
import org.jetbrains.annotations.NotNull
|
||||
@@ -59,17 +60,29 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ArrangementGroupingRule group(@NotNull ArrangementGroupingType type) {
|
||||
protected static ArrangementGroupingRule group(@NotNull ArrangementGroupingType type) {
|
||||
group(type, ArrangementEntryOrderType.KEEP)
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ArrangementGroupingRule group(@NotNull ArrangementGroupingType type, @NotNull ArrangementEntryOrderType order) {
|
||||
protected static ArrangementGroupingRule group(@NotNull ArrangementGroupingType type, @NotNull ArrangementEntryOrderType order) {
|
||||
new ArrangementGroupingRule(type, order)
|
||||
}
|
||||
|
||||
|
||||
@NotNull
|
||||
protected StdArrangementMatchRule rule(@NotNull Object ... conditions) {
|
||||
protected static StdArrangementMatchRule rule(@NotNull String name) {
|
||||
new StdArrangementMatchRule(new StdArrangementEntryMatcher(new ArrangementNameMatchCondition(name)))
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull String name, Object ... conditions) {
|
||||
def c = conditions.collect { atom(it) }
|
||||
c << new ArrangementNameMatchCondition(name)
|
||||
new StdArrangementMatchRule(new StdArrangementEntryMatcher(ArrangementUtil.combine(c as ArrangementMatchCondition[])))
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull Object ... conditions) {
|
||||
def condition
|
||||
if (conditions.length == 1) {
|
||||
condition = atom(conditions[0])
|
||||
@@ -82,7 +95,7 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected ArrangementAtomMatchCondition atom(@NotNull Object condition) {
|
||||
protected static ArrangementAtomMatchCondition atom(@NotNull Object condition) {
|
||||
new ArrangementAtomMatchCondition(ArrangementUtil.parseType(condition), condition)
|
||||
}
|
||||
|
||||
|
||||
@@ -179,51 +179,51 @@ public class AllIcons {
|
||||
public static final Icon Class_filter = IconLoader.getIcon("/debugger/class_filter.png"); // 16x16
|
||||
public static final Icon Console = IconLoader.getIcon("/debugger/console.png"); // 16x16
|
||||
public static final Icon Db_array = IconLoader.getIcon("/debugger/db_array.png"); // 16x16
|
||||
public static final Icon Db_dep_exception_breakpoint = IconLoader.getIcon("/debugger/db_dep_exception_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_dep_field_breakpoint = IconLoader.getIcon("/debugger/db_dep_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_dep_line_breakpoint = IconLoader.getIcon("/debugger/db_dep_line_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_dep_method_breakpoint = IconLoader.getIcon("/debugger/db_dep_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_disabled_breakpoint = IconLoader.getIcon("/debugger/db_disabled_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_dep_exception_breakpoint = IconLoader.getIcon("/debugger/db_dep_exception_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_dep_field_breakpoint = IconLoader.getIcon("/debugger/db_dep_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_dep_line_breakpoint = IconLoader.getIcon("/debugger/db_dep_line_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_dep_method_breakpoint = IconLoader.getIcon("/debugger/db_dep_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_disabled_breakpoint = IconLoader.getIcon("/debugger/db_disabled_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_disabled_breakpoint_process = IconLoader.getIcon("/debugger/db_disabled_breakpoint_process.png"); // 16x16
|
||||
public static final Icon Db_disabled_exception_breakpoint = IconLoader.getIcon("/debugger/db_disabled_exception_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_disabled_field_breakpoint = IconLoader.getIcon("/debugger/db_disabled_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_disabled_method_breakpoint = IconLoader.getIcon("/debugger/db_disabled_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_exception_breakpoint = IconLoader.getIcon("/debugger/db_exception_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_field_breakpoint = IconLoader.getIcon("/debugger/db_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_disabled_exception_breakpoint = IconLoader.getIcon("/debugger/db_disabled_exception_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_disabled_field_breakpoint = IconLoader.getIcon("/debugger/db_disabled_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_disabled_method_breakpoint = IconLoader.getIcon("/debugger/db_disabled_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_exception_breakpoint = IconLoader.getIcon("/debugger/db_exception_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_field_breakpoint = IconLoader.getIcon("/debugger/db_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_field_warning_breakpoint = IconLoader.getIcon("/debugger/db_field_warning_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_invalid_breakpoint = IconLoader.getIcon("/debugger/db_invalid_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_invalid_field_breakpoint = IconLoader.getIcon("/debugger/db_invalid_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_invalid_method_breakpoint = IconLoader.getIcon("/debugger/db_invalid_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_method_breakpoint = IconLoader.getIcon("/debugger/db_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_invalid_breakpoint = IconLoader.getIcon("/debugger/db_invalid_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_invalid_field_breakpoint = IconLoader.getIcon("/debugger/db_invalid_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_invalid_method_breakpoint = IconLoader.getIcon("/debugger/db_invalid_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_method_breakpoint = IconLoader.getIcon("/debugger/db_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_method_warning_breakpoint = IconLoader.getIcon("/debugger/db_method_warning_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_breakpoint = IconLoader.getIcon("/debugger/db_muted_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_dep_exception_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_exception_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_dep_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_dep_line_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_line_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_dep_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_disabled_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_breakpoint = IconLoader.getIcon("/debugger/db_muted_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_dep_exception_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_exception_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_dep_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_dep_line_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_line_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_dep_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_dep_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_disabled_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_disabled_breakpoint_process = IconLoader.getIcon("/debugger/db_muted_disabled_breakpoint_process.png"); // 16x16
|
||||
public static final Icon Db_muted_disabled_exception_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_exception_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_disabled_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_disabled_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_exception_breakpoint = IconLoader.getIcon("/debugger/db_muted_exception_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_disabled_exception_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_exception_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_disabled_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_disabled_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_disabled_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_exception_breakpoint = IconLoader.getIcon("/debugger/db_muted_exception_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_field_warning_breakpoint = IconLoader.getIcon("/debugger/db_muted_field_warning_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_invalid_breakpoint = IconLoader.getIcon("/debugger/db_muted_invalid_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_invalid_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_invalid_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_invalid_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_invalid_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_invalid_breakpoint = IconLoader.getIcon("/debugger/db_muted_invalid_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_invalid_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_invalid_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_invalid_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_invalid_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_method_warning_breakpoint = IconLoader.getIcon("/debugger/db_muted_method_warning_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_verified_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_verified_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_verified_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_muted_verified_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_verified_field_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_verified_method_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_muted_verified_warning_breakpoint = IconLoader.getIcon("/debugger/db_muted_verified_warning_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_obsolete = IconLoader.getIcon("/debugger/db_obsolete.png"); // 16x16
|
||||
public static final Icon Db_obsolete = IconLoader.getIcon("/debugger/db_obsolete.png"); // 12x12
|
||||
public static final Icon Db_primitive = IconLoader.getIcon("/debugger/db_primitive.png"); // 16x16
|
||||
public static final Icon Db_set_breakpoint = IconLoader.getIcon("/debugger/db_set_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_verified_breakpoint = IconLoader.getIcon("/debugger/db_verified_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_verified_field_breakpoint = IconLoader.getIcon("/debugger/db_verified_field_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_verified_method_breakpoint = IconLoader.getIcon("/debugger/db_verified_method_breakpoint.png"); // 16x16
|
||||
public static final Icon Db_set_breakpoint = IconLoader.getIcon("/debugger/db_set_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_verified_breakpoint = IconLoader.getIcon("/debugger/db_verified_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_verified_field_breakpoint = IconLoader.getIcon("/debugger/db_verified_field_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_verified_method_breakpoint = IconLoader.getIcon("/debugger/db_verified_method_breakpoint.png"); // 12x12
|
||||
public static final Icon Db_verified_warning_breakpoint = IconLoader.getIcon("/debugger/db_verified_warning_breakpoint.png"); // 16x16
|
||||
public static final Icon Disable_value_calculation = IconLoader.getIcon("/debugger/disable_value_calculation.png"); // 16x16
|
||||
public static final Icon EvaluateExpression = IconLoader.getIcon("/debugger/evaluateExpression.png"); // 16x16
|
||||
@@ -516,6 +516,7 @@ public class AllIcons {
|
||||
public static final Icon Empty = IconLoader.getIcon("/icons/inspector/empty.gif"); // 9x9
|
||||
public static final Icon SortByCategory = IconLoader.getIcon("/icons/inspector/sortByCategory.png"); // 16x16
|
||||
public static final Icon SortByName = IconLoader.getIcon("/icons/inspector/sortByName.png"); // 16x16
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -530,6 +531,7 @@ public class AllIcons {
|
||||
|
||||
}
|
||||
public static final Icon EmptyFatalError = IconLoader.getIcon("/ide/emptyFatalError.png"); // 16x16
|
||||
public static final Icon Error = IconLoader.getIcon("/ide/error.png"); // 16x16
|
||||
public static final Icon Error_notifications = IconLoader.getIcon("/ide/error_notifications.png"); // 16x16
|
||||
public static final Icon ErrorPoint = IconLoader.getIcon("/ide/errorPoint.png"); // 6x6
|
||||
public static final Icon FatalError_read = IconLoader.getIcon("/ide/fatalError-read.png"); // 16x16
|
||||
@@ -652,7 +654,7 @@ public class AllIcons {
|
||||
public static final Icon DeleteContentFolderRollover = IconLoader.getIcon("/modules/deleteContentFolderRollover.png"); // 9x9
|
||||
public static final Icon DeleteContentRoot = IconLoader.getIcon("/modules/deleteContentRoot.png"); // 11x11
|
||||
public static final Icon DeleteContentRootRollover = IconLoader.getIcon("/modules/deleteContentRootRollover.png"); // 11x11
|
||||
public static final Icon Edit = IconLoader.getIcon("/modules/edit.png"); // 16x16
|
||||
public static final Icon Edit = IconLoader.getIcon("/modules/edit.png"); // 14x14
|
||||
public static final Icon ExcludeRoot = IconLoader.getIcon("/modules/excludeRoot.png"); // 16x16
|
||||
public static final Icon Library = IconLoader.getIcon("/modules/library.png"); // 16x16
|
||||
public static final Icon Merge = IconLoader.getIcon("/modules/merge.png"); // 16x16
|
||||
@@ -734,6 +736,7 @@ public class AllIcons {
|
||||
public static final Icon IdeaModule = IconLoader.getIcon("/nodes/ideaModule.png"); // 16x16
|
||||
public static final Icon IdeaProject = IconLoader.getIcon("/nodes/ideaProject.png"); // 16x16
|
||||
public static final Icon IdeaWorkspace = IconLoader.getIcon("/nodes/ideaWorkspace.png"); // 16x16
|
||||
public static final Icon InspectionResults = IconLoader.getIcon("/nodes/inspectionResults.png"); // 16x16
|
||||
public static final Icon Interface = IconLoader.getIcon("/nodes/interface.png"); // 16x16
|
||||
public static final Icon J2eeParameter = IconLoader.getIcon("/nodes/j2eeParameter.png"); // 16x16
|
||||
public static final Icon JarDirectory = IconLoader.getIcon("/nodes/jarDirectory.png"); // 16x16
|
||||
@@ -992,6 +995,7 @@ public class AllIcons {
|
||||
public static final Icon AddLink = IconLoader.getIcon("/toolbarDecorator/mac/addLink.png"); // 16x16
|
||||
public static final Icon AddPackage = IconLoader.getIcon("/toolbarDecorator/mac/addPackage.png"); // 16x16
|
||||
public static final Icon AddPattern = IconLoader.getIcon("/toolbarDecorator/mac/addPattern.png"); // 16x16
|
||||
public static final Icon AddRemoteDatasource = IconLoader.getIcon("/toolbarDecorator/mac/addRemoteDatasource.png"); // 16x16
|
||||
public static final Icon AddYouTrack = IconLoader.getIcon("/toolbarDecorator/mac/addYouTrack.png"); // 16x16
|
||||
public static final Icon Analyze = IconLoader.getIcon("/toolbarDecorator/mac/analyze.png"); // 14x14
|
||||
public static final Icon Edit = IconLoader.getIcon("/toolbarDecorator/mac/edit.png"); // 14x14
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
@@ -87,6 +87,7 @@ public class GroovyCompletionData {
|
||||
}
|
||||
|
||||
if (parent instanceof GrExpression && parent.getParent() instanceof GrAnnotationNameValuePair) {
|
||||
addKeywords(result, false, PsiKeyword.TRUE, PsiKeyword.FALSE, PsiKeyword.NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+10
-16
@@ -45,6 +45,8 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.GrStubElementBase;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.stubs.GrModifierListStub;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @autor: Dmitry.Krasilschikov
|
||||
* @date: 18.03.2007
|
||||
@@ -119,22 +121,14 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
|
||||
|
||||
@NotNull
|
||||
public PsiElement[] getModifiers() {
|
||||
PsiElement[] modifiersKeywords = findChildrenByType(TokenSets.MODIFIERS, PsiElement.class);
|
||||
GrAnnotation[] modifiersAnnotations = findChildrenByClass(GrAnnotation.class);
|
||||
|
||||
if (modifiersAnnotations.length == 0) return modifiersKeywords;
|
||||
|
||||
PsiElement[] res = new PsiElement[modifiersAnnotations.length + modifiersKeywords.length];
|
||||
|
||||
int i = 0;
|
||||
for (PsiElement modifiersKeyword : modifiersKeywords) {
|
||||
res[i++] = modifiersKeyword;
|
||||
}
|
||||
for (GrAnnotation modifiersAnnotation : modifiersAnnotations) {
|
||||
res[i++] = modifiersAnnotation;
|
||||
final ArrayList<PsiElement> result = new ArrayList<PsiElement>();
|
||||
for (PsiElement cur = getFirstChild(); cur != null; cur = cur.getNextSibling()) {
|
||||
if (cur instanceof GrAnnotation || TokenSets.MODIFIERS.contains(cur.getNode().getElementType())) {
|
||||
result.add(cur);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
return result.toArray(new PsiElement[result.size()]);
|
||||
}
|
||||
|
||||
public boolean hasExplicitVisibilityModifiers() {
|
||||
@@ -276,9 +270,9 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
|
||||
@Nullable
|
||||
private PsiElement findAnchor(String name) {
|
||||
final int myPriority = PRIORITY.get(name);
|
||||
final PsiElement[] modifiers = getModifiers();
|
||||
PsiElement anchor = null;
|
||||
for (PsiElement modifier : modifiers) {
|
||||
|
||||
for (PsiElement modifier : getModifiers()) {
|
||||
final int otherPriority = PRIORITY.get(modifier.getText());
|
||||
if (otherPriority <= myPriority) {
|
||||
anchor = modifier;
|
||||
|
||||
+27
-44
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.statements.clauses;
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrCondition;
|
||||
@@ -50,62 +49,46 @@ public class GrTraditionalForClauseImpl extends GroovyPsiElementImpl implements
|
||||
}
|
||||
|
||||
public GrCondition getInitialization() {
|
||||
final ASTNode first = getFirstSemicolon();
|
||||
for (ASTNode child = getNode().getFirstChildNode(); child != null && child != first; child = child.getTreeNext()) {
|
||||
if (child.getPsi() instanceof GrCondition) {
|
||||
return (GrCondition)child.getPsi();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return getConditionInner(0);
|
||||
}
|
||||
|
||||
public GrExpression getCondition() {
|
||||
final ASTNode first = getFirstSemicolon();
|
||||
if (first == null) return null;
|
||||
for (ASTNode child = first.getTreeNext(); child != null; child = child.getTreeNext()) {
|
||||
if (child.getPsi() instanceof GrExpression) {
|
||||
return (GrExpression) child.getPsi();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
final GrCondition condition = getConditionInner(1);
|
||||
return condition instanceof GrExpression ? (GrExpression)condition : null;
|
||||
}
|
||||
|
||||
public GrExpression getUpdate() {
|
||||
final ASTNode second = getSecondSemicolon();
|
||||
if (second == null) return null;
|
||||
|
||||
for (ASTNode child = second; child != null; child = child.getTreeNext()) {
|
||||
if (child.getPsi() instanceof GrExpression) {
|
||||
return (GrExpression)child.getPsi();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
final GrCondition condition = getConditionInner(2);
|
||||
return condition instanceof GrExpression ? (GrExpression)condition : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ASTNode getFirstSemicolon() {
|
||||
private GrCondition getConditionInner(final int i) {
|
||||
int passed = 0;
|
||||
boolean waitForSemicolon = false;
|
||||
|
||||
for (ASTNode child = getNode().getFirstChildNode(); child != null; child = child.getTreeNext()) {
|
||||
if (child.getElementType() == GroovyTokenTypes.mSEMI) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
if (waitForSemicolon) {
|
||||
waitForSemicolon = false;
|
||||
}
|
||||
else {
|
||||
if (passed == i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private ASTNode getSecondSemicolon() {
|
||||
boolean firstPassed = false;
|
||||
for (ASTNode child = getNode().getFirstChildNode(); child != null; child = child.getTreeNext()) {
|
||||
if (child.getElementType() == GroovyTokenTypes.mSEMI) {
|
||||
if (firstPassed) {
|
||||
return child;
|
||||
} else {
|
||||
firstPassed = true;
|
||||
passed++;
|
||||
}
|
||||
}
|
||||
else if (child.getPsi() instanceof GrCondition) {
|
||||
if (passed == i) {
|
||||
return (GrCondition)child.getPsi();
|
||||
}
|
||||
|
||||
passed++;
|
||||
waitForSemicolon = true;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2000-2007 JetBrains s.r.o.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
* 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
|
||||
*
|
||||
@@ -96,6 +97,8 @@ public class KeywordCompletionTest extends CompletionTestBase {
|
||||
void testAfterLabel() { doTest() }
|
||||
void testKeywordsInParentheses() { doTest() }
|
||||
void testCompletionInTupleVar(){ doTest() }
|
||||
void testAnnotationArg() { doTest() }
|
||||
void testDefaultAnnotationArg(){ doTest() }
|
||||
|
||||
String basePath = TestUtils.testDataPath + 'groovy/oldCompletion/keyword'
|
||||
|
||||
|
||||
-14
@@ -731,20 +731,6 @@ new Base() {
|
||||
''')
|
||||
}
|
||||
|
||||
void testDelegateWithDeprecated() {
|
||||
testHighlighting('''\
|
||||
interface Foo {
|
||||
@Deprecated
|
||||
void foo()
|
||||
}
|
||||
|
||||
|
||||
<error descr="Method 'foo' is not implemented">class FooImpl implements Foo</error> {
|
||||
@Delegate(deprecated = false) Foo delegate
|
||||
}
|
||||
''')
|
||||
}
|
||||
|
||||
void testAbstractMethodWithBody() {
|
||||
testHighlighting('''\
|
||||
interface A {
|
||||
|
||||
@@ -241,16 +241,34 @@ public abstract class Bar implements Foo {
|
||||
public class FooBar extends Bar implements Foo {
|
||||
}
|
||||
''')
|
||||
def file = myFixture.configureByText('Baz.groovy', '''\
|
||||
assertAllMethodsImplemented('Baz.groovy', '''\
|
||||
class Baz {
|
||||
@Delegate(deprecated = true)
|
||||
FooBar bare
|
||||
}
|
||||
''') as GroovyFile
|
||||
''')
|
||||
}
|
||||
|
||||
private void assertAllMethodsImplemented(String fileName, String text) {
|
||||
def file = myFixture.configureByText(fileName, text) as GroovyFile
|
||||
|
||||
assertNotNull(file)
|
||||
final clazz = file.classes[0]
|
||||
assertNotNull(clazz)
|
||||
assertEmpty OverrideImplementUtil.getMethodSignaturesToImplement(clazz)
|
||||
}
|
||||
|
||||
void testDeprecatedFalse() {
|
||||
myFixture.addFileToProject('Foo.groovy', '''\
|
||||
interface Foo {
|
||||
@Deprecated
|
||||
void foo()
|
||||
}
|
||||
''')
|
||||
assertAllMethodsImplemented('text.groovy', '''\
|
||||
class FooImpl implements Foo {
|
||||
@Delegate(deprecated = false) Foo delegate
|
||||
}
|
||||
''')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
@Delegated(deprecated = <caret>)
|
||||
Del d
|
||||
}
|
||||
-----
|
||||
false
|
||||
null
|
||||
true
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
@Delegated(<caret>)
|
||||
Del d
|
||||
}
|
||||
-----
|
||||
false
|
||||
null
|
||||
true
|
||||
-8
@@ -60,14 +60,6 @@ public void clear() {
|
||||
return ;
|
||||
}
|
||||
|
||||
public boolean equals(java.lang.Object o) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public java.lang.String get(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -298,13 +298,6 @@ public class MavenDomUtil {
|
||||
return children[index];
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PropertiesFile getPropertiesFile(@NotNull Project project, @NotNull String fileName) {
|
||||
VirtualFile file = MavenPropertiesVirtualFileSystem.getInstance().findFileByPath(fileName);
|
||||
if (file == null) return null;
|
||||
return getPropertiesFile(project, file);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PropertiesFile getPropertiesFile(@NotNull Project project, @NotNull VirtualFile file) {
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
@@ -312,12 +305,6 @@ public class MavenDomUtil {
|
||||
return (PropertiesFile)psiFile;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IProperty findProperty(@NotNull Project project, @NotNull String fileName, @NotNull String propName) {
|
||||
PropertiesFile propertiesFile = getPropertiesFile(project, fileName);
|
||||
return propertiesFile == null ? null : propertiesFile.findPropertyByKey(propName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IProperty findProperty(@NotNull Project project, @NotNull VirtualFile file, @NotNull String propName) {
|
||||
PropertiesFile propertiesFile = getPropertiesFile(project, file);
|
||||
|
||||
+8
-6
@@ -185,21 +185,22 @@ public class MavenPropertyPsiReference extends MavenPsiReference {
|
||||
if (result != null) return result;
|
||||
}
|
||||
|
||||
IProperty property = MavenDomUtil.findProperty(myProject, MavenPropertiesVirtualFileSystem.SYSTEM_PROPERTIES_FILE, myText);
|
||||
MavenPropertiesVirtualFileSystem mavenPropertiesVirtualFileSystem = MavenPropertiesVirtualFileSystem.getInstance();
|
||||
|
||||
IProperty property = mavenPropertiesVirtualFileSystem.findSystemProperty(myProject, myText);
|
||||
if (property != null) return property.getPsiElement();
|
||||
|
||||
if (myText.startsWith("env.")) {
|
||||
property = MavenDomUtil.findProperty(myProject, MavenPropertiesVirtualFileSystem.ENV_PROPERTIES_FILE,
|
||||
myText.substring("env.".length()));
|
||||
property = mavenPropertiesVirtualFileSystem.findEnvProperty(myProject, myText.substring("env.".length()));
|
||||
if (property != null) return property.getPsiElement();
|
||||
}
|
||||
|
||||
String textWithEnv = "env." + myText;
|
||||
|
||||
property = MavenDomUtil.findProperty(myProject, MavenPropertiesVirtualFileSystem.SYSTEM_PROPERTIES_FILE, textWithEnv);
|
||||
property = mavenPropertiesVirtualFileSystem.findSystemProperty(myProject, textWithEnv);
|
||||
if (property != null) return property.getPsiElement();
|
||||
|
||||
property = MavenDomUtil.findProperty(myProject, MavenPropertiesVirtualFileSystem.ENV_PROPERTIES_FILE, textWithEnv);
|
||||
property = mavenPropertiesVirtualFileSystem.findEnvProperty(myProject, textWithEnv);
|
||||
if (property != null) return property.getPsiElement();
|
||||
|
||||
if (!hasPrefix) {
|
||||
@@ -390,7 +391,8 @@ public class MavenPropertyPsiReference extends MavenPsiReference {
|
||||
}
|
||||
|
||||
private void collectSystemEnvProperties(String propertiesFileName, @Nullable String prefix, List<Object> result) {
|
||||
PropertiesFile file = MavenDomUtil.getPropertiesFile(myProject, propertiesFileName);
|
||||
VirtualFile virtualFile = MavenPropertiesVirtualFileSystem.getInstance().findFileByPath(propertiesFileName);
|
||||
PropertiesFile file = MavenDomUtil.getPropertiesFile(myProject, virtualFile);
|
||||
collectPropertiesFileVariants(file, prefix, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -203,29 +203,6 @@ public class MavenUtil {
|
||||
Notifications.Bus.notify(new Notification(MAVEN_NOTIFICATION_GROUP, title, e.getMessage(), NotificationType.ERROR), project);
|
||||
}
|
||||
|
||||
public static Properties getSystemProperties() {
|
||||
Properties result = (Properties)System.getProperties().clone();
|
||||
for (String each : new THashSet<String>((Set)result.keySet())) {
|
||||
if (each.startsWith("idea.")) {
|
||||
result.remove(each);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Properties getEnvProperties() {
|
||||
Properties reuslt = new Properties();
|
||||
for (Map.Entry<String, String> each : System.getenv().entrySet()) {
|
||||
if (isMagicalProperty(each.getKey())) continue;
|
||||
reuslt.put(each.getKey(), each.getValue());
|
||||
}
|
||||
return reuslt;
|
||||
}
|
||||
|
||||
private static boolean isMagicalProperty(String key) {
|
||||
return key.startsWith("=");
|
||||
}
|
||||
|
||||
public static File getPluginSystemDir(String folder) {
|
||||
// PathManager.getSystemPath() may return relative path
|
||||
return new File(PathManager.getSystemPath(), "Maven" + "/" + folder).getAbsoluteFile();
|
||||
|
||||
+56
-14
@@ -15,16 +15,19 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.vfs;
|
||||
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.vfs.ex.dummy.DummyFileSystem;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.utils.MavenUtil;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomUtil;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public class MavenPropertiesVirtualFileSystem extends DummyFileSystem {
|
||||
@NonNls public static final String PROTOCOL = "maven-properties";
|
||||
@@ -34,7 +37,8 @@ public class MavenPropertiesVirtualFileSystem extends DummyFileSystem {
|
||||
|
||||
public static final String[] PROPERTIES_FILES = new String[]{SYSTEM_PROPERTIES_FILE, ENV_PROPERTIES_FILE};
|
||||
|
||||
private final Map<String, VirtualFile> myFiles = new THashMap<String, VirtualFile>();
|
||||
private VirtualFile mySystemPropertiesFile;
|
||||
private VirtualFile myEnvPropertiesFile;
|
||||
|
||||
public static MavenPropertiesVirtualFileSystem getInstance() {
|
||||
return (MavenPropertiesVirtualFileSystem)VirtualFileManager.getInstance().getFileSystem(PROTOCOL);
|
||||
@@ -45,27 +49,65 @@ public class MavenPropertiesVirtualFileSystem extends DummyFileSystem {
|
||||
return PROTOCOL;
|
||||
}
|
||||
|
||||
public VirtualFile getSystemPropertiesFile() {
|
||||
if (mySystemPropertiesFile == null) {
|
||||
Properties systemProperties = new Properties();
|
||||
|
||||
for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) {
|
||||
if (entry.getKey() instanceof String && entry.getValue() instanceof String) {
|
||||
String key = (String)entry.getKey();
|
||||
if (!key.startsWith("idea.")) {
|
||||
systemProperties.setProperty(key, (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mySystemPropertiesFile = new MavenPropertiesVirtualFile(SYSTEM_PROPERTIES_FILE, systemProperties, this);
|
||||
}
|
||||
|
||||
return mySystemPropertiesFile;
|
||||
}
|
||||
|
||||
public VirtualFile getEnvPropertiesFile() {
|
||||
if (myEnvPropertiesFile == null) {
|
||||
Properties envProperties = new Properties();
|
||||
|
||||
for (Map.Entry<String, String> each : System.getenv().entrySet()) {
|
||||
if (each.getKey().startsWith("=")) continue;
|
||||
envProperties.setProperty(each.getKey(), SystemInfo.isWindows ? each.getValue().toUpperCase() : each.getValue());
|
||||
}
|
||||
|
||||
myEnvPropertiesFile = new MavenPropertiesVirtualFile(ENV_PROPERTIES_FILE, envProperties, this);
|
||||
}
|
||||
|
||||
return myEnvPropertiesFile;
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public boolean isPhysical() {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
public synchronized VirtualFile findFileByPath(@NotNull @NonNls String path) {
|
||||
VirtualFile result = myFiles.get(path);
|
||||
if (result != null) return result;
|
||||
|
||||
result = createFile(path);
|
||||
if (result != null) {
|
||||
myFiles.put(path, result);
|
||||
if (path.equals(SYSTEM_PROPERTIES_FILE)) {
|
||||
return getSystemPropertiesFile();
|
||||
}
|
||||
return result;
|
||||
|
||||
if (path.equals(ENV_PROPERTIES_FILE)) {
|
||||
return getEnvPropertiesFile();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private VirtualFile createFile(String path) {
|
||||
if (SYSTEM_PROPERTIES_FILE.equals(path)) return new MavenPropertiesVirtualFile(path, MavenUtil.getSystemProperties(), this);
|
||||
if (ENV_PROPERTIES_FILE.equals(path)) return new MavenPropertiesVirtualFile(path, MavenUtil.getEnvProperties(), this);
|
||||
return null;
|
||||
public IProperty findSystemProperty(Project project, @NotNull String propertyName) {
|
||||
return MavenDomUtil.findProperty(project, getSystemPropertiesFile(), propertyName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IProperty findEnvProperty(Project project, @NotNull String propertyName) {
|
||||
return MavenDomUtil.findProperty(project, getEnvPropertiesFile(), propertyName);
|
||||
}
|
||||
|
||||
//protected void deleteFile(Object requestor, VirtualFile vFile) throws IOException {
|
||||
|
||||
+46
-6
@@ -15,9 +15,13 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.dom;
|
||||
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProfiles;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProfilesModel;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomSettingsModel;
|
||||
@@ -689,9 +693,7 @@ public class MavenPropertyCompletionAndResolutionTest extends MavenDomTestCase {
|
||||
|
||||
"<name>${<caret>user.home}</name>");
|
||||
|
||||
assertResolved(myProjectPom, MavenDomUtil.findProperty(myProject,
|
||||
MavenPropertiesVirtualFileSystem.SYSTEM_PROPERTIES_FILE,
|
||||
"user.home").getPsiElement());
|
||||
assertResolved(myProjectPom, MavenPropertiesVirtualFileSystem.getInstance().findSystemProperty(myProject, "user.home").getPsiElement());
|
||||
}
|
||||
|
||||
public void testEnvProperties() throws Exception {
|
||||
@@ -701,9 +703,47 @@ public class MavenPropertyCompletionAndResolutionTest extends MavenDomTestCase {
|
||||
|
||||
"<name>${<caret>env." + getEnvVar() + "}</name>");
|
||||
|
||||
assertResolved(myProjectPom, MavenDomUtil.findProperty(myProject,
|
||||
MavenPropertiesVirtualFileSystem.ENV_PROPERTIES_FILE,
|
||||
getEnvVar()).getPsiElement());
|
||||
assertResolved(myProjectPom, MavenPropertiesVirtualFileSystem.getInstance().findEnvProperty(myProject, getEnvVar()).getPsiElement());
|
||||
}
|
||||
|
||||
public void testUpperCaseEnvPropertiesOnWindows() throws Exception {
|
||||
if (!SystemInfo.isWindows) return;
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<name>${<caret>env.PATH}</name>");
|
||||
|
||||
PsiReference ref = getReferenceAtCaret(myProjectPom);
|
||||
assertNotNull(ref);
|
||||
|
||||
PsiElement resolved = ref.resolve();
|
||||
assertEquals(System.getenv("Path"), ((IProperty)resolved).getValue());
|
||||
}
|
||||
|
||||
public void testCaseInsencitiveOnWindows() throws Exception {
|
||||
if (!SystemInfo.isWindows) return;
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<name>${<caret>env.PaTH}</name>");
|
||||
|
||||
assertUnresolved(myProjectPom);
|
||||
}
|
||||
|
||||
public void testNotUpperCaseEnvPropertiesOnWindows() throws Exception {
|
||||
if (!SystemInfo.isWindows) return;
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<name>${<caret>env.Path}</name>");
|
||||
|
||||
assertUnresolved(myProjectPom);
|
||||
}
|
||||
|
||||
public void testHighlightUnresolvedProperties() throws Exception {
|
||||
|
||||
+1
-1
@@ -1294,7 +1294,7 @@ public class MavenProjectReaderTest extends MavenTestCase {
|
||||
}
|
||||
|
||||
public void testActivatingProfilesByEnvProperty() throws Exception {
|
||||
String value = MavenUtil.getEnvProperties().getProperty(getEnvVar());
|
||||
String value = System.getenv(getEnvVar());
|
||||
|
||||
createProjectPom("<profiles>" +
|
||||
" <profile>" +
|
||||
|
||||
@@ -34,7 +34,7 @@ public class XmlFileTypeFactory extends FileTypeFactory {
|
||||
consumer.consume(XHtmlFileType.INSTANCE, "xhtml");
|
||||
consumer.consume(DTDFileType.INSTANCE, "dtd;ent;mod;elt");
|
||||
|
||||
consumer.consume(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng");
|
||||
consumer.consume(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");
|
||||
TypedHandler.registerBaseLanguageQuoteHandler(XMLLanguage.class, TypedHandler.getQuoteHandlerForType(XmlFileType.INSTANCE));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user