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:
+1
@@ -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;
|
||||
|
||||
+15
-6
@@ -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<VirtualFile> selectedFiles = Arrays.asList(myFileSystemTree.getSelectedFiles());
|
||||
return VfsUtilCore.toVirtualFileArray(FileChooserUtil.getChosenFiles(myChooserDescriptor, selectedFiles));
|
||||
}
|
||||
|
||||
@@ -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<String> recursive, final List<String> 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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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<VirtualFile> getRepositories();
|
||||
}
|
||||
@@ -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<String> 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");
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,12 +251,7 @@ public class HgMockVcsManager extends ProjectLevelVcsManager {
|
||||
@NotNull
|
||||
@Override
|
||||
public VcsRoot[] getAllVcsRoots() {
|
||||
List<VcsRoot> vcsRoots = new ArrayList<VcsRoot>();
|
||||
List<VirtualFile> 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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<VirtualFile> myRepositories = new ArrayList<VirtualFile>();
|
||||
|
||||
public void add(VirtualFile repository) {
|
||||
myRepositories.add(repository);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<VirtualFile> getRepositories() {
|
||||
return myRepositories;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
+13
-7
@@ -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<Exception> operation, boolean updateProperties);
|
||||
|
||||
|
||||
+9
-5
@@ -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<RadComponent> 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<RadComponent> children = myContainer.getChildren();
|
||||
List<RadComponent> children = getChildren();
|
||||
RadComponent lastChild = children.get(children.size() - 1);
|
||||
Rectangle childBounds = lastChild.getBounds(myContext.getArea().getFeedbackLayer());
|
||||
|
||||
|
||||
+3
-1
@@ -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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user