mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
@@ -162,10 +162,17 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
public final void addCompiler(@NotNull Compiler compiler) {
|
||||
if (compiler instanceof TranslatingCompiler) {
|
||||
myTranslators.add((TranslatingCompiler)compiler);
|
||||
|
||||
}
|
||||
else {
|
||||
myCompilers.add(compiler);
|
||||
// supporting file instrumenting compilers and validators for external build
|
||||
// Since these compilers are IDE-specific and use PSI, it is ok to run them before and after the build in the IDE
|
||||
if (compiler instanceof SourceInstrumentingCompiler) {
|
||||
addBeforeTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler));
|
||||
}
|
||||
else if (compiler instanceof Validator) {
|
||||
addAfterTask(new FileProcessingCompilerAdapterTask((FileProcessingCompiler)compiler));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +181,16 @@ public class CompilerManagerImpl extends CompilerManager {
|
||||
myTranslators.remove(compiler);
|
||||
}
|
||||
else {
|
||||
myCompilers.remove(compiler);
|
||||
if (myCompilers.remove(compiler)) {
|
||||
for (List<CompileTask> tasks : Arrays.asList(myBeforeTasks, myAfterTasks)) {
|
||||
for (Iterator<CompileTask> iterator = tasks.iterator(); iterator.hasNext(); ) {
|
||||
CompileTask task = iterator.next();
|
||||
if (task instanceof FileProcessingCompilerAdapterTask && ((FileProcessingCompilerAdapterTask)task).getCompiler() == compiler) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myCompilerToInputTypes.remove(compiler);
|
||||
myCompilerToOutputTypes.remove(compiler);
|
||||
|
||||
+12
-7
@@ -13,12 +13,9 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.uiDesigner.make;
|
||||
package com.intellij.compiler.impl;
|
||||
|
||||
import com.intellij.compiler.CompilerWorkspaceConfiguration;
|
||||
import com.intellij.compiler.impl.CompilerCacheManager;
|
||||
import com.intellij.compiler.impl.CompilerUtil;
|
||||
import com.intellij.compiler.impl.FileProcessingCompilerStateCache;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
@@ -33,14 +30,22 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is an adapter for Form2SourceCompiler to CompileTask interface
|
||||
* This is an adapter for running any FileProcessingCompiler as a compiler task
|
||||
*
|
||||
*
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 9/5/12
|
||||
*/
|
||||
public class SourceInstrumentationTask implements CompileTask{
|
||||
private final Form2SourceCompiler myCompiler = new Form2SourceCompiler();
|
||||
public class FileProcessingCompilerAdapterTask implements CompileTask{
|
||||
private final FileProcessingCompiler myCompiler;
|
||||
|
||||
public FileProcessingCompilerAdapterTask(FileProcessingCompiler compiler) {
|
||||
myCompiler = compiler;
|
||||
}
|
||||
|
||||
public FileProcessingCompiler getCompiler() {
|
||||
return myCompiler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(CompileContext context) {
|
||||
+23
@@ -1395,5 +1395,28 @@ public class GenericsHighlightUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* http://docs.oracle.com/javase/specs/jls/se7/html/jls-4.html#jls-4.8
|
||||
*/
|
||||
@Nullable
|
||||
public static HighlightInfo checkRawOnParameterizedType(PsiReferenceParameterList list) {
|
||||
if (list.getTypeArguments().length > 0) return null;
|
||||
final PsiElement parent = list.getParent();
|
||||
if (parent instanceof PsiJavaCodeReferenceElement) {
|
||||
final PsiElement qualifier = ((PsiJavaCodeReferenceElement)parent).getQualifier();
|
||||
if (qualifier instanceof PsiJavaCodeReferenceElement) {
|
||||
if (((PsiJavaCodeReferenceElement)qualifier).getTypeParameters().length > 0) {
|
||||
final PsiElement resolve = ((PsiJavaCodeReferenceElement)parent).resolve();
|
||||
if (resolve instanceof PsiTypeParameterListOwner
|
||||
&& ((PsiTypeParameterListOwner)resolve).hasTypeParameters()
|
||||
&& !((PsiTypeParameterListOwner)resolve).hasModifierProperty(PsiModifier.STATIC)) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, parent, "Improper formed type; some type parameters are missing");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -1014,6 +1014,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
|
||||
public void visitReferenceParameterList(PsiReferenceParameterList list) {
|
||||
myHolder.add(GenericsHighlightUtil.checkParametersAllowed(list));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkParametersOnRaw(list));
|
||||
if (!myHolder.hasErrorResults()) myHolder.add(GenericsHighlightUtil.checkRawOnParameterizedType(list));
|
||||
}
|
||||
|
||||
@Override public void visitReturnStatement(PsiReturnStatement statement) {
|
||||
|
||||
-6
@@ -27,10 +27,4 @@ public abstract class GenerateGetterSetterBaseAction extends BaseGenerateAction
|
||||
public GenerateGetterSetterBaseAction(GenerateGetterSetterHandlerBase handler) {
|
||||
super(handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidForClass(PsiClass targetClass) {
|
||||
final GenerateGetterSetterHandlerBase handler = (GenerateGetterSetterHandlerBase)getHandler();
|
||||
return handler.canBeAppliedTo(targetClass);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.intellij.refactoring.move.moveClassesOrPackages;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.ide.util.DirectoryChooser;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
@@ -26,6 +24,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.ui.ComboBoxWithWidePopup;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
@@ -37,6 +36,7 @@ import com.intellij.ui.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.*;
|
||||
@@ -253,6 +253,14 @@ public abstract class DestinationFolderComboBox extends ComboboxWithBrowseButton
|
||||
}
|
||||
});
|
||||
comboBox.setModel(new CollectionComboBoxModel(items, selection));
|
||||
|
||||
final Component root = SwingUtilities.getRoot(comboBox);
|
||||
if (root instanceof Window) {
|
||||
final Dimension preferredSize = root.getPreferredSize();
|
||||
if (preferredSize.getWidth() > root.getSize().getWidth()) {
|
||||
root.setSize(preferredSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
class GenericOuter<T> {
|
||||
public class GenericInner<U> {
|
||||
}
|
||||
|
||||
public static class StaticGenericInner<U> {
|
||||
}
|
||||
|
||||
public class SimpleInner {
|
||||
}
|
||||
}
|
||||
|
||||
class OuterClient {
|
||||
public void context() {
|
||||
<error descr="Improper formed type; some type parameters are missing">GenericOuter<String>.GenericInner</error> v1 = null;
|
||||
GenericOuter.GenericInner<error descr="Type arguments given on a raw type"><String></error> v2 = null;
|
||||
GenericOuter.GenericInner v3 = null;
|
||||
GenericOuter<String>.GenericInner<String> v4 = null;
|
||||
|
||||
GenericOuter<error descr="Cannot select static class 'GenericOuter.StaticGenericInner' from parameterized type"><String></error>.StaticGenericInner sv1 = null;
|
||||
GenericOuter.StaticGenericInner<String> sv2 = null;
|
||||
GenericOuter.StaticGenericInner sv3 = null;
|
||||
GenericOuter<error descr="Cannot select static class 'GenericOuter.StaticGenericInner' from parameterized type"><String></error>.StaticGenericInner<String> sv4 = null;
|
||||
|
||||
GenericOuter<String>.SimpleInner iv1 = null;
|
||||
GenericOuter.SimpleInner<error descr="Type arguments given on a raw type"><String></error> iv2 = null;
|
||||
GenericOuter.SimpleInner iv3 = null;
|
||||
GenericOuter<String>.SimpleInner<error descr="Type 'GenericOuter.SimpleInner' does not have type parameters"><String></error> iv4 = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
class B extends A {
|
||||
void n<caret>(C c){
|
||||
m();
|
||||
}
|
||||
}
|
||||
|
||||
class A {
|
||||
void m(){}
|
||||
}
|
||||
|
||||
class C {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
class A {
|
||||
void m(){}
|
||||
}
|
||||
|
||||
class C {
|
||||
void n(B b){
|
||||
b.m();
|
||||
}
|
||||
}
|
||||
@@ -194,6 +194,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
|
||||
public void testDifferentTypeParamsInOverloadedMethods() throws Exception { doTest(true); }
|
||||
public void testIDEA91626() throws Exception { doTest(true); }
|
||||
public void testIDEA92022() throws Exception { doTest(false); }
|
||||
public void testRawOnParameterized() throws Exception { doTest(false); }
|
||||
|
||||
public void testJavaUtilCollections_NoVerify() throws Exception {
|
||||
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
|
||||
|
||||
+22
@@ -16,10 +16,12 @@
|
||||
package com.intellij.psi.codeStyle.arrangement
|
||||
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier
|
||||
import com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType
|
||||
import org.junit.Before
|
||||
|
||||
import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.PROTECTED
|
||||
import static com.intellij.psi.codeStyle.arrangement.match.ArrangementModifier.PUBLIC
|
||||
import static com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType.BY_NAME
|
||||
|
||||
/**
|
||||
* @author Denis Zhdanov
|
||||
@@ -69,4 +71,24 @@ class Test {
|
||||
rules: [rule("get.*", PUBLIC), rule(PROTECTED)]
|
||||
)
|
||||
}
|
||||
|
||||
void "test name and sort"() {
|
||||
doTest(
|
||||
initial: '''\
|
||||
class Test {
|
||||
private void getC() {}
|
||||
public void test() {}
|
||||
public void getA() {}
|
||||
public void getB() {}
|
||||
}''',
|
||||
expected: '''\
|
||||
class Test {
|
||||
public void getA() {}
|
||||
public void getB() {}
|
||||
private void getC() {}
|
||||
public void test() {}
|
||||
}''',
|
||||
rules: [rule(BY_NAME, "get.*")]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -56,6 +56,7 @@ public class MoveInstanceMethodTest extends LightRefactoringTestCase {
|
||||
public void testThisInAnonymous() throws Exception { doTest(true, 0); }
|
||||
|
||||
public void testOverloadingMethods() throws Exception { doTest(true, 0); }
|
||||
public void testOverloadingMethods1() throws Exception { doTest(true, 0); }
|
||||
|
||||
public void testPolyadicExpr() throws Exception { doTest(true, 0); }
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.jetbrains.jps.indices.impl;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.SystemInfoRt;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.jps.indices.IgnoredFileIndex;
|
||||
import org.jetbrains.jps.model.JpsModel;
|
||||
@@ -30,7 +29,7 @@ public class IgnoredFileIndexImpl implements IgnoredFileIndex {
|
||||
String pattern = tokenizer.nextToken();
|
||||
if (!StringUtil.isEmptyOrSpaces(pattern)) {
|
||||
try {
|
||||
myPatterns.add(Pattern.compile(convertToJavaPattern(pattern), SystemInfoRt.isFileSystemCaseSensitive? 0 : Pattern.CASE_INSENSITIVE));
|
||||
myPatterns.add(Pattern.compile(convertToJavaPattern(pattern)));
|
||||
}
|
||||
catch (PatternSyntaxException e) {
|
||||
LOG.info("Cannot load ignored file pattern " + pattern, e);
|
||||
|
||||
+1
-1
@@ -121,7 +121,7 @@ public class DefaultArrangementSettingsSerializer implements ArrangementSettings
|
||||
return null;
|
||||
}
|
||||
|
||||
Element orderTypeElement = element.getChild(ORDER_TYPE_ELEMENT_NAME);
|
||||
Element orderTypeElement = ruleElement.getChild(ORDER_TYPE_ELEMENT_NAME);
|
||||
ArrangementEntryOrderType orderType = ArrangementMatchRule.DEFAULT_ORDER_TYPE;
|
||||
if (orderTypeElement != null) {
|
||||
try {
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ public class ArrangementSettingsSerializationTest {
|
||||
StdArrangementSettings settings = new StdArrangementSettings();
|
||||
settings.addGrouping(new ArrangementGroupingRule(ArrangementGroupingType.OVERRIDDEN_METHODS, ArrangementEntryOrderType.BY_NAME));
|
||||
ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(ArrangementSettingType.TYPE, ArrangementEntryType.FIELD);
|
||||
settings.addRule(new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), ArrangementEntryOrderType.KEEP));
|
||||
settings.addRule(new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), ArrangementEntryOrderType.BY_NAME));
|
||||
|
||||
Element holder = new Element("holder");
|
||||
ArrangementSettingsSerializer instance = DefaultArrangementSettingsSerializer.INSTANCE;
|
||||
|
||||
+48
-1
@@ -28,13 +28,17 @@ import com.intellij.psi.codeStyle.CodeStyleSettings;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.arrangement.ArrangementEntry;
|
||||
import com.intellij.psi.codeStyle.arrangement.ArrangementSettings;
|
||||
import com.intellij.psi.codeStyle.arrangement.NameAwareArrangementEntry;
|
||||
import com.intellij.psi.codeStyle.arrangement.Rearranger;
|
||||
import com.intellij.psi.codeStyle.arrangement.match.ArrangementMatchRule;
|
||||
import com.intellij.psi.codeStyle.arrangement.order.ArrangementEntryOrderType;
|
||||
import com.intellij.psi.codeStyle.arrangement.settings.ArrangementStandardSettingsAware;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -228,9 +232,11 @@ public class ArrangementEngine {
|
||||
}
|
||||
|
||||
Set<E> matched = new HashSet<E>();
|
||||
|
||||
|
||||
int startIndex;
|
||||
for (ArrangementMatchRule rule : rules) {
|
||||
matched.clear();
|
||||
startIndex = arranged.size();
|
||||
for (E entry : unprocessed) {
|
||||
if (entry.canBeMatched() && rule.getMatcher().isMatched(entry)) {
|
||||
arranged.add(entry);
|
||||
@@ -238,6 +244,11 @@ public class ArrangementEngine {
|
||||
}
|
||||
}
|
||||
unprocessed.removeAll(matched);
|
||||
|
||||
// Sort by name if necessary.
|
||||
if (rule.getOrderType() == ArrangementEntryOrderType.BY_NAME) {
|
||||
sortByName(arranged, startIndex);
|
||||
}
|
||||
}
|
||||
arranged.addAll(unprocessed);
|
||||
|
||||
@@ -256,6 +267,42 @@ public class ArrangementEngine {
|
||||
return arranged;
|
||||
}
|
||||
|
||||
private static <E extends ArrangementEntry> void sortByName(@NotNull List<E> entries, int startIndex) {
|
||||
int entriesToSortNumber = entries.size() - startIndex;
|
||||
if (entriesToSortNumber < 2) {
|
||||
return;
|
||||
}
|
||||
List<E> buffer = new ArrayList<E>(entriesToSortNumber);
|
||||
List<E> subList = entries.subList(startIndex, entries.size());
|
||||
buffer.addAll(subList);
|
||||
final TObjectIntHashMap<E> weights = new TObjectIntHashMap<E>();
|
||||
int i = 0;
|
||||
for (E e : buffer) {
|
||||
weights.put(e, ++i);
|
||||
}
|
||||
ContainerUtil.sort(buffer, new Comparator<E>() {
|
||||
@Override
|
||||
public int compare(E e1, E e2) {
|
||||
String name1 = e1 instanceof NameAwareArrangementEntry ? ((NameAwareArrangementEntry)e1).getName() : null;
|
||||
String name2 = e2 instanceof NameAwareArrangementEntry ? ((NameAwareArrangementEntry)e2).getName() : null;
|
||||
if (name1 != null && name2 != null) {
|
||||
return name1.compareTo(name2);
|
||||
}
|
||||
else if (name1 == null && name2 == null) {
|
||||
return weights.get(e1) - weights.get(e2);
|
||||
}
|
||||
else if (name2 == null) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
subList.clear();
|
||||
entries.addAll(buffer);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <E extends ArrangementEntry> void doArrange(@NotNull List<ArrangementEntryWrapper<E>> wrappers,
|
||||
@NotNull Context<E> context) {
|
||||
|
||||
@@ -181,21 +181,25 @@ public class SearchUtil {
|
||||
final GlassPanel glassPanel) {
|
||||
return new Runnable() {
|
||||
public void run() {
|
||||
if (!SearchUtil.traverseComponentsTree(configurable, glassPanel, component, option, true)) {
|
||||
SearchUtil.traverseComponentsTree(configurable, glassPanel, component, option, false);
|
||||
if (!traverseComponentsTree(configurable, glassPanel, component, option, true)) {
|
||||
traverseComponentsTree(configurable, glassPanel, component, option, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static int getSelection(String tabIdx, final JTabbedPane tabbedPane) {
|
||||
private static int getSelection(String tabIdx, final JTabbedPane tabbedPane) {
|
||||
SearchableOptionsRegistrar searchableOptionsRegistrar = SearchableOptionsRegistrar.getInstance();
|
||||
for (int i = 0; i < tabbedPane.getTabCount(); i++) {
|
||||
final Set<String> pathWords = searchableOptionsRegistrar.getProcessedWords(tabIdx);
|
||||
final String title = tabbedPane.getTitleAt(i);
|
||||
final Set<String> titleWords = searchableOptionsRegistrar.getProcessedWords(title);
|
||||
pathWords.removeAll(titleWords);
|
||||
if (pathWords.isEmpty()) return i;
|
||||
if (!pathWords.isEmpty()) {
|
||||
final Set<String> titleWords = searchableOptionsRegistrar.getProcessedWords(title);
|
||||
pathWords.removeAll(titleWords);
|
||||
if (pathWords.isEmpty()) return i;
|
||||
} else if (tabIdx.equalsIgnoreCase(title)) { //e.g. only stop words
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -252,7 +256,7 @@ public class SearchUtil {
|
||||
}
|
||||
else if (rootComponent instanceof JTabbedPane) {
|
||||
final JTabbedPane tabbedPane = (JTabbedPane)rootComponent;
|
||||
final String path = SearchableOptionsRegistrarImpl.getInstance().getInnerPath(configurable, option);
|
||||
final String path = SearchableOptionsRegistrar.getInstance().getInnerPath(configurable, option);
|
||||
if (path != null) {
|
||||
final int index = getSelection(path, tabbedPane);
|
||||
if (index > -1 && index < tabbedPane.getTabCount()) {
|
||||
@@ -318,7 +322,7 @@ public class SearchUtil {
|
||||
final boolean forceSelect) {
|
||||
return new Runnable() {
|
||||
public void run() {
|
||||
SearchUtil.traverseComponentsTree(configurable, glassPanel, component, option, forceSelect);
|
||||
traverseComponentsTree(configurable, glassPanel, component, option, forceSelect);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -365,7 +369,7 @@ public class SearchUtil {
|
||||
String cur = "";
|
||||
final String s = textToMarkup.toLowerCase();
|
||||
for (String part : filter.split(" ")) {
|
||||
if (s.indexOf(part) != -1) {
|
||||
if (s.contains(part)) {
|
||||
cur += "\"" + part + "\" ";
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public class PresentationFactory {
|
||||
|
||||
public final Presentation getPresentation(@NotNull AnAction action){
|
||||
Presentation presentation = myAction2Presentation.get(action);
|
||||
if (presentation == null){
|
||||
if (presentation == null || !action.isDefaultIcon()){
|
||||
presentation = action.getTemplatePresentation().clone();
|
||||
myAction2Presentation.put(action, processPresentation(presentation));
|
||||
}
|
||||
|
||||
+6
-1
@@ -70,6 +70,11 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull Object ... conditions) {
|
||||
rule(ArrangementEntryOrderType.KEEP, conditions)
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected static StdArrangementMatchRule rule(@NotNull ArrangementEntryOrderType orderType, @NotNull Object ... conditions) {
|
||||
def condition
|
||||
if (conditions.length == 1) {
|
||||
condition = atom(conditions[0])
|
||||
@@ -78,7 +83,7 @@ abstract class AbstractRearrangerTest extends LightPlatformCodeInsightFixtureTes
|
||||
condition = ArrangementUtil.combine(conditions.collect { atom(it) } as ArrangementMatchCondition[])
|
||||
}
|
||||
|
||||
new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition))
|
||||
new StdArrangementMatchRule(new StdArrangementEntryMatcher(condition), orderType)
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+27
-17
@@ -23,6 +23,7 @@ import com.intellij.openapi.fileEditor.impl.EditorHistoryManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.startup.StartupManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -31,10 +32,13 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class AndroidSelectedFileEditorProvider implements SelectedFileEditorProvider {
|
||||
private static final String KEY = "AndroidLayoutSelectedEditor";
|
||||
private static VirtualFile myCurrentOpenedFile;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public FileEditorProvider getSelectedProvider(Project project, VirtualFile openedFile) {
|
||||
myCurrentOpenedFile = null;
|
||||
|
||||
if (!AndroidDesignerEditorProvider.acceptLayout(project, openedFile)) {
|
||||
return null;
|
||||
}
|
||||
@@ -58,27 +62,33 @@ public class AndroidSelectedFileEditorProvider implements SelectedFileEditorProv
|
||||
public void projectOpened() {
|
||||
StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() {
|
||||
public void run() {
|
||||
myProject.getMessageBus().connect(myProject)
|
||||
.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
|
||||
@Override
|
||||
public void fileOpened(FileEditorManager source, VirtualFile file) {
|
||||
}
|
||||
MessageBusConnection connection = myProject.getMessageBus().connect(myProject);
|
||||
connection.subscribe(FileEditorManagerListener.Before.FILE_EDITOR_MANAGER, new FileEditorManagerListener.Before.Adapter() {
|
||||
@Override
|
||||
public void beforeFileOpened(FileEditorManager source, VirtualFile file) {
|
||||
myCurrentOpenedFile = file;
|
||||
}
|
||||
});
|
||||
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() {
|
||||
@Override
|
||||
public void fileOpened(FileEditorManager source, VirtualFile file) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileClosed(FileEditorManager source, VirtualFile file) {
|
||||
}
|
||||
@Override
|
||||
public void fileClosed(FileEditorManager source, VirtualFile file) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectionChanged(FileEditorManagerEvent event) {
|
||||
VirtualFile file = event.getNewFile();
|
||||
if (file != null && AndroidDesignerEditorProvider.acceptLayout(myProject, file)) {
|
||||
FileEditorProvider provider = EditorHistoryManager.getInstance(myProject).getSelectedProvider(file);
|
||||
if (provider != null) {
|
||||
PropertiesComponent.getInstance(myProject).setValue(KEY, provider.getEditorTypeId());
|
||||
}
|
||||
@Override
|
||||
public void selectionChanged(FileEditorManagerEvent event) {
|
||||
VirtualFile file = event.getNewFile();
|
||||
if (file != null && AndroidDesignerEditorProvider.acceptLayout(myProject, file)) {
|
||||
FileEditorProvider provider = EditorHistoryManager.getInstance(myProject).getSelectedProvider(file);
|
||||
if (provider != null && file != myCurrentOpenedFile) {
|
||||
PropertiesComponent.getInstance(myProject).setValue(KEY, provider.getEditorTypeId());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-3
@@ -18,7 +18,6 @@ package com.intellij.uiDesigner.propertyInspector;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
@@ -40,7 +39,6 @@ import com.intellij.uiDesigner.componentTree.ComponentTree;
|
||||
import com.intellij.uiDesigner.componentTree.ComponentTreeBuilder;
|
||||
import com.intellij.uiDesigner.designSurface.GuiEditor;
|
||||
import com.intellij.uiDesigner.editor.UIFormEditor;
|
||||
import com.intellij.uiDesigner.make.SourceInstrumentationTask;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.Update;
|
||||
import icons.UIDesignerIcons;
|
||||
@@ -82,7 +80,6 @@ public class UIDesignerToolWindowManager implements ProjectComponent {
|
||||
StartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable() {
|
||||
public void run() {
|
||||
myToolWindowReady = true;
|
||||
CompilerManager.getInstance(myProject).addBeforeTask(new SourceInstrumentationTask());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user