mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -55,7 +55,7 @@ import java.util.*;
|
||||
public class CompileContextImpl extends UserDataHolderBase implements CompileContextEx {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.CompileContextImpl");
|
||||
private final Project myProject;
|
||||
private final CompilerTask myTask;
|
||||
private final CompilerTask myBuildSession;
|
||||
private final Map<CompilerMessageCategory, Collection<CompilerMessage>> myMessages = new EnumMap<CompilerMessageCategory, Collection<CompilerMessage>>(CompilerMessageCategory.class);
|
||||
private final boolean myShouldUpdateProblemsView;
|
||||
private CompileScope myCompileScope;
|
||||
@@ -77,7 +77,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
CompileScope compileScope,
|
||||
boolean isMake, boolean isRebuild) {
|
||||
myProject = project;
|
||||
myTask = compilerSession;
|
||||
myBuildSession = compilerSession;
|
||||
myCompileScope = compileScope;
|
||||
myMake = isMake;
|
||||
myIsRebuild = isRebuild;
|
||||
@@ -99,6 +99,10 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
myShouldUpdateProblemsView = workspaceConfig.MAKE_PROJECT_ON_SAVE;
|
||||
}
|
||||
|
||||
public CompilerTask getBuildSession() {
|
||||
return myBuildSession;
|
||||
}
|
||||
|
||||
public boolean shouldUpdateProblemsView() {
|
||||
return myShouldUpdateProblemsView;
|
||||
}
|
||||
@@ -154,7 +158,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
myMessages.put(msg.getCategory(), messages);
|
||||
}
|
||||
if (messages.add(msg)) {
|
||||
myTask.addMessage(msg);
|
||||
myBuildSession.addMessage(msg);
|
||||
}
|
||||
if (myShouldUpdateProblemsView && msg.getCategory() == CompilerMessageCategory.ERROR) {
|
||||
ProblemsView.SERVICE.getInstance(myProject).addMessage(msg, mySessionId);
|
||||
@@ -200,7 +204,7 @@ public class CompileContextImpl extends UserDataHolderBase implements CompileCon
|
||||
}
|
||||
|
||||
public ProgressIndicator getProgressIndicator() {
|
||||
return myTask.getIndicator();
|
||||
return myBuildSession.getIndicator();
|
||||
}
|
||||
|
||||
public Module getModuleByFile(VirtualFile file) {
|
||||
|
||||
@@ -29,6 +29,8 @@ import com.intellij.compiler.ProblemsView;
|
||||
import com.intellij.compiler.progress.CompilerTask;
|
||||
import com.intellij.compiler.server.BuildManager;
|
||||
import com.intellij.compiler.server.DefaultMessageHandler;
|
||||
import com.intellij.notification.Notification;
|
||||
import com.intellij.notification.NotificationListener;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.compiler.ex.CompilerPathsEx;
|
||||
@@ -53,10 +55,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.wm.StatusBar;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.*;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.impl.compiler.ArtifactCompilerUtil;
|
||||
import com.intellij.packaging.impl.compiler.ArtifactsCompiler;
|
||||
@@ -68,6 +67,7 @@ import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.text.DateFormatUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -79,7 +79,9 @@ import org.jetbrains.jps.api.RequestFuture;
|
||||
import org.jetbrains.jps.model.java.JavaSourceRootType;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.HyperlinkEvent;
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@@ -502,9 +504,24 @@ public class CompileDriver {
|
||||
if (duration > ONE_MINUTE_MS && CompilerWorkspaceConfiguration.getInstance(myProject).DISPLAY_NOTIFICATION_POPUP) {
|
||||
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.MESSAGES_WINDOW, messageType, statusMessage);
|
||||
}
|
||||
CompilerManager.NOTIFICATION_GROUP.createNotification(statusMessage, messageType).notify(myProject);
|
||||
|
||||
final String wrappedMessage = _status != ExitStatus.UP_TO_DATE? "<a href='#'>" + statusMessage + "</a>" : statusMessage;
|
||||
final Notification notification = CompilerManager.NOTIFICATION_GROUP.createNotification(
|
||||
"", wrappedMessage,
|
||||
messageType.toNotificationType(),
|
||||
new MessagesActivationListener(compileContext)
|
||||
);
|
||||
compileContext.getBuildSession().registerCloseAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
notification.expire();
|
||||
}
|
||||
});
|
||||
notification.notify(myProject);
|
||||
|
||||
if (_status != ExitStatus.UP_TO_DATE && compileContext.getMessageCount(null) > 0) {
|
||||
compileContext.addMessage(CompilerMessageCategory.INFORMATION, statusMessage, null, -1, -1);
|
||||
final String msg = DateFormatUtil.formatDateTime(new Date()) + " - " + statusMessage;
|
||||
compileContext.addMessage(CompilerMessageCategory.INFORMATION, msg, null, -1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -785,4 +802,28 @@ public class CompileDriver {
|
||||
private void showConfigurationDialog(String moduleNameToSelect, String tabNameToSelect) {
|
||||
ProjectSettingsService.getInstance(myProject).showModuleConfigurationDialog(moduleNameToSelect, tabNameToSelect);
|
||||
}
|
||||
|
||||
private static class MessagesActivationListener extends NotificationListener.Adapter {
|
||||
private final WeakReference<Project> myProjectRef;
|
||||
private final Object myContentId;
|
||||
|
||||
public MessagesActivationListener(CompileContextImpl compileContext) {
|
||||
myProjectRef = new WeakReference<Project>(compileContext.getProject());
|
||||
myContentId = compileContext.getBuildSession().getContentId();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
|
||||
final Project project = myProjectRef.get();
|
||||
if (project != null && !project.isDisposed() && CompilerTask.showCompilerContent(project, myContentId)) {
|
||||
final ToolWindow tw = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
|
||||
if (tw != null) {
|
||||
tw.activate(null, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
notification.expire();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,11 @@
|
||||
package com.intellij.compiler.progress;
|
||||
|
||||
import com.intellij.compiler.CompilerManagerImpl;
|
||||
import com.intellij.compiler.CompilerMessageImpl;
|
||||
import com.intellij.compiler.impl.CompilerErrorTreeView;
|
||||
import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
|
||||
import com.intellij.ide.errorTreeView.impl.ErrorTreeViewConfiguration;
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
@@ -42,6 +41,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.project.ProjectManagerListener;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -120,6 +120,26 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
mySessionId = sessionId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Object getContentId() {
|
||||
return myContentId;
|
||||
}
|
||||
|
||||
public void registerCloseAction(final Runnable onClose) {
|
||||
synchronized (myMessageViewLock) {
|
||||
if (myErrorTreeView != null) {
|
||||
Disposer.register(myErrorTreeView, new Disposable() {
|
||||
@Override
|
||||
public void dispose() {
|
||||
onClose.run();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
onClose.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProcessId() {
|
||||
return "compilation";
|
||||
@@ -221,13 +241,15 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
|
||||
private void addIndicatorDelegate() {
|
||||
ProgressIndicator indicator = myIndicator;
|
||||
if (!(indicator instanceof ProgressIndicatorEx)) return;
|
||||
if (!(indicator instanceof ProgressIndicatorEx)) {
|
||||
return;
|
||||
}
|
||||
((ProgressIndicatorEx)indicator).addStateDelegate(new ProgressIndicatorBase() {
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
super.cancel();
|
||||
closeUI();
|
||||
selectFirstMessage();
|
||||
stopAppIconProgress();
|
||||
}
|
||||
|
||||
@@ -235,11 +257,26 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
public void stop() {
|
||||
super.stop();
|
||||
if (!isCanceled()) {
|
||||
closeUI();
|
||||
selectFirstMessage();
|
||||
}
|
||||
stopAppIconProgress();
|
||||
}
|
||||
|
||||
private void selectFirstMessage() {
|
||||
if (!isHeadlessMode()) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (myMessageViewLock) {
|
||||
if (myErrorTreeView != null) {
|
||||
myErrorTreeView.selectFirstMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void stopAppIconProgress() {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
@@ -249,7 +286,8 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
if (myErrorCount > 0) {
|
||||
appIcon.setErrorBadge(myProject, String.valueOf(myErrorCount));
|
||||
appIcon.requestAttention(myProject, true);
|
||||
} else if (!myCompilationStartedAutomatically) {
|
||||
}
|
||||
else if (!myCompilationStartedAutomatically) {
|
||||
appIcon.setOkBadge(myProject, true);
|
||||
appIcon.requestAttention(myProject, false);
|
||||
}
|
||||
@@ -450,18 +488,22 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
public void showCompilerContent() {
|
||||
synchronized (myMessageViewLock) {
|
||||
if (myErrorTreeView != null) {
|
||||
final MessageView messageView = MessageView.SERVICE.getInstance(myProject);
|
||||
Content[] contents = messageView.getContentManager().getContents();
|
||||
for (Content content : contents) {
|
||||
if (CONTENT_ID_KEY.get(content) == myContentId) {
|
||||
messageView.getContentManager().setSelectedContent(content);
|
||||
return;
|
||||
}
|
||||
}
|
||||
showCompilerContent(myProject, myContentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean showCompilerContent(final Project project, final Object contentId) {
|
||||
final MessageView messageView = MessageView.SERVICE.getInstance(project);
|
||||
for (Content content : messageView.getContentManager().getContents()) {
|
||||
if (CONTENT_ID_KEY.get(content) == contentId) {
|
||||
messageView.getContentManager().setSelectedContent(content);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void removeAllContents(Project project, Content notRemove) {
|
||||
if (project.isDisposed()) {
|
||||
return;
|
||||
@@ -488,7 +530,7 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
|
||||
private void activateMessageView() {
|
||||
synchronized (myMessageViewLock) {
|
||||
if (myErrorTreeView != null) {
|
||||
if (myErrorTreeView != null && myProject != null) {
|
||||
final ToolWindow tw = ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
|
||||
if (tw != null) {
|
||||
tw.activate(null, false);
|
||||
@@ -497,34 +539,6 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
}
|
||||
}
|
||||
|
||||
private void closeUI() {
|
||||
if (isHeadlessMode()) {
|
||||
return;
|
||||
}
|
||||
Window window = getWindow();
|
||||
ModalityState modalityState = window != null ? ModalityState.stateForComponent(window) : ModalityState.NON_MODAL;
|
||||
final Application application = ApplicationManager.getApplication();
|
||||
application.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized (myMessageViewLock) {
|
||||
if (myErrorTreeView != null) {
|
||||
final boolean shouldRetainView = myErrorCount > 0 || myWarningCount > 0 && !myErrorTreeView.isHideWarnings();
|
||||
if (shouldRetainView) {
|
||||
addMessage(new CompilerMessageImpl(myProject, CompilerMessageCategory.STATISTICS, CompilerBundle.message("statistics.error.count", myErrorCount)));
|
||||
addMessage(new CompilerMessageImpl(myProject, CompilerMessageCategory.STATISTICS, CompilerBundle.message("statistics.warnings.count", myWarningCount)));
|
||||
//activateMessageView();
|
||||
myErrorTreeView.selectFirstMessage();
|
||||
}
|
||||
else {
|
||||
removeAllContents(myProject, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, modalityState);
|
||||
}
|
||||
|
||||
public Window getWindow(){
|
||||
return null;
|
||||
}
|
||||
@@ -607,7 +621,7 @@ public class CompilerTask extends Task.Backgroundable {
|
||||
if (event.getContent() == myContent) {
|
||||
synchronized (myMessageViewLock) {
|
||||
if (myErrorTreeView != null) {
|
||||
myErrorTreeView.dispose();
|
||||
Disposer.dispose(myErrorTreeView);
|
||||
myErrorTreeView = null;
|
||||
if (myIndicator.isRunning()) {
|
||||
cancel();
|
||||
|
||||
@@ -23,12 +23,10 @@ import com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.render.*;
|
||||
import com.intellij.ide.actions.ShowSettingsUtilImpl;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class AdjustArrayRangeAction extends DebuggerAction {
|
||||
@@ -67,30 +65,25 @@ public class AdjustArrayRangeAction extends DebuggerAction {
|
||||
title = title + " " + label.substring(index);
|
||||
}
|
||||
final ArrayRenderer clonedRenderer = renderer.clone();
|
||||
final NamedArrayConfigurable configurable = new NamedArrayConfigurable(title, clonedRenderer);
|
||||
SingleConfigurableEditor editor = new SingleConfigurableEditor(project, configurable,
|
||||
ShowSettingsUtilImpl.createDimensionKey(configurable), false);
|
||||
editor.show();
|
||||
|
||||
if(editor.getExitCode() == DialogWrapper.OK_EXIT_CODE) {
|
||||
if (ShowSettingsUtil.getInstance().editConfigurable(project, new NamedArrayConfigurable(title, clonedRenderer))) {
|
||||
debugProcess.getManagerThread().schedule(new SuspendContextCommandImpl(debuggerContext.getSuspendContext()) {
|
||||
@Override
|
||||
public void contextAction() throws Exception {
|
||||
final ValueDescriptorImpl nodeDescriptor = (ValueDescriptorImpl)selectedNode.getDescriptor();
|
||||
final Renderer lastRenderer = nodeDescriptor.getLastRenderer();
|
||||
if (lastRenderer instanceof ArrayRenderer) {
|
||||
selectedNode.setRenderer(clonedRenderer);
|
||||
}
|
||||
else if (lastRenderer instanceof CompoundNodeRenderer) {
|
||||
final CompoundNodeRenderer compoundRenderer = (CompoundNodeRenderer)lastRenderer;
|
||||
final ChildrenRenderer childrenRenderer = compoundRenderer.getChildrenRenderer();
|
||||
if (childrenRenderer instanceof ExpressionChildrenRenderer) {
|
||||
ExpressionChildrenRenderer.setPreferableChildrenRenderer(nodeDescriptor, clonedRenderer);
|
||||
selectedNode.calcRepresentation();
|
||||
}
|
||||
@Override
|
||||
public void contextAction() throws Exception {
|
||||
final ValueDescriptorImpl nodeDescriptor = (ValueDescriptorImpl)selectedNode.getDescriptor();
|
||||
final Renderer lastRenderer = nodeDescriptor.getLastRenderer();
|
||||
if (lastRenderer instanceof ArrayRenderer) {
|
||||
selectedNode.setRenderer(clonedRenderer);
|
||||
}
|
||||
else if (lastRenderer instanceof CompoundNodeRenderer) {
|
||||
final CompoundNodeRenderer compoundRenderer = (CompoundNodeRenderer)lastRenderer;
|
||||
final ChildrenRenderer childrenRenderer = compoundRenderer.getChildrenRenderer();
|
||||
if (childrenRenderer instanceof ExpressionChildrenRenderer) {
|
||||
ExpressionChildrenRenderer.setPreferableChildrenRenderer(nodeDescriptor, clonedRenderer);
|
||||
selectedNode.calcRepresentation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-12
@@ -19,23 +19,15 @@ import com.intellij.debugger.settings.ThreadsViewConfigurable;
|
||||
import com.intellij.debugger.settings.ThreadsViewSettings;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
|
||||
/**
|
||||
* User: lex
|
||||
* Date: Sep 26, 2003
|
||||
* Time: 4:40:12 PM
|
||||
*/
|
||||
public class CustomizeThreadsViewAction extends DebuggerAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
final SingleConfigurableEditor editor = new SingleConfigurableEditor(project, new ThreadsViewConfigurable(ThreadsViewSettings.getInstance()));
|
||||
editor.show();
|
||||
ShowSettingsUtil.getInstance().editConfigurable(e.getProject(), new ThreadsViewConfigurable(ThreadsViewSettings.getInstance()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(true);
|
||||
e.getPresentation().setText(ActionsBundle.actionText(DebuggerActions.CUSTOMIZE_THREADS_VIEW));
|
||||
|
||||
@@ -37,6 +37,7 @@ import javax.swing.border.CompoundBorder;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
public class ShowStructureSettingsAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
|
||||
if (project == null) {
|
||||
@@ -61,7 +62,8 @@ public class ShowStructureSettingsAction extends AnAction implements DumbAware {
|
||||
return panel;
|
||||
}
|
||||
}.show();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ShowSettingsUtil
|
||||
.getInstance().editConfigurable(project, OptionsEditorDialog.DIMENSION_KEY, ProjectStructureConfigurable.getInstance(project));
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable;
|
||||
|
||||
public class TemplateProjectStructureAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
Project defaultProject = ProjectManagerEx.getInstanceEx().getDefaultProject();
|
||||
ShowSettingsUtil.getInstance().editConfigurable(defaultProject, OptionsEditorDialog.DIMENSION_KEY, ProjectStructureConfigurable.getInstance(defaultProject));
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ public class StructuredConfigKey {
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (<caret>)
|
||||
} catch (<caret>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.impl.file.impl;
|
||||
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiDirectory;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class TempFileSystemTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
public void testMove() {
|
||||
ProjectRootManager rootManager = ProjectRootManager.getInstance(getProject());
|
||||
VirtualFile sourceRoot = rootManager.getContentSourceRoots()[0];
|
||||
PsiManager psiManager = PsiManager.getInstance(getProject());
|
||||
PsiDirectory psiSourceRoot = psiManager.findDirectory(sourceRoot);
|
||||
PsiFile psiFile = psiSourceRoot.createFile("TestDocument.xml");
|
||||
try {
|
||||
psiFile.getVirtualFile().move(this, psiSourceRoot.createSubdirectory("com").getVirtualFile());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
assertTrue(psiFile.isValid());
|
||||
psiFile.delete();
|
||||
assertFalse(psiFile.isValid());
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -18,6 +18,16 @@ package com.intellij.lexer;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Naive implementation of lexer that able to combine element types of two other lexers.
|
||||
*
|
||||
* The implementation doesn't give any guarantees about valid points of 'incremental relexing',
|
||||
* because it returns start/end-offsets not for token that was used but for the shortest one.
|
||||
*
|
||||
* Also it reduces state size to 16 bits for nested lexer.
|
||||
*
|
||||
* @deprecated use {@link com.intellij.psi.templateLanguages.TemplateBlackAndWhiteLexer} or {@link com.intellij.lexer.LayeredLexer} instead
|
||||
*/
|
||||
public abstract class CompositeLexer extends LexerBase {
|
||||
private final Lexer myLexer1;
|
||||
private final Lexer myLexer2;
|
||||
|
||||
+20
-2
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.codeInsight.generation;
|
||||
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
@@ -13,6 +28,7 @@ import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.treeStructure.SimpleTree;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -55,8 +71,9 @@ public class GenerateByPatternDialog extends DialogWrapper {
|
||||
};
|
||||
myTree.setRootVisible(false);
|
||||
myTree.setCellRenderer(new DefaultTreeCellRenderer() {
|
||||
@NotNull
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree,
|
||||
public Component getTreeCellRendererComponent(@NotNull JTree tree,
|
||||
Object value,
|
||||
boolean sel,
|
||||
boolean expanded,
|
||||
@@ -78,7 +95,7 @@ public class GenerateByPatternDialog extends DialogWrapper {
|
||||
myTree.setModel(new DefaultTreeModel(root));
|
||||
myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(TreeSelectionEvent e) {
|
||||
public void valueChanged(@NotNull TreeSelectionEvent e) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
@@ -141,6 +158,7 @@ public class GenerateByPatternDialog extends DialogWrapper {
|
||||
|
||||
private DefaultMutableTreeNode createNode(@Nullable PatternDescriptor descriptor) {
|
||||
DefaultMutableTreeNode root = new DefaultMutableTreeNode(descriptor) {
|
||||
@NotNull
|
||||
@Override
|
||||
public String toString() {
|
||||
Object object = getUserObject();
|
||||
|
||||
+7
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -28,7 +28,6 @@ import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.openapi.ui.popup.JBPopup;
|
||||
@@ -52,7 +51,6 @@ import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.util.ui.update.Activatable;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
@@ -182,7 +180,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
myEditVariablesButton.addActionListener(
|
||||
new ActionListener(){
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(@NotNull ActionEvent e) {
|
||||
editVariables();
|
||||
}
|
||||
}
|
||||
@@ -201,7 +199,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
myTemplate.parseSegments();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
private JComponent createNorthPanel() {
|
||||
JPanel panel = new JPanel(new GridBagLayout());
|
||||
|
||||
@@ -240,7 +238,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
myExpandByCombo = new ComboBox(new String[]{myDefaultShortcutItem, SPACE, TAB, ENTER});
|
||||
myExpandByCombo.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
public void itemStateChanged(@NotNull ItemEvent e) {
|
||||
Object selectedItem = myExpandByCombo.getSelectedItem();
|
||||
if(myDefaultShortcutItem.equals(selectedItem)) {
|
||||
myTemplate.setShortcutChar(TemplateSettings.DEFAULT_CHAR);
|
||||
@@ -278,7 +276,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
cb.setSelected(myOptions.get(processor).booleanValue());
|
||||
cb.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(@NotNull ActionEvent e) {
|
||||
myOptions.put(processor, cb.isSelected());
|
||||
}
|
||||
});
|
||||
@@ -469,14 +467,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
}
|
||||
|
||||
private void updateHighlighter() {
|
||||
List<TemplateContextType> applicableContexts = getApplicableContexts();
|
||||
if (!applicableContexts.isEmpty()) {
|
||||
TemplateContext contextByType = new TemplateContext();
|
||||
contextByType.setEnabled(applicableContexts.get(0), true);
|
||||
TemplateEditorUtil.setHighlighter(myTemplateEditor, contextByType);
|
||||
return;
|
||||
}
|
||||
((EditorEx) myTemplateEditor).repaint(0, myTemplateEditor.getDocument().getTextLength());
|
||||
TemplateEditorUtil.setHighlighter(myTemplateEditor, ContainerUtil.getFirstItem(getApplicableContexts()));
|
||||
}
|
||||
|
||||
private void validateEditVariablesButton() {
|
||||
@@ -520,7 +511,7 @@ public class LiveTemplateSettingsEditor extends JPanel {
|
||||
myCbReformat.setSelected(myTemplate.isToReformat());
|
||||
myCbReformat.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
public void actionPerformed(@NotNull ActionEvent e) {
|
||||
myTemplate.setToReformat(myCbReformat.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
+25
-41
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.codeInsight.template.impl;
|
||||
|
||||
import com.intellij.codeInsight.template.TemplateContextType;
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.lexer.CompositeLexer;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.MergingLexerAdapter;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
@@ -31,7 +30,8 @@ import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter;
|
||||
import com.intellij.openapi.editor.ex.util.LayerDescriptor;
|
||||
import com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
@@ -42,6 +42,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -87,54 +88,41 @@ public class TemplateEditorUtil {
|
||||
if (file != null) {
|
||||
EditorHighlighter highlighter = EditorHighlighterFactory.getInstance().createEditorHighlighter(file, scheme, project);
|
||||
((EditorEx) editor).setHighlighter(highlighter);
|
||||
|
||||
}
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
public static void setHighlighter(Editor editor, TemplateContext templateContext) {
|
||||
SyntaxHighlighter baseHighlighter = null;
|
||||
for(TemplateContextType type: TemplateManagerImpl.getAllContextTypes()) {
|
||||
if (templateContext.isEnabled(type)) {
|
||||
baseHighlighter = type.createHighlighter();
|
||||
if (baseHighlighter != null) break;
|
||||
public static void setHighlighter(Editor editor, @Nullable TemplateContext templateContext) {
|
||||
SyntaxHighlighter highlighter = null;
|
||||
if (templateContext != null) {
|
||||
for(TemplateContextType type: TemplateManagerImpl.getAllContextTypes()) {
|
||||
if (templateContext.isEnabled(type)) {
|
||||
highlighter = type.createHighlighter();
|
||||
if (highlighter != null) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (baseHighlighter == null) {
|
||||
baseHighlighter = new PlainSyntaxHighlighter();
|
||||
}
|
||||
|
||||
SyntaxHighlighter highlighter = createTemplateTextHighlighter(baseHighlighter);
|
||||
((EditorEx)editor).setHighlighter(new LexerEditorHighlighter(highlighter, EditorColorsManager.getInstance().getGlobalScheme()));
|
||||
setHighlighter((EditorEx)editor, highlighter);
|
||||
}
|
||||
|
||||
private final static TokenSet TOKENS_TO_MERGE = TokenSet.create(TemplateTokenType.TEXT);
|
||||
public static void setHighlighter(@NotNull Editor editor, @Nullable TemplateContextType templateContextType) {
|
||||
setHighlighter((EditorEx)editor, templateContextType != null ? templateContextType.createHighlighter() : null);
|
||||
}
|
||||
|
||||
private static SyntaxHighlighter createTemplateTextHighlighter(final SyntaxHighlighter original) {
|
||||
return new TemplateHighlighter(original);
|
||||
private static void setHighlighter(EditorEx editor, @Nullable SyntaxHighlighter highlighter) {
|
||||
EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
LayeredLexerEditorHighlighter layeredHighlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), editorColorsScheme);
|
||||
layeredHighlighter.registerLayer(TemplateTokenType.TEXT, new LayerDescriptor(ObjectUtils.notNull(highlighter, new PlainSyntaxHighlighter()), ""));
|
||||
editor.setHighlighter(layeredHighlighter);
|
||||
}
|
||||
|
||||
private static class TemplateHighlighter extends SyntaxHighlighterBase {
|
||||
private final Lexer myLexer;
|
||||
private final SyntaxHighlighter myOriginalHighlighter;
|
||||
|
||||
public TemplateHighlighter(SyntaxHighlighter original) {
|
||||
myOriginalHighlighter = original;
|
||||
Lexer originalLexer = original.getHighlightingLexer();
|
||||
Lexer templateLexer = new TemplateTextLexer();
|
||||
templateLexer = new MergingLexerAdapter(templateLexer, TOKENS_TO_MERGE);
|
||||
|
||||
myLexer = new CompositeLexer(originalLexer, templateLexer) {
|
||||
@Override
|
||||
protected IElementType getCompositeTokenType(IElementType type1, IElementType type2) {
|
||||
if (type2 == TemplateTokenType.VARIABLE) {
|
||||
return type2;
|
||||
}
|
||||
else {
|
||||
return type1;
|
||||
}
|
||||
}
|
||||
};
|
||||
public TemplateHighlighter() {
|
||||
myLexer = new MergingLexerAdapter(new TemplateTextLexer(), TokenSet.create(TemplateTokenType.TEXT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -146,11 +134,7 @@ public class TemplateEditorUtil {
|
||||
@Override
|
||||
@NotNull
|
||||
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
|
||||
if (tokenType == TemplateTokenType.VARIABLE) {
|
||||
return pack(myOriginalHighlighter.getTokenHighlights(tokenType), TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
|
||||
}
|
||||
|
||||
return myOriginalHighlighter.getTokenHighlights(tokenType);
|
||||
return tokenType == TemplateTokenType.VARIABLE ? pack(TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES) : EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+65
-63
@@ -30,6 +30,7 @@ import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.popup.ListPopupStep;
|
||||
@@ -919,35 +920,77 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemWrapper[] createSettingsList(@NotNull final Project project, @NotNull ExecutorProvider executorProvider, boolean createEditAction) {
|
||||
final RunManagerEx manager = RunManagerEx.getInstanceEx(project);
|
||||
public static ItemWrapper[] createSettingsList(@NotNull Project project, @NotNull ExecutorProvider executorProvider, boolean createEditAction) {
|
||||
List<ItemWrapper> result = new ArrayList<ItemWrapper>();
|
||||
|
||||
final List<ItemWrapper> result = new ArrayList<ItemWrapper>();
|
||||
if (createEditAction) {
|
||||
ItemWrapper<Void> edit = new ItemWrapper<Void>(null) {
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.Actions.EditSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return UIUtil.removeMnemonic(ActionsBundle.message("action.editRunConfigurations.text"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
|
||||
if (new EditConfigurationsDialog(project) {
|
||||
@Override
|
||||
protected void init() {
|
||||
setOKButtonText(executor.getStartActionText());
|
||||
setOKButtonIcon(executor.getIcon());
|
||||
myExecutor = executor;
|
||||
super.init();
|
||||
}
|
||||
}.showAndGet()) {
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
RunnerAndConfigurationSettings configuration = RunManager.getInstance(project).getSelectedConfiguration();
|
||||
if (configuration != null) {
|
||||
ExecutionUtil.runConfiguration(configuration, executor);
|
||||
}
|
||||
}
|
||||
}, project.getDisposed());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available(Executor executor) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
edit.setMnemonic(0);
|
||||
result.add(edit);
|
||||
}
|
||||
|
||||
RunManagerEx manager = RunManagerEx.getInstanceEx(project);
|
||||
final RunnerAndConfigurationSettings selectedConfiguration = manager.getSelectedConfiguration();
|
||||
|
||||
if (selectedConfiguration != null) {
|
||||
boolean isFirst = true;
|
||||
final ExecutionTarget activeTarget = ExecutionTargetManager.getActiveTarget(project);
|
||||
for (final ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, selectedConfiguration)) {
|
||||
for (ExecutionTarget eachTarget : ExecutionTargetManager.getTargetsToChooseFor(project, selectedConfiguration)) {
|
||||
result.add(new ItemWrapper<ExecutionTarget>(eachTarget, isFirst) {
|
||||
{
|
||||
setChecked(eachTarget.equals(activeTarget));
|
||||
setChecked(getValue().equals(activeTarget));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return eachTarget.getIcon();
|
||||
return getValue().getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return eachTarget.getDisplayName();
|
||||
return getValue().getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
|
||||
ExecutionTargetManager.setActiveTarget(project, eachTarget);
|
||||
ExecutionTargetManager.setActiveTarget(project, getValue());
|
||||
ExecutionUtil.runConfiguration(selectedConfiguration, executor);
|
||||
}
|
||||
|
||||
@@ -960,18 +1003,24 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider {
|
||||
}
|
||||
}
|
||||
|
||||
final Map<RunnerAndConfigurationSettings, ItemWrapper> wrappedExisting = new LinkedHashMap<RunnerAndConfigurationSettings, ItemWrapper>();
|
||||
final ConfigurationType[] types = manager.getConfigurationFactories();
|
||||
for (final ConfigurationType type : types) {
|
||||
Map<RunnerAndConfigurationSettings, ItemWrapper> wrappedExisting = new LinkedHashMap<RunnerAndConfigurationSettings, ItemWrapper>();
|
||||
for (ConfigurationType type : manager.getConfigurationFactories()) {
|
||||
if (!(type instanceof UnknownConfigurationType)) {
|
||||
Map<String, List<RunnerAndConfigurationSettings>> structure = manager.getStructure(type);
|
||||
for (final Map.Entry<String, List<RunnerAndConfigurationSettings>> entry : structure.entrySet()) {
|
||||
if (entry.getValue().isEmpty())
|
||||
for (Map.Entry<String, List<RunnerAndConfigurationSettings>> entry : structure.entrySet()) {
|
||||
if (entry.getValue().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String key = entry.getKey();
|
||||
if (key != null){
|
||||
if (key != null) {
|
||||
boolean isSelected = entry.getValue().contains(selectedConfiguration);
|
||||
FolderWrapper folderWrapper = new FolderWrapper(project, executorProvider, key + (isSelected ? " (mnemonic is to \"" + selectedConfiguration.getName()+"\")" : ""), entry.getValue());
|
||||
if (isSelected) {
|
||||
assert selectedConfiguration != null;
|
||||
}
|
||||
FolderWrapper folderWrapper = new FolderWrapper(project, executorProvider,
|
||||
key + (isSelected ? " (mnemonic is to \"" + selectedConfiguration.getName() + "\")" : ""),
|
||||
entry.getValue());
|
||||
if (isSelected) {
|
||||
folderWrapper.setMnemonic(1);
|
||||
}
|
||||
@@ -992,53 +1041,6 @@ public class ChooseRunConfigurationPopup implements ExecutorProvider {
|
||||
|
||||
populateWithDynamicRunners(result, wrappedExisting, project, manager, selectedConfiguration);
|
||||
result.addAll(wrappedExisting.values());
|
||||
|
||||
//noinspection unchecked
|
||||
final ItemWrapper edit = new ItemWrapper(null) {
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return AllIcons.Actions.EditSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return UIUtil.removeMnemonic(ActionsBundle.message("action.editRunConfigurations.text"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void perform(@NotNull final Project project, @NotNull final Executor executor, @NotNull DataContext context) {
|
||||
final EditConfigurationsDialog dialog = new EditConfigurationsDialog(project) {
|
||||
@Override
|
||||
protected void init() {
|
||||
setOKButtonText(executor.getStartActionText());
|
||||
setOKButtonIcon(executor.getIcon());
|
||||
myExecutor = executor;
|
||||
super.init();
|
||||
}
|
||||
};
|
||||
|
||||
dialog.show();
|
||||
if (dialog.isOK()) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ExecutionUtil.runConfiguration(RunManager.getInstance(project).getSelectedConfiguration(), executor);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available(Executor executor) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
edit.setMnemonic(0);
|
||||
if (createEditAction) {
|
||||
result.add(0, edit);
|
||||
}
|
||||
|
||||
return result.toArray(new ItemWrapper[result.size()]);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class EditConfigurationsDialog extends SingleConfigurableEditor implement
|
||||
protected Executor myExecutor;
|
||||
|
||||
public EditConfigurationsDialog(final Project project) {
|
||||
super(project, new RunConfigurable(project), IdeModalityType.PROJECT);
|
||||
super(project, new RunConfigurable(project), "#com.intellij.execution.impl.EditConfigurationsDialog", IdeModalityType.PROJECT);
|
||||
((RunConfigurable)getConfigurable()).setRunDialog(this);
|
||||
setTitle(ExecutionBundle.message("run.debug.dialog.title"));
|
||||
setHorizontalStretch(1.3F);
|
||||
@@ -42,11 +42,6 @@ public class EditConfigurationsDialog extends SingleConfigurableEditor implement
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDimensionServiceKey() {
|
||||
return "#com.intellij.execution.impl.EditConfigurationsDialog";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Executor getExecutor() {
|
||||
|
||||
@@ -290,7 +290,8 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
final ContentManager manager = ContentFactory.SERVICE.getInstance().createContentManager(this, false, myProject);
|
||||
Disposer.register((Disposable)myRunnerUi, manager);
|
||||
manager.getComponent();
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
final DockManager dockManager = DockManager.getInstance(myProject);
|
||||
if (dockManager != null) { //default project
|
||||
dockManager.register(this);
|
||||
@@ -1375,7 +1376,6 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
}
|
||||
|
||||
private class MyComponent extends Wrapper.FocusHolder implements DataProvider, QuickActionProvider {
|
||||
|
||||
private boolean myWasEverAdded;
|
||||
|
||||
public MyComponent() {
|
||||
@@ -1390,9 +1390,13 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
if (KEY.is(dataId)) {
|
||||
return RunnerContentUi.this;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
|
||||
ContentManager originalContentManager = myOriginal == null ? null : myOriginal.getContentManager();
|
||||
JComponent originalContentComponent = originalContentManager == null ? null : originalContentManager.getComponent();
|
||||
if (originalContentComponent instanceof DataProvider) {
|
||||
return ((DataProvider)originalContentComponent).getData(dataId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@@ -1841,9 +1845,6 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
public void dragOutFinished(MouseEvent event, TabInfo source) {
|
||||
final Component component = event.getComponent();
|
||||
final IdeFrame window = UIUtil.getParentOfType(IdeFrame.class, component);
|
||||
if (window != null) {
|
||||
|
||||
}
|
||||
mySession.process(event);
|
||||
mySession = null;
|
||||
}
|
||||
|
||||
+28
-39
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -21,7 +21,6 @@ import com.intellij.ide.DataManager;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.lexer.CompositeLexer;
|
||||
import com.intellij.lexer.FlexAdapter;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.MergingLexerAdapter;
|
||||
@@ -38,7 +37,8 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.event.DocumentAdapter;
|
||||
import com.intellij.openapi.editor.event.DocumentEvent;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.ex.util.LexerEditorHighlighter;
|
||||
import com.intellij.openapi.editor.ex.util.LayerDescriptor;
|
||||
import com.intellij.openapi.editor.ex.util.LayeredLexerEditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.EditorHighlighterFactory;
|
||||
import com.intellij.openapi.fileTypes.*;
|
||||
@@ -99,7 +99,7 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
private URL myDefaultDescriptionUrl;
|
||||
private final Project myProject;
|
||||
|
||||
private final List<ChangeListener> myChangeListeners = ContainerUtil.createLockFreeCopyOnWriteList();;
|
||||
private final List<ChangeListener> myChangeListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private Splitter mySplitter;
|
||||
private final FileType myVelocityFileType = FileTypeManager.getInstance().getFileTypeByExtension("ft");
|
||||
private JPanel myDescriptionPanel;
|
||||
@@ -205,13 +205,13 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
|
||||
myNameField.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
public void focusLost(@NotNull FocusEvent e) {
|
||||
onNameChanged();
|
||||
}
|
||||
});
|
||||
myExtensionField.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
public void focusLost(@NotNull FocusEvent e) {
|
||||
onNameChanged();
|
||||
}
|
||||
});
|
||||
@@ -221,8 +221,11 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
|
||||
private Editor createEditor() {
|
||||
EditorFactory editorFactory = EditorFactory.getInstance();
|
||||
Document doc = myFile == null ? editorFactory.createDocument(myTemplate == null ? "" : myTemplate.getText()) : PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile);
|
||||
Editor editor = myProject == null ? editorFactory.createEditor(doc) : editorFactory.createEditor(doc, myProject);
|
||||
Document doc = myFile == null
|
||||
? editorFactory.createDocument(myTemplate == null ? "" : myTemplate.getText())
|
||||
: PsiDocumentManager.getInstance(myFile.getProject()).getDocument(myFile);
|
||||
assert doc != null;
|
||||
Editor editor = editorFactory.createEditor(doc, myProject);
|
||||
|
||||
EditorSettings editorSettings = editor.getSettings();
|
||||
editorSettings.setVirtualSpace(false);
|
||||
@@ -367,7 +370,7 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
|
||||
@Nullable
|
||||
private PsiFile createFile(final String text, final String name) {
|
||||
if (myTemplate == null || myProject == null) return null;
|
||||
if (myTemplate == null) return null;
|
||||
|
||||
final FileType fileType = myVelocityFileType;
|
||||
if (fileType == FileTypes.UNKNOWN) return null;
|
||||
@@ -388,7 +391,7 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
}
|
||||
|
||||
private EditorHighlighter createHighlighter() {
|
||||
if (myTemplate != null && myProject != null && myVelocityFileType != FileTypes.UNKNOWN) {
|
||||
if (myTemplate != null && myVelocityFileType != FileTypes.UNKNOWN) {
|
||||
return EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, new LightVirtualFile("aaa." + myTemplate.getExtension() + ".ft"));
|
||||
}
|
||||
|
||||
@@ -399,38 +402,27 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
if (fileType == null) {
|
||||
fileType = FileTypes.PLAIN_TEXT;
|
||||
}
|
||||
|
||||
SyntaxHighlighter originalHighlighter = SyntaxHighlighterFactory.getSyntaxHighlighter(fileType, null, null);
|
||||
if (originalHighlighter == null) originalHighlighter = new PlainSyntaxHighlighter();
|
||||
return new LexerEditorHighlighter(new TemplateHighlighter(originalHighlighter), EditorColorsManager.getInstance().getGlobalScheme());
|
||||
if (originalHighlighter == null) {
|
||||
originalHighlighter = new PlainSyntaxHighlighter();
|
||||
}
|
||||
|
||||
final EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme();
|
||||
LayeredLexerEditorHighlighter highlighter = new LayeredLexerEditorHighlighter(new TemplateHighlighter(), scheme);
|
||||
highlighter.registerLayer(FileTemplateTokenType.TEXT, new LayerDescriptor(originalHighlighter, ""));
|
||||
return highlighter;
|
||||
}
|
||||
|
||||
private final static TokenSet TOKENS_TO_MERGE = TokenSet.create(FileTemplateTokenType.TEXT);
|
||||
|
||||
private static class TemplateHighlighter extends SyntaxHighlighterBase {
|
||||
private final Lexer myLexer;
|
||||
private final SyntaxHighlighter myOriginalHighlighter;
|
||||
|
||||
public TemplateHighlighter(SyntaxHighlighter original) {
|
||||
myOriginalHighlighter = original;
|
||||
Lexer originalLexer = original.getHighlightingLexer();
|
||||
Lexer templateLexer = new FlexAdapter(new FileTemplateTextLexer());
|
||||
templateLexer = new MergingLexerAdapter(templateLexer, TOKENS_TO_MERGE);
|
||||
|
||||
myLexer = new CompositeLexer(originalLexer, templateLexer) {
|
||||
@Override
|
||||
protected IElementType getCompositeTokenType(IElementType type1, IElementType type2) {
|
||||
if (type2 == FileTemplateTokenType.MACRO || type2 == FileTemplateTokenType.DIRECTIVE) {
|
||||
return type2;
|
||||
}
|
||||
else {
|
||||
return type1;
|
||||
}
|
||||
}
|
||||
};
|
||||
public TemplateHighlighter() {
|
||||
myLexer = new MergingLexerAdapter(new FlexAdapter(new FileTemplateTextLexer()), TokenSet.create(FileTemplateTokenType.TEXT));
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@Override
|
||||
public Lexer getHighlightingLexer() {
|
||||
return myLexer;
|
||||
}
|
||||
@@ -438,14 +430,11 @@ public class FileTemplateConfigurable implements Configurable, Configurable.NoSc
|
||||
@Override
|
||||
@NotNull
|
||||
public TextAttributesKey[] getTokenHighlights(IElementType tokenType) {
|
||||
if (tokenType == FileTemplateTokenType.MACRO) {
|
||||
return pack(myOriginalHighlighter.getTokenHighlights(tokenType), TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
|
||||
}
|
||||
else if (tokenType == FileTemplateTokenType.DIRECTIVE) {
|
||||
return pack(myOriginalHighlighter.getTokenHighlights(tokenType), TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
|
||||
if (tokenType == FileTemplateTokenType.MACRO || tokenType == FileTemplateTokenType.DIRECTIVE) {
|
||||
return pack(TemplateColors.TEMPLATE_VARIABLE_ATTRIBUTES);
|
||||
}
|
||||
|
||||
return myOriginalHighlighter.getTokenHighlights(tokenType);
|
||||
return EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,19 +43,23 @@ public abstract class ShowSettingsUtil {
|
||||
|
||||
public abstract boolean editConfigurable(@Nullable Component parent, @NotNull Configurable configurable);
|
||||
|
||||
public abstract boolean editConfigurable(Component parent, Configurable configurable, Runnable advancedInitialization);
|
||||
public abstract boolean editConfigurable(Component parent, Configurable configurable, @NotNull Runnable advancedInitialization);
|
||||
|
||||
public abstract boolean editConfigurable(Project project, @NonNls String dimensionServiceKey, Configurable configurable);
|
||||
|
||||
public abstract boolean editConfigurable(Project project, @NonNls String dimensionServiceKey, Configurable configurable, boolean showApplyButton);
|
||||
|
||||
public abstract boolean editConfigurable(Component parent, String dimensionServiceKey, Configurable configurable);
|
||||
|
||||
/**
|
||||
* @deprecated create a new instance of configurable instead
|
||||
* to remove in IDEA 15
|
||||
*/
|
||||
public abstract <T extends Configurable> T findProjectConfigurable(Project project, Class<T> confClass);
|
||||
|
||||
/**
|
||||
* @deprecated create a new instance of configurable instead
|
||||
* to remove in IDEA 15
|
||||
*/
|
||||
public abstract <T extends Configurable> T findApplicationConfigurable(Class<T> confClass);
|
||||
|
||||
|
||||
@@ -1233,6 +1233,7 @@ public abstract class DialogWrapper {
|
||||
if (SystemInfo.isWindows) {
|
||||
installEnterHook(root);
|
||||
}
|
||||
myErrorTextAlarm.setActivationComponent(root);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1838,15 +1839,14 @@ public abstract class DialogWrapper {
|
||||
return;
|
||||
}
|
||||
myLastErrorText = text;
|
||||
if (myActualSize == null && !StringUtil.isEmpty(text)) {
|
||||
myActualSize = getSize();
|
||||
}
|
||||
|
||||
myErrorTextAlarm.cancelAllRequests();
|
||||
myErrorTextAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final String text = myLastErrorText;
|
||||
if (myActualSize == null && !StringUtil.isEmpty(text)) {
|
||||
myActualSize = getSize();
|
||||
}
|
||||
myErrorText.setError(text);
|
||||
if (text != null && text.length() > myMaxErrorTextLength) {
|
||||
// during the first update, resize only for growing. during a subsequent update,
|
||||
|
||||
@@ -235,7 +235,7 @@ public class JBScrollPane extends JScrollPane {
|
||||
}
|
||||
if (colHead != null) {
|
||||
Rectangle headerBounds = colHead.getBounds();
|
||||
headerBounds.width = viewportBounds.width - headerBounds.x;
|
||||
headerBounds.width = viewportBounds.width;
|
||||
colHead.setBounds(headerBounds);
|
||||
}
|
||||
hideFromView(layout.getCorner(UPPER_RIGHT_CORNER));
|
||||
@@ -249,7 +249,7 @@ public class JBScrollPane extends JScrollPane {
|
||||
}
|
||||
if (rowHead != null) {
|
||||
Rectangle headerBounds = rowHead.getBounds();
|
||||
headerBounds.height = viewportBounds.height - headerBounds.y;
|
||||
headerBounds.height = viewportBounds.height;
|
||||
rowHead.setBounds(headerBounds);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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.ide.actionMacro;
|
||||
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: max
|
||||
* Date: Jul 22, 2003
|
||||
* Time: 3:30:56 PM
|
||||
* To change this template use Options | File Templates.
|
||||
*/
|
||||
public class EditMacrosDialog extends SingleConfigurableEditor {
|
||||
public EditMacrosDialog(@Nullable Project project) {
|
||||
super(project, new ActionMacroConfigurable());
|
||||
}
|
||||
|
||||
protected String getDimensionServiceKey(){
|
||||
return "#com.intellij.ide.actionMacro.EditMacrosDialog";
|
||||
}
|
||||
}
|
||||
+7
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -16,29 +16,22 @@
|
||||
package com.intellij.ide.actionMacro.actions;
|
||||
|
||||
import com.intellij.ide.actionMacro.ActionMacro;
|
||||
import com.intellij.ide.actionMacro.ActionMacroConfigurable;
|
||||
import com.intellij.ide.actionMacro.ActionMacroManager;
|
||||
import com.intellij.ide.actionMacro.EditMacrosDialog;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: max
|
||||
* Date: Jul 22, 2003
|
||||
* Time: 3:33:04 PM
|
||||
* To change this template use Options | File Templates.
|
||||
*/
|
||||
public class EditMacrosAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
EditMacrosDialog dialog = new EditMacrosDialog(CommonDataKeys.PROJECT.getData(e.getDataContext()));
|
||||
dialog.show();
|
||||
ShowSettingsUtil.getInstance().editConfigurable(e.getProject(), "#com.intellij.ide.actionMacro.EditMacrosDialog", new ActionMacroConfigurable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
final ActionMacroManager manager = ActionMacroManager.getInstance();
|
||||
ActionMacro[] macros = manager.getAllMacros();
|
||||
ActionMacro[] macros = ActionMacroManager.getInstance().getAllMacros();
|
||||
e.getPresentation().setEnabled(macros != null && macros.length > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.ide.ui.search.SearchUtil;
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurableGroup;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.options.*;
|
||||
import com.intellij.openapi.options.ex.*;
|
||||
import com.intellij.openapi.options.newEditor.IdeSettingsDialog;
|
||||
import com.intellij.openapi.options.newEditor.OptionsEditor;
|
||||
@@ -31,6 +28,7 @@ import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.navigation.Place;
|
||||
import com.intellij.util.ui.update.Activatable;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -60,6 +58,7 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
if (Registry.is("ide.new.settings.dialog")) {
|
||||
return new IdeSettingsDialog(project, filteredGroups, toSelect);
|
||||
}
|
||||
//noinspection deprecation
|
||||
return Registry.is("ide.perProjectModality")
|
||||
? new OptionsEditorDialog(project, filteredGroups, toSelect, true)
|
||||
: new OptionsEditorDialog(project, filteredGroups, toSelect);
|
||||
@@ -160,8 +159,6 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
public static void showSettingsDialog(@Nullable Project project, final String id2Select, final String filter) {
|
||||
ConfigurableGroup[] group = getConfigurableGroups(project, true);
|
||||
|
||||
Project actualProject = getProject(project);
|
||||
|
||||
group = filterEmptyGroups(group);
|
||||
final Configurable configurable2Select = findConfigurable2Select(id2Select, group);
|
||||
|
||||
@@ -231,17 +228,29 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
|
||||
@Override
|
||||
public <T extends Configurable> T findProjectConfigurable(final Project project, final Class<T> confClass) {
|
||||
//noinspection deprecation
|
||||
return ConfigurableExtensionPointUtil.findProjectConfigurable(project, confClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editConfigurable(Project project, String dimensionServiceKey, @NotNull Configurable configurable) {
|
||||
return editConfigurable(null, project, configurable, dimensionServiceKey, null);
|
||||
return editConfigurable(project, dimensionServiceKey, configurable, isWorthToShowApplyButton(configurable));
|
||||
}
|
||||
|
||||
private static boolean isWorthToShowApplyButton(@NotNull Configurable configurable) {
|
||||
return configurable instanceof Place.Navigator ||
|
||||
configurable instanceof Composite ||
|
||||
configurable instanceof TabbedConfigurable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editConfigurable(Project project, String dimensionServiceKey, @NotNull Configurable configurable, boolean showApplyButton) {
|
||||
return editConfigurable(null, project, configurable, dimensionServiceKey, null, showApplyButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editConfigurable(Project project, Configurable configurable, Runnable advancedInitialization) {
|
||||
return editConfigurable(null, project, configurable, createDimensionKey(configurable), advancedInitialization);
|
||||
return editConfigurable(null, project, configurable, createDimensionKey(configurable), advancedInitialization, isWorthToShowApplyButton(configurable));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,20 +260,21 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
|
||||
@Override
|
||||
public boolean editConfigurable(@Nullable Component parent, @NotNull Configurable configurable, @Nullable Runnable advancedInitialization) {
|
||||
return editConfigurable(parent, null, configurable, createDimensionKey(configurable), advancedInitialization);
|
||||
return editConfigurable(parent, null, configurable, createDimensionKey(configurable), advancedInitialization, isWorthToShowApplyButton(configurable));
|
||||
}
|
||||
|
||||
private static boolean editConfigurable(@Nullable Component parent,
|
||||
@Nullable Project project,
|
||||
@NotNull Configurable configurable,
|
||||
String dimensionKey,
|
||||
@Nullable final Runnable advancedInitialization) {
|
||||
SingleConfigurableEditor editor;
|
||||
@Nullable final Runnable advancedInitialization,
|
||||
boolean showApplyButton) {
|
||||
final SingleConfigurableEditor editor;
|
||||
if (parent == null) {
|
||||
editor = new SingleConfigurableEditor(project, configurable, dimensionKey);
|
||||
editor = new SingleConfigurableEditor(project, configurable, dimensionKey, showApplyButton);
|
||||
}
|
||||
else {
|
||||
editor = new SingleConfigurableEditor(parent, configurable, dimensionKey);
|
||||
editor = new SingleConfigurableEditor(parent, configurable, dimensionKey, showApplyButton);
|
||||
}
|
||||
if (advancedInitialization != null) {
|
||||
new UiNotifyConnector.Once(editor.getContentPane(), new Activatable.Adapter() {
|
||||
@@ -284,8 +294,8 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean editConfigurable(Component parent, String dimensionServiceKey,Configurable configurable) {
|
||||
return editConfigurable(parent, null, configurable, dimensionServiceKey, null);
|
||||
public boolean editConfigurable(Component parent, String dimensionServiceKey, Configurable configurable) {
|
||||
return editConfigurable(parent, null, configurable, dimensionServiceKey, null, isWorthToShowApplyButton(configurable));
|
||||
}
|
||||
|
||||
public boolean isAlreadyShown() {
|
||||
|
||||
@@ -20,18 +20,21 @@ import java.util.List;
|
||||
public abstract class CompositeConfigurable<T extends UnnamedConfigurable> extends BaseConfigurable {
|
||||
private List<T> myConfigurables;
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
for (T configurable : getConfigurables()) {
|
||||
configurable.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply() throws ConfigurationException {
|
||||
for (T configurable : getConfigurables()) {
|
||||
configurable.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
for (T configurable : getConfigurables()) {
|
||||
if (configurable.isModified()) {
|
||||
@@ -41,6 +44,7 @@ public abstract class CompositeConfigurable<T extends UnnamedConfigurable> exten
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeUIResources() {
|
||||
if (myConfigurables != null) {
|
||||
for (final T myConfigurable : myConfigurables) {
|
||||
|
||||
+2
-10
@@ -25,17 +25,13 @@ import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.application.PathMacros;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.ex.SingleConfigurableEditor;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.WaitForProgressToShow;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.*;
|
||||
|
||||
public class ProjectMacrosUtil {
|
||||
@@ -50,11 +46,7 @@ public class ProjectMacrosUtil {
|
||||
if (application.isHeadlessEnvironment() || application.isUnitTestMode()) {
|
||||
throw new RuntimeException(text + ": " + StringUtil.join(undefinedMacros, ", "));
|
||||
}
|
||||
final UndefinedMacrosConfigurable configurable =
|
||||
new UndefinedMacrosConfigurable(text, undefinedMacros);
|
||||
final SingleConfigurableEditor editor = new SingleConfigurableEditor(project, configurable);
|
||||
editor.show();
|
||||
return editor.isOK();
|
||||
return ShowSettingsUtil.getInstance().editConfigurable(project, new UndefinedMacrosConfigurable(text, undefinedMacros));
|
||||
}
|
||||
|
||||
public static boolean checkNonIgnoredMacros(final Project project, final Set<String> usedMacros){
|
||||
|
||||
@@ -136,7 +136,8 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
}
|
||||
|
||||
fsItem.getParent().removeChild(fsItem);
|
||||
((FSDir)newParentItem).addChild(fsItem);
|
||||
newDir.addChild(fsItem);
|
||||
fsItem.myParent = newDir;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -263,7 +264,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
}
|
||||
|
||||
private abstract static class FSItem {
|
||||
private final FSDir myParent;
|
||||
private FSDir myParent;
|
||||
private String myName;
|
||||
private long myTimestamp;
|
||||
private boolean myWritable;
|
||||
|
||||
@@ -298,6 +298,7 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
|
||||
|
||||
protected void processKeyEvent(KeyEvent e) {
|
||||
if (e.isAltDown()) return;
|
||||
if (e.isShiftDown() && isNavigationKey(e.getKeyCode())) return;
|
||||
if (mySearchPopup != null) {
|
||||
mySearchPopup.processKeyEvent(e);
|
||||
return;
|
||||
@@ -499,6 +500,15 @@ public abstract class SpeedSearchBase<Comp extends JComponent> extends SpeedSear
|
||||
return keyCode == KeyEvent.VK_HOME || keyCode == KeyEvent.VK_END || keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN;
|
||||
}
|
||||
|
||||
private static boolean isPgUpPgDown(int keyCode) {
|
||||
return keyCode == KeyEvent.VK_PAGE_UP || keyCode == KeyEvent.VK_PAGE_DOWN;
|
||||
}
|
||||
|
||||
private static boolean isNavigationKey(int keyCode) {
|
||||
return isPgUpPgDown(keyCode) || isUpDownHomeEnd(keyCode);
|
||||
}
|
||||
|
||||
|
||||
private void manageSearchPopup(@Nullable SearchPopup searchPopup) {
|
||||
Project project = null;
|
||||
if (ApplicationManager.getApplication() != null && !ApplicationManager.getApplication().isDisposed()) {
|
||||
|
||||
@@ -676,6 +676,11 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
|
||||
dataProviders.add(provider);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DataProvider getDataProvider() {
|
||||
return myComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChange(@NotNull PropertyChangeEvent event) {
|
||||
if (Content.PROP_COMPONENT.equals(event.getPropertyName())) {
|
||||
|
||||
+2
-7
@@ -127,21 +127,16 @@ public class CloudAccountSelectionEditor {
|
||||
}
|
||||
};
|
||||
|
||||
final SingleConfigurableEditor configurableEditor
|
||||
= new SingleConfigurableEditor(myMainPanel, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable), false) {
|
||||
|
||||
if (!new SingleConfigurableEditor(myMainPanel, configurable, ShowSettingsUtilImpl.createDimensionKey(configurable), false) {
|
||||
{
|
||||
errorConsumerRef.set(new Consumer<String>() {
|
||||
|
||||
@Override
|
||||
public void consume(String s) {
|
||||
setErrorText(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (!configurableEditor.showAndGet()) {
|
||||
}.showAndGet()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+3
-13
@@ -3,7 +3,6 @@ package com.intellij.structuralsearch.plugin.ui;
|
||||
import com.intellij.codeInsight.hint.TooltipController;
|
||||
import com.intellij.codeInsight.hint.TooltipGroup;
|
||||
import com.intellij.codeInsight.template.TemplateContextType;
|
||||
import com.intellij.codeInsight.template.impl.TemplateContext;
|
||||
import com.intellij.codeInsight.template.impl.TemplateEditorUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
@@ -77,12 +76,8 @@ public class UIUtil {
|
||||
else {
|
||||
((EditorEx)editor).setEmbeddedIntoDialogWrapper(true);
|
||||
}
|
||||
|
||||
if (contextType != null) {
|
||||
TemplateContext context = new TemplateContext();
|
||||
context.setEnabled(contextType, true);
|
||||
TemplateEditorUtil.setHighlighter(editor, context);
|
||||
}
|
||||
|
||||
TemplateEditorUtil.setHighlighter(editor, contextType);
|
||||
|
||||
if (addToolTipForVariableHandler) {
|
||||
SubstitutionShortInfoHandler handler = new SubstitutionShortInfoHandler(editor);
|
||||
@@ -222,11 +217,6 @@ public class UIUtil {
|
||||
}
|
||||
|
||||
public static void updateHighlighter(Editor editor, StructuralSearchProfile profile) {
|
||||
final TemplateContextType contextType = profile.getTemplateContextType();
|
||||
if (contextType != null) {
|
||||
TemplateContext context = new TemplateContext();
|
||||
context.setEnabled(contextType, true);
|
||||
TemplateEditorUtil.setHighlighter(editor, context);
|
||||
}
|
||||
TemplateEditorUtil.setHighlighter(editor, profile.getTemplateContextType());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ ide.checkDuplicateMnemonics.description=Check for duplicate mnemonics.
|
||||
ide.dnd.textHints=false
|
||||
ide.max.recent.projects=25
|
||||
|
||||
ide.hide.excluded.files=true
|
||||
ide.hide.excluded.files=false
|
||||
ide.hide.excluded.files.restartRequired=true
|
||||
ide.hide.excluded.files.description=Do not show excluded files in Project View and exclude them from VCS
|
||||
|
||||
|
||||
+4
-7
@@ -20,11 +20,8 @@
|
||||
package com.intellij.lang.properties.editor;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewTreeElement;
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.lang.properties.PropertiesHighlighter;
|
||||
import com.intellij.lang.properties.PropertiesUtil;
|
||||
import com.intellij.lang.properties.*;
|
||||
import com.intellij.lang.properties.ResourceBundle;
|
||||
import com.intellij.lang.properties.psi.Property;
|
||||
import com.intellij.navigation.ColoredItemPresentation;
|
||||
import com.intellij.navigation.ItemPresentation;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
@@ -62,7 +59,7 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView
|
||||
|
||||
@Override
|
||||
public PsiElement[] getPsiElements() {
|
||||
return new PsiElement[] {getProperty().getPsiElement()};
|
||||
return new PsiElement[] {getValue()};
|
||||
}
|
||||
|
||||
public void setPresentableName(final String presentableName) {
|
||||
@@ -70,8 +67,8 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getValue() {
|
||||
return (Property)myProperty.getPsiElement();
|
||||
public PsiElement getValue() {
|
||||
return myProperty.getPsiElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
|
||||
TreeElement[] children = myStructureViewComponent.getTreeModel().getRoot().getChildren();
|
||||
if (children.length != 0) {
|
||||
TreeElement child = children[0];
|
||||
String propName = ((ResourceBundlePropertyStructureViewElement)child).getValue().getUnescapedKey();
|
||||
String propName = ((ResourceBundlePropertyStructureViewElement)child).getProperty().getUnescapedKey();
|
||||
setState(new ResourceBundleEditorState(propName));
|
||||
}
|
||||
myDataProviderPanel = new DataProviderPanel(splitPanel);
|
||||
@@ -248,7 +248,7 @@ public class ResourceBundleEditor extends UserDataHolderBase implements FileEdit
|
||||
DefaultMutableTreeNode node = toCheck.pop();
|
||||
final ResourceBundleEditorViewElement element = getSelectedElement(node);
|
||||
String value = element instanceof ResourceBundlePropertyStructureViewElement
|
||||
? ((ResourceBundlePropertyStructureViewElement)element).getValue().getUnescapedKey()
|
||||
? ((ResourceBundlePropertyStructureViewElement)element).getProperty().getUnescapedKey()
|
||||
: null;
|
||||
if (propertyName.equals(value)) {
|
||||
nodeToSelect = node;
|
||||
|
||||
+24
-2
@@ -191,11 +191,22 @@ public class SearchingForTestsTask extends Task.Backgroundable {
|
||||
|
||||
private void composeTestSuiteFromClasses() {
|
||||
Map<String, Collection<String>> map = new HashMap<String, Collection<String>>();
|
||||
|
||||
final boolean findTestMethodsForClass = shouldSearchForTestMethods();
|
||||
|
||||
for (final Map.Entry<PsiClass, Collection<PsiMethod>> entry : myClasses.entrySet()) {
|
||||
Collection<String> methods = new HashSet<String>(entry.getValue().size());
|
||||
for (PsiMethod method : entry.getValue()) {
|
||||
final Collection<PsiMethod> depMethods = entry.getValue();
|
||||
Collection<String> methods = new HashSet<String>(depMethods.size());
|
||||
for (PsiMethod method : depMethods) {
|
||||
methods.add(method.getName());
|
||||
}
|
||||
if (findTestMethodsForClass && depMethods.isEmpty()) {
|
||||
for (PsiMethod method : entry.getKey().getMethods()) {
|
||||
if (TestNGUtil.hasTest(method)) {
|
||||
methods.add(method.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
map.put(ApplicationManager.getApplication().runReadAction(
|
||||
new Computable<String>() {
|
||||
@Nullable
|
||||
@@ -243,6 +254,17 @@ public class SearchingForTestsTask extends Task.Backgroundable {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldSearchForTestMethods() {
|
||||
boolean dependantMethods = false;
|
||||
for (Collection<PsiMethod> methods : myClasses.values()) {
|
||||
if (!methods.isEmpty()) {
|
||||
dependantMethods = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return dependantMethods;
|
||||
}
|
||||
|
||||
private void composeTestSuiteFromXml() throws CantRunException {
|
||||
final Map<String, String> buildTestParams = buildTestParameters();
|
||||
try {
|
||||
|
||||
+1
-14
@@ -144,19 +144,6 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
if (mySearchForTestIndicator != null && !mySearchForTestIndicator.isCanceled()) {
|
||||
task.finish();
|
||||
}
|
||||
|
||||
final Runnable notificationRunnable = new Runnable() {
|
||||
public void run() {
|
||||
final Project project = config.getProject();
|
||||
if (project.isDisposed()) return;
|
||||
|
||||
final TestConsoleProperties consoleProperties = console.getProperties();
|
||||
if (consoleProperties == null) return;
|
||||
final TestNGResults resultsView = console.getResultsView();
|
||||
TestsUIUtil.notifyByBalloon(project, myStarted, console.getResultsView().getRoot(), consoleProperties, "in " + resultsView.getTime());
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater(notificationRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,7 +162,7 @@ public class TestNGRunnableState extends JavaCommandLineState {
|
||||
public void processWillTerminate(ProcessEvent event, boolean willBeDestroyed) {
|
||||
final TestNGResults resultsView = console.getResultsView();
|
||||
if (resultsView != null) {
|
||||
resultsView.finish();
|
||||
resultsView.finish(myStarted);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+19
-2
@@ -23,12 +23,14 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.theoryinpractice.testng.util.TestNGUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -83,10 +85,25 @@ public class DependsOnMethodInspection extends BaseJavaLocalInspectionTool
|
||||
}
|
||||
}
|
||||
}
|
||||
Matcher matcher = PATTERN.matcher(text);
|
||||
final Set<String> names = new HashSet<String>();
|
||||
final Matcher matcher = PATTERN.matcher(text);
|
||||
int idx = 0;
|
||||
while (matcher.find()) {
|
||||
String methodName = matcher.group(1);
|
||||
String methodName = matcher.group(1);
|
||||
if (!names.add(methodName)) {
|
||||
PsiAnnotationMemberValue element2Highlight = value;
|
||||
if (value instanceof PsiArrayInitializerMemberValue) {
|
||||
final PsiAnnotationMemberValue[] initializers = ((PsiArrayInitializerMemberValue)value).getInitializers();
|
||||
if (idx < initializers.length) {
|
||||
element2Highlight = initializers[idx];
|
||||
}
|
||||
}
|
||||
problemDescriptors.add(manager.createProblemDescriptor(element2Highlight, "Duplicated method name: " + methodName,
|
||||
(LocalQuickFix)null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
isOnTheFly));
|
||||
}
|
||||
checkMethodNameDependency(manager, psiClass, methodName, value, problemDescriptors, isOnTheFly);
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,10 +48,6 @@ public class TestNGRemoteListener implements IRemoteSuiteListener, IRemoteTestLi
|
||||
public void onFinish(SuiteMessage suiteMessage) {
|
||||
unboundOutputRoot.flush();
|
||||
console.finish();
|
||||
final TestNGResults view = console.getResultsView();
|
||||
if (view != null) {
|
||||
view.finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void onStart(TestMessage tm) {
|
||||
|
||||
@@ -378,7 +378,7 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn
|
||||
rootNode.setStarted(true);
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
public void finish(final boolean started) {
|
||||
if (start > 0) {
|
||||
end = System.currentTimeMillis();
|
||||
}
|
||||
@@ -409,6 +409,7 @@ public class TestNGResults extends TestResultsPanel implements TestFrameworkRunn
|
||||
}
|
||||
}
|
||||
tree.repaint();
|
||||
TestsUIUtil.notifyByBalloon(project, started, rootNode, getProperties(), "in " + getTime());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user