diff --git a/platform/lang-api/src/com/intellij/codeInsight/intention/PsiElementBaseIntentionAction.java b/platform/lang-api/src/com/intellij/codeInsight/intention/PsiElementBaseIntentionAction.java index 9efc76f78cf2..d6e62c9bac38 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/intention/PsiElementBaseIntentionAction.java +++ b/platform/lang-api/src/com/intellij/codeInsight/intention/PsiElementBaseIntentionAction.java @@ -56,6 +56,7 @@ public abstract class PsiElementBaseIntentionAction extends BaseIntentionAction @Override public final boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { + if (file == null) return false; final PsiManager manager = file.getManager(); if (manager == null) return false; if (!manager.isInProject(file)) return false; diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java index 2b313d131512..f775685995ef 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -124,7 +124,8 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD show(); if (myChosenFiles.length > 0) { callback.consume(Arrays.asList(myChosenFiles)); - } else if (callback instanceof FileChooser.FileChooserConsumer){ + } + else if (callback instanceof FileChooser.FileChooserConsumer) { ((FileChooser.FileChooserConsumer)callback).cancelled(); } } @@ -357,13 +358,21 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD myFileSystemTree.registerMouseListener(group); } + @Nullable private VirtualFile[] getSelectedFilesInt() { if (myTreeIsUpdating || !myUiUpdater.isEmpty()) { - if (!isTextFieldActive() || StringUtil.isEmpty(myPathTextField.getTextFieldText())) - return VirtualFile.EMPTY_ARRAY; - final LocalFsFinder.VfsFile toFind = (LocalFsFinder.VfsFile)myPathTextField.getFile(); - return toFind == null || !toFind.exists() ? VirtualFile.EMPTY_ARRAY : new VirtualFile[]{toFind.getFile()}; + if (isTextFieldActive() && !StringUtil.isEmpty(myPathTextField.getTextFieldText())) { + LookupFile toFind = myPathTextField.getFile(); + if (toFind instanceof LocalFsFinder.VfsFile && toFind.exists()) { + VirtualFile file = ((LocalFsFinder.VfsFile)toFind).getFile(); + if (file != null) { + return new VirtualFile[]{file}; + } + } + } + return VirtualFile.EMPTY_ARRAY; } + final List selectedFiles = Arrays.asList(myFileSystemTree.getSelectedFiles()); return VfsUtilCore.toVirtualFileArray(FileChooserUtil.getChosenFiles(myChooserDescriptor, selectedFiles)); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java index 33498fbf29c4..81dacf7d3de8 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/FileWatcher.java @@ -44,6 +44,7 @@ import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import static com.intellij.util.containers.ContainerUtil.*; @@ -83,6 +84,7 @@ public class FileWatcher { private final ManagingFS myManagingFS; private final File myExecutable; + private final AtomicBoolean myInitialized = new AtomicBoolean(false); private volatile MyProcessHandler myProcessHandler; private volatile int myStartAttemptCount = 0; private volatile boolean myIsShuttingDown = false; @@ -101,12 +103,21 @@ public class FileWatcher { myExecutable = getExecutable(); if (disabled) { + myInitialized.set(true); LOG.info("Native file watcher is disabled"); } else if (myExecutable == null) { + myInitialized.set(true); LOG.info("Native file watcher is not supported on this platform"); } - else if (!myExecutable.exists()) { + } + + private void init() { + if (!myInitialized.compareAndSet(false, true)) { + return; + } + + if (!myExecutable.exists()) { notifyOnFailure(ApplicationBundle.message("watcher.exe.not.found"), null); } else if (!myExecutable.canExecute()) { @@ -244,7 +255,7 @@ public class FileWatcher { } public boolean isOperational() { - return myProcessHandler != null; + return !myInitialized.get() || myProcessHandler != null; } public boolean isSettingRoots() { @@ -280,6 +291,7 @@ public class FileWatcher { } public void setWatchRoots(final List recursive, final List flat) { + init(); setWatchRoots(recursive, flat, false); } @@ -309,8 +321,7 @@ public class FileWatcher { writeLine("#"); } catch (IOException e) { - LOG.error(e); - shutdownProcess(); + LOG.warn(e); } myRecursiveWatchRoots = recursive; diff --git a/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java b/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java index f9ca8c45599e..322e9cc8d973 100644 --- a/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java +++ b/platform/util/src/com/intellij/execution/process/BaseOSProcessHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 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. @@ -159,7 +159,7 @@ public class BaseOSProcessHandler extends ProcessHandler { myProcess.getOutputStream().close(); } catch (IOException e) { - LOG.error(e); + LOG.warn(e); } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacade.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacade.java index 9697de70d25f..3eebfbd53098 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacade.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacade.java @@ -29,12 +29,4 @@ public interface HgPlatformFacade extends DvcsPlatformFacade { @NotNull HgVcs getVcs(@NotNull Project project); - @NotNull - HgRepositoryManager getRepositoryManager(@NotNull Project project); - - //@NotNull - //HgProjectSettings getSettings(Project project); - // - //@NotNull - //HgCommandResultNotifier getNotificator(@NotNull Project project); } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacadeImpl.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacadeImpl.java index 0a3ac43e0c81..4a13cb4b4d45 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacadeImpl.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPlatformFacadeImpl.java @@ -25,12 +25,6 @@ import org.jetbrains.annotations.NotNull; */ public class HgPlatformFacadeImpl extends DvcsPlatformFacadeImpl implements HgPlatformFacade { - @NotNull - @Override - public HgRepositoryManager getRepositoryManager(@NotNull Project project) { - throw new UnsupportedOperationException(); - } - @NotNull @Override public HgVcs getVcs(@NotNull Project project) { diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgRepositoryManager.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgRepositoryManager.java deleted file mode 100644 index 6b2cff148afe..000000000000 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgRepositoryManager.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2013 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 org.zmlx.hg4idea; - -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -/** - * @author Nadya Zabrodina - */ -public interface HgRepositoryManager { - /** - * @return all repositories tracked by the manager. - */ - @NotNull - List getRepositories(); -} diff --git a/plugins/hg4idea/testSrc/hg4idea/test/HgExecutor.java b/plugins/hg4idea/testSrc/hg4idea/test/HgExecutor.java index b6785bcdb295..99a90cbd8d78 100644 --- a/plugins/hg4idea/testSrc/hg4idea/test/HgExecutor.java +++ b/plugins/hg4idea/testSrc/hg4idea/test/HgExecutor.java @@ -17,7 +17,6 @@ package hg4idea.test; import com.intellij.dvcs.test.Executor; import com.intellij.openapi.util.text.StringUtil; -import org.zmlx.hg4idea.provider.HgRepositoryLocation; import java.util.Arrays; import java.util.List; @@ -25,7 +24,7 @@ import java.util.List; /** * @author Nadya Zabrodina */ -class HgExecutor extends Executor { +public class HgExecutor extends Executor { private static final String HG_EXECUTABLE_ENV = "IDEA_TEST_HG_EXECUTABLE"; //private static final String TEAMCITY_HG_EXECUTABLE_ENV = "TEAMCITY_HG_PATH"; //todo var for server testing @@ -37,31 +36,18 @@ class HgExecutor extends Executor { return findExecutable("hg", "hg", "hg.exe", Arrays.asList(HG_EXECUTABLE_ENV)); } - public String hg(String command) { + public static String hg(String command) { printVersionTheFirstTime(); List split = StringUtil.split(command, " "); split.add(0, HG_EXECUTABLE); log("hg " + command); - for (int attempt = 0; attempt < 3; attempt++) { - String stdout = run(split); - return stdout; + for(int attempt = 0; attempt < 3; attempt++) { + return run(split); } throw new RuntimeException("fatal error during execution of Hg command: " + command); } - - public String hg(HgRepositoryLocation repository, String command) { - if (repository != null) { - cd(repository); - } - return hg(command); - } - - public void cd(HgRepositoryLocation repository) { - cd(repository.getRoot().getPath()); - } - - private void printVersionTheFirstTime() { + private static void printVersionTheFirstTime() { if (!myVersionPrinted) { myVersionPrinted = true; hg("version"); diff --git a/plugins/hg4idea/testSrc/hg4idea/test/HgLightTest.java b/plugins/hg4idea/testSrc/hg4idea/test/HgLightTest.java index f8cd598b6bec..cf214a774e5c 100644 --- a/plugins/hg4idea/testSrc/hg4idea/test/HgLightTest.java +++ b/plugins/hg4idea/testSrc/hg4idea/test/HgLightTest.java @@ -15,6 +15,7 @@ */ package hg4idea.test; +import com.intellij.dvcs.test.Executor; import com.intellij.dvcs.test.MockProject; import com.intellij.dvcs.test.MockVirtualFile; import com.intellij.openapi.application.PluginPathManager; @@ -33,7 +34,7 @@ import static org.junit.Assume.assumeTrue; /** * @author Nadya Zabrodina */ -public class HgLightTest extends HgExecutor { +public class HgLightTest { //private static final String USER_NAME = "John Doe"; //private static final String USER_EMAIL = "John.Doe@example.com"; @@ -62,13 +63,14 @@ public class HgLightTest extends HgExecutor { catch (IOException e) { fail("Can not start test case!\n"); //todo change } - cd(myTestRoot); - myProjectRoot = mkdir("project"); + Executor.cd(myTestRoot); + myProjectRoot = Executor.mkdir("project"); myProject = new MockProject(myProjectRoot); myPlatformFacade = new HgTestPlatformFacade(); - cd(".hg"); + Executor.cd(".hg"); File pluginRoot = new File(PluginPathManager.getPluginHomePath("hg4idea")); - File hgrcFile = new File(new File(pluginRoot, "testData\\repo\\dot_hg"), "hgrc"); + String pathToHgrc = "testData\\repo\\dot_hg"; + File hgrcFile = new File(new File(pluginRoot, FileUtil.toSystemIndependentName(pathToHgrc)), "hgrc"); File hgrc = new File(new File(myProjectRoot, ".hg"), "hgrc"); try { FileUtil.copy(hgrcFile, hgrc); @@ -96,11 +98,11 @@ public class HgLightTest extends HgExecutor { return new MockVirtualFile(rootDir); } - private void initRepo(String repoRoot) { - cd(repoRoot); - hg("init"); - touch("file.txt"); - hg("add file.txt"); - hg("commit -m initial"); + private static void initRepo(String repoRoot) { + Executor.cd(repoRoot); + HgExecutor.hg("init"); + Executor.touch("file.txt"); + HgExecutor.hg("add file.txt"); + HgExecutor.hg("commit -m initial"); } } diff --git a/plugins/hg4idea/testSrc/hg4idea/test/HgMockVcsManager.java b/plugins/hg4idea/testSrc/hg4idea/test/HgMockVcsManager.java index 5ca7089902c3..c1a80b9b86af 100644 --- a/plugins/hg4idea/testSrc/hg4idea/test/HgMockVcsManager.java +++ b/plugins/hg4idea/testSrc/hg4idea/test/HgMockVcsManager.java @@ -251,12 +251,7 @@ public class HgMockVcsManager extends ProjectLevelVcsManager { @NotNull @Override public VcsRoot[] getAllVcsRoots() { - List vcsRoots = new ArrayList(); - List repositories = myPlatformFacade.getRepositoryManager(myProject).getRepositories(); - for (VirtualFile repository : repositories) { - vcsRoots.add(new VcsRoot(getVcsFor(repository), repository)); - } - return vcsRoots.toArray(new VcsRoot[0]); + throw new UnsupportedOperationException(); } @Override diff --git a/plugins/hg4idea/testSrc/hg4idea/test/HgTestPlatformFacade.java b/plugins/hg4idea/testSrc/hg4idea/test/HgTestPlatformFacade.java index 76fa2fe065fc..7c21b0f638cc 100644 --- a/plugins/hg4idea/testSrc/hg4idea/test/HgTestPlatformFacade.java +++ b/plugins/hg4idea/testSrc/hg4idea/test/HgTestPlatformFacade.java @@ -20,19 +20,17 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.vcs.ProjectLevelVcsManager; import org.jetbrains.annotations.NotNull; -import org.zmlx.hg4idea.*; +import org.zmlx.hg4idea.HgGlobalSettings; +import org.zmlx.hg4idea.HgPlatformFacade; +import org.zmlx.hg4idea.HgProjectSettings; +import org.zmlx.hg4idea.HgVcs; /** * @author Nadya Zabrodina */ -class HgTestPlatformFacade extends DvcsTestPlatformFacade implements HgPlatformFacade { +public class HgTestPlatformFacade extends DvcsTestPlatformFacade implements HgPlatformFacade { private HgMockVcs myVcs; private HgMockVcsManager myVcsManager; - private HgTestRepositoryManager myRepositoryManager; - - HgTestPlatformFacade() { - myRepositoryManager = new HgTestRepositoryManager(); - } @NotNull @Override @@ -44,6 +42,7 @@ class HgTestPlatformFacade extends DvcsTestPlatformFacade implements HgPlatformF return myVcs; } + @NotNull @Override public ProjectLevelVcsManager getVcsManager(@NotNull Project project) { @@ -58,11 +57,5 @@ class HgTestPlatformFacade extends DvcsTestPlatformFacade implements HgPlatformF public void showDialog(@NotNull DialogWrapper dialog) { throw new UnsupportedOperationException(); } - - @NotNull - @Override - public HgRepositoryManager getRepositoryManager(@NotNull Project project) { - return myRepositoryManager; - } } diff --git a/plugins/hg4idea/testSrc/hg4idea/test/HgTestRepositoryManager.java b/plugins/hg4idea/testSrc/hg4idea/test/HgTestRepositoryManager.java deleted file mode 100644 index bff58e4facc1..000000000000 --- a/plugins/hg4idea/testSrc/hg4idea/test/HgTestRepositoryManager.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2013 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 hg4idea.test; - -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; -import org.zmlx.hg4idea.HgRepositoryManager; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Nadya Zabrodina - */ -public class HgTestRepositoryManager implements HgRepositoryManager { - - private final List myRepositories = new ArrayList(); - - public void add(VirtualFile repository) { - myRepositories.add(repository); - } - - @NotNull - @Override - public List getRepositories() { - return myRepositories; - } -} diff --git a/plugins/hg4idea/testSrc/hg4idea/test/diff/HgGetDiffForDirTest.java b/plugins/hg4idea/testSrc/hg4idea/test/diff/HgGetDiffForDirTest.java index bfae5ed4f242..d8bd6b561a63 100644 --- a/plugins/hg4idea/testSrc/hg4idea/test/diff/HgGetDiffForDirTest.java +++ b/plugins/hg4idea/testSrc/hg4idea/test/diff/HgGetDiffForDirTest.java @@ -15,9 +15,11 @@ */ package hg4idea.test.diff; +import com.intellij.dvcs.test.Executor; import com.intellij.dvcs.test.MockVirtualFile; import com.intellij.openapi.vcs.FilePath; import com.intellij.openapi.vcs.changes.Change; +import hg4idea.test.HgExecutor; import hg4idea.test.HgLightTest; import org.junit.After; import org.junit.Test; @@ -53,28 +55,28 @@ public class HgGetDiffForDirTest extends HgLightTest { @Test public void testDiffForDir() { - cd(myProjectRoot); - touch("A.txt", "dsfdfdsf"); - hg("add A.txt"); - touch("B.txt"); - hg("add B.txt"); - hg("commit -m 2files_added"); - mkdir("dir"); - cd("dir"); - touch("C.txt"); - touch("D.txt"); - hg("add C.txt"); - hg("add D.txt"); - hg("commit -m createDir"); + Executor.cd(myProjectRoot); + Executor.touch("A.txt", "dsfdfdsf"); + HgExecutor.hg("add A.txt"); + Executor.touch("B.txt"); + HgExecutor.hg("add B.txt"); + HgExecutor.hg("commit -m 2files_added"); + Executor.mkdir("dir"); + Executor.cd("dir"); + Executor.touch("C.txt"); + Executor.touch("D.txt"); + HgExecutor.hg("add C.txt"); + HgExecutor.hg("add D.txt"); + HgExecutor.hg("commit -m createDir"); File dirFile = new File(myProjectRoot, "dir"); - String[] hash1 = hg("log -l 1 --template=" + SHORT_TEMPLATE_REVISION).split(":"); + String[] hash1 = HgExecutor.hg("log -l 1 --template=" + SHORT_TEMPLATE_REVISION).split(":"); HgRevisionNumber r1number = HgRevisionNumber.getInstance(hash1[0], hash1[1]); HgFileRevision rev1 = new HgFileRevision(myProject, new HgFile(myRepository, dirFile), r1number, "", null, "", "", null, null, null, null); - echo("C.txt", "aaaa"); - echo("D.txt", "dddd"); - hg("commit -m modifyDir"); - String[] hash2 = hg("log -l 1 --template=" + SHORT_TEMPLATE_REVISION).split(":"); + Executor.echo("C.txt", "aaaa"); + Executor.echo("D.txt", "dddd"); + HgExecutor.hg("commit -m modifyDir"); + String[] hash2 = HgExecutor.hg("log -l 1 --template=" + SHORT_TEMPLATE_REVISION).split(":"); HgRevisionNumber r2number = HgRevisionNumber.getInstance(hash2[0], hash2[1]); HgFileRevision rev2 = new HgFileRevision(myProject, new HgFile(myRepository, dirFile), r2number, "", null, "", "", null, null, null, null); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java index 330c90a74c89..ad6d77e4d9c3 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/DesignerEditorPanel.java @@ -173,12 +173,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider @Override public RadComponent findTarget(int x, int y, @Nullable ComponentTargetFilter filter) { - if (myRootComponent != null) { - FindComponentVisitor visitor = new FindComponentVisitor(myLayeredPane, filter, x, y); - myRootComponent.accept(visitor, false); - return visitor.getResult(); - } - return null; + return DesignerEditorPanel.this.findTarget(x, y, filter); } @Override @@ -727,10 +722,21 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider public abstract String getPlatformTarget(); + protected RadComponent findTarget(int x, int y, @Nullable ComponentTargetFilter filter) { + if (myRootComponent != null) { + FindComponentVisitor visitor = new FindComponentVisitor(myLayeredPane, filter, x, y); + myRootComponent.accept(visitor, false); + return visitor.getResult(); + } + return null; + } + protected abstract ComponentDecorator getRootSelectionDecorator(); @Nullable - protected abstract EditOperation processRootOperation(OperationContext context); + protected EditOperation processRootOperation(OperationContext context) { + return null; + } protected abstract boolean execute(ThrowableRunnable operation, boolean updateProperties); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java index e0a75b8fa64f..dbdbea94271f 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/FlowBaseOperation.java @@ -47,7 +47,7 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { createFirstInsertFeedback(); createInsertFeedback(); - if (myContainer.getChildren().isEmpty()) { + if (getChildren().isEmpty()) { layer.add(myFirstInsertFeedback); } else { @@ -57,6 +57,10 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { } } + protected List getChildren() { + return myContainer.getChildren(); + } + protected void createInsertFeedback() { myInsertFeedback = new LineInsertFeedback(Color.green, !myHorizontal); myInsertFeedback.size(myBounds.width, myBounds.height); @@ -71,13 +75,13 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { public void showFeedback() { createFeedback(); - if (!myContainer.getChildren().isEmpty()) { + if (!getChildren().isEmpty()) { FeedbackLayer layer = myContext.getArea().getFeedbackLayer(); Point location = myContext.getLocation(); myChildTarget = null; if (myHorizontal) { - for (RadComponent child : myContainer.getChildren()) { + for (RadComponent child : getChildren()) { Rectangle childBounds = getBounds(child, layer); if (childBounds.x <= location.x && location.x <= childBounds.getMaxX()) { myChildTarget = child; @@ -86,7 +90,7 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { } } else { - for (RadComponent child : myContainer.getChildren()) { + for (RadComponent child : getChildren()) { Rectangle childBounds = getBounds(child, layer); if (childBounds.y <= location.y && location.y <= childBounds.getMaxY()) { myChildTarget = child; @@ -131,7 +135,7 @@ public abstract class FlowBaseOperation extends AbstractEditOperation { private RadComponent getSideChildTarget() { Point location = myContext.getLocation(); - List children = myContainer.getChildren(); + List children = getChildren(); RadComponent lastChild = children.get(children.size() - 1); Rectangle childBounds = lastChild.getBounds(myContext.getArea().getFeedbackLayer()); diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java index eed759966137..e6e6b05f92f1 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/designSurface/tools/SelectionTool.java @@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.ActionManager; import com.intellij.openapi.actionSystem.ActionPopupMenu; import org.jetbrains.annotations.Nullable; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; @@ -75,7 +76,8 @@ public class SelectionTool extends InputTool { } } else { - setTracker(component.getDragTracker()); + Point location = component.convertPoint(myArea.getNativeComponent(), myCurrentScreenX, myCurrentScreenY); + setTracker(component.getDragTracker(location, myArea.isTree())); } } } diff --git a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java index 632e389b7c70..38115576a7f7 100644 --- a/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java +++ b/plugins/ui-designer/ui-designer-new/src/com/intellij/designer/model/RadComponent.java @@ -138,7 +138,7 @@ public abstract class RadComponent extends PropertiesContainer { return null; } - public InputTool getDragTracker() { + public InputTool getDragTracker(Point location, boolean isTree) { return new DragTracker(this); }