Merge branch 'master' of git@git.labs.intellij.net:idea/community

This commit is contained in:
Eugene Kudelevsky
2010-10-21 20:03:06 +04:00
61 changed files with 335 additions and 323 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

+1
View File
@@ -196,6 +196,7 @@ def layoutLinux(Map args, String home, Paths paths) {
fileset(dir: "$home/bin") { include(name: "*.*") }
fileset(dir: "$home/bin/linux") { include(name: "*.*") }
fileset(dir: "$home/bin/nix") { include(name: "*.*") }
fileset(dir: "$home/build/images")
}
}
+1 -1
View File
@@ -27,7 +27,7 @@
</application-components>
<actions>
<action class="org.intellij.images.actions.EditExternalyAction"
<action class="org.intellij.images.actions.EditExternallyAction"
id="Images.EditExternaly"
icon="/org/intellij/images/icons/EditExternaly.png"
text="Open image in external editor">
@@ -0,0 +1,124 @@
/*
* 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 org.intellij.images.actions;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.EnvironmentUtil;
import org.intellij.images.ImagesBundle;
import org.intellij.images.fileTypes.ImageFileTypeManager;
import org.intellij.images.options.Options;
import org.intellij.images.options.OptionsManager;
import org.intellij.images.options.impl.OptionsConfigurabe;
import java.io.File;
import java.util.Map;
import java.util.Set;
/**
* Open image file externally.
*
* @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
*/
public final class EditExternallyAction extends AnAction {
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
Options options = OptionsManager.getInstance().getOptions();
String executablePath = options.getExternalEditorOptions().getExecutablePath();
if (StringUtil.isEmpty(executablePath)) {
Messages.showErrorDialog(project,
ImagesBundle.message("error.empty.external.editor.path"),
ImagesBundle.message("error.title.empty.external.editor.path"));
OptionsConfigurabe.show(project);
}
else {
if (files != null) {
Map<String, String> env = EnvironmentUtil.getEnviromentProperties();
Set<String> varNames = env.keySet();
for (String varName : varNames) {
if (SystemInfo.isWindows) {
executablePath = StringUtil.replace(executablePath, "%" + varName + "%", env.get(varName), true);
}
else {
executablePath = StringUtil.replace(executablePath, "${" + varName + "}", env.get(varName), false);
}
}
executablePath = FileUtil.toSystemDependentName(executablePath);
File executable = new File(executablePath);
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(executable.exists() ? executable.getAbsolutePath() : executablePath);
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
for (VirtualFile file : files) {
if (file.isInLocalFileSystem() && typeManager.isImage(file)) {
commandLine.addParameter(VfsUtil.virtualToIoFile(file).getAbsolutePath());
}
}
commandLine.setWorkingDirectory(new File(executablePath).getParentFile());
try {
commandLine.createProcess();
}
catch (ExecutionException ex) {
Messages.showErrorDialog(project,
ex.getLocalizedMessage(),
ImagesBundle.message("error.title.launching.external.editor"));
OptionsConfigurabe.show(project);
}
}
}
}
public void update(AnActionEvent e) {
super.update(e);
VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
final boolean isEnabled = isImages(files);
if (e.getPlace().equals(ActionPlaces.PROJECT_VIEW_POPUP)) {
e.getPresentation().setVisible(isEnabled);
}
else {
e.getPresentation().setEnabled(isEnabled);
}
}
private static boolean isImages(VirtualFile[] files) {
boolean isImagesFound = false;
if (files != null) {
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
for (VirtualFile file : files) {
boolean isImage = typeManager.isImage(file);
isImagesFound |= isImage;
if (!file.isInLocalFileSystem() || !isImage) {
return false;
}
}
}
return isImagesFound;
}
}
@@ -1,123 +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.
*/
/** $Id$ */
package org.intellij.images.actions;
import com.intellij.openapi.actionSystem.ActionPlaces;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.EnvironmentUtil;
import org.intellij.images.ImagesBundle;
import org.intellij.images.fileTypes.ImageFileTypeManager;
import org.intellij.images.options.Options;
import org.intellij.images.options.OptionsManager;
import org.intellij.images.options.impl.OptionsConfigurabe;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
/**
* Open image file externaly.
*
* @author <a href="mailto:aefimov.box@gmail.com">Alexey Efimov</a>
*/
public final class EditExternalyAction extends AnAction {
public void actionPerformed(AnActionEvent e) {
Project project = e.getData(PlatformDataKeys.PROJECT);
VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
Options options = OptionsManager.getInstance().getOptions();
String executablePath = options.getExternalEditorOptions().getExecutablePath();
if (StringUtil.isEmpty(executablePath)) {
Messages.showErrorDialog(project,
ImagesBundle.message("error.empty.external.editor.path"),
ImagesBundle.message("error.title.empty.external.editor.path"));
OptionsConfigurabe.show(project);
} else {
if (files != null) {
Map<String, String> env = EnvironmentUtil.getEnviromentProperties();
Set<String> varNames = env.keySet();
for (String varName : varNames) {
if (SystemInfo.isWindows) {
executablePath = StringUtil.replace(executablePath, "%" + varName + "%", env.get(varName), true);
} else {
executablePath = StringUtil.replace(executablePath, "${" + varName + "}", env.get(varName), false);
}
}
executablePath = FileUtil.toSystemDependentName(executablePath);
File executable = new File(executablePath);
StringBuffer commandLine = new StringBuffer(executable.exists() ? executable.getAbsolutePath() : executablePath);
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
for (VirtualFile file : files) {
if (file.isInLocalFileSystem() && typeManager.isImage(file)) {
commandLine.append(" \"");
commandLine.append(VfsUtil.virtualToIoFile(file).getAbsolutePath());
commandLine.append('\"');
}
}
try {
File executableFile = new File(executablePath);
Runtime.getRuntime().exec(commandLine.toString(), null, executableFile.getParentFile());
} catch (IOException ex) {
Messages.showErrorDialog(project,
ex.getLocalizedMessage(),
ImagesBundle.message("error.title.launching.external.editor"));
OptionsConfigurabe.show(project);
}
}
}
}
public void update(AnActionEvent e) {
super.update(e);
VirtualFile[] files = e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY);
final boolean isEnabled = isImages(files);
if (e.getPlace().equals(ActionPlaces.PROJECT_VIEW_POPUP)) {
e.getPresentation().setVisible(isEnabled);
}
else {
e.getPresentation().setEnabled(isEnabled);
}
}
private static boolean isImages(VirtualFile[] files) {
boolean isImagesFound = false;
if (files != null) {
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
for (VirtualFile file : files) {
boolean isImage = typeManager.isImage(file);
isImagesFound |= isImage;
if (!file.isInLocalFileSystem() || !isImage) {
return false;
}
}
}
return isImagesFound;
}
}
@@ -180,7 +180,7 @@ public class BuildPropertiesImpl extends BuildProperties {
}
}
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
add(new Property(PROPERTY_PROJECT_JDK_HOME, projectJdk != null ? propertyRef(getJdkHomeProperty(projectJdk.getName())) : ""), 1);
add(new Property(PROPERTY_PROJECT_JDK_BIN, projectJdk != null ? propertyRef(getJdkBinProperty(projectJdk.getName())) : ""));
add(new Property(PROPERTY_PROJECT_JDK_CLASSPATH, projectJdk != null ? getJdkPathId(projectJdk.getName()) : ""));
@@ -49,7 +49,7 @@ public class JreVersionDetector {
return isJre50(jdk);
}
final Sdk projectJdk = ProjectRootManager.getInstance(configuration.getProject()).getProjectJdk();
final Sdk projectJdk = ProjectRootManager.getInstance(configuration.getProject()).getProjectSdk();
return isJre50(projectJdk);
}
}
@@ -19,6 +19,7 @@
*/
package com.intellij.ide.impl;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.util.newProjectWizard.AddModuleWizard;
import com.intellij.ide.util.projectWizard.ProjectBuilder;
@@ -177,7 +178,7 @@ public class NewProjectUtil {
if (versionString == null) return;
ProjectRootManagerEx rootManager = ProjectRootManagerEx.getInstanceEx(project);
rootManager.setProjectJdk(jdk);
rootManager.setProjectSdk(jdk);
LanguageLevel level = LanguageLevelUtil.getDefaultLanguageLevel(versionString);
LanguageLevelProjectExtension ext = LanguageLevelProjectExtension.getInstance(project);
if (level.compareTo(ext.getLanguageLevel()) < 0) {
@@ -188,13 +189,16 @@ public class NewProjectUtil {
public static void closePreviousProject(final Project projectToClose) {
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (openProjects.length > 0) {
int exitCode = Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.new.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe")}, 1, 0,
Messages.getQuestionIcon());
final GeneralSettings settings = GeneralSettings.getInstance();
int exitCode = settings.getConfirmOpenNewProject();
if (exitCode < 0) {
exitCode = Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.new.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe")}, 1, 0,
Messages.getQuestionIcon(), new ProjectNewWindowDoNotAskOption());
}
if (exitCode == 1) { // "No" option
ProjectUtil.closeProject(projectToClose != null ? projectToClose : openProjects[openProjects.length - 1]);
}
}
}
}
@@ -301,7 +301,7 @@ public class AddModuleWizard extends AbstractWizard<ModuleWizardStep> {
return context.getProjectJdk();
}
final Project project = context.getProject() == null ? ProjectManager.getInstance().getDefaultProject() : context.getProject();
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (projectJdk != null) {
return projectJdk;
}
@@ -223,14 +223,14 @@ public class JdkChooserPanel extends JPanel {
}
public static Sdk chooseAndSetJDK(final Project project) {
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
final Sdk jdk = showDialog(project, ProjectBundle.message("module.libraries.target.jdk.select.title"), WindowManagerEx.getInstanceEx().getFrame(project), projectJdk);
if (jdk == null) {
return null;
}
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectRootManager.getInstance(project).setProjectJdk(jdk);
ProjectRootManager.getInstance(project).setProjectSdk(jdk);
}
});
return jdk;
@@ -149,7 +149,7 @@ public class ProjectJdkForModuleStep extends ModuleWizardStep {
@Nullable
private static Sdk getDefaultJdk() {
Project defaultProject = ProjectManagerEx.getInstanceEx().getDefaultProject();
return ProjectRootManagerEx.getInstanceEx(defaultProject).getProjectJdk();
return ProjectRootManagerEx.getInstanceEx(defaultProject).getProjectSdk();
}
@@ -86,7 +86,7 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
myFreeze = true;
final Sdk projectJdk = myJdksModel.getProjectSdk();
myCbProjectJdk.reloadModel(new JdkComboBox.NoneJdkComboBoxItem(), myProject);
final String sdkName = projectJdk == null ? ProjectRootManager.getInstance(myProject).getProjectJdkName() : projectJdk.getName();
final String sdkName = projectJdk == null ? ProjectRootManager.getInstance(myProject).getProjectSdkName() : projectJdk.getName();
if (sdkName != null) {
final Sdk jdk = myJdksModel.findSdk(sdkName);
if (jdk != null) {
@@ -135,18 +135,18 @@ public class ProjectJdkConfigurable implements UnnamedConfigurable {
}
public boolean isModified() {
final Sdk projectJdk = ProjectRootManager.getInstance(myProject).getProjectJdk();
final Sdk projectJdk = ProjectRootManager.getInstance(myProject).getProjectSdk();
return !Comparing.equal(projectJdk, getSelectedProjectJdk());
}
public void apply() throws ConfigurationException {
ProjectRootManager.getInstance(myProject).setProjectJdk(getSelectedProjectJdk());
ProjectRootManager.getInstance(myProject).setProjectSdk(getSelectedProjectJdk());
}
public void reset() {
reloadModel();
final String sdkName = ProjectRootManager.getInstance(myProject).getProjectJdkName();
final String sdkName = ProjectRootManager.getInstance(myProject).getProjectSdkName();
if (sdkName != null) {
final Sdk jdk = myJdksModel.findSdk(sdkName);
if (jdk != null) {
@@ -72,7 +72,7 @@ public class UIRootConfigurationAccessor extends RootConfigurationAccessor {
@Nullable
public String getProjectSdkName(final Project project) {
final String projectJdkName = ProjectRootManager.getInstance(project).getProjectJdkName();
final String projectJdkName = ProjectRootManager.getInstance(project).getProjectSdkName();
final Sdk projectJdk = getProjectSdk(project);
if (projectJdk != null) {
return projectJdk.getName();
@@ -168,7 +168,7 @@ public class JdkListConfigurable extends BaseStructureConfigurable {
}
if (myJdksTreeModel.isModified() || modifiedJdks) myJdksTreeModel.apply(this);
myJdksTreeModel.setProjectSdk(ProjectRootManager.getInstance(myProject).getProjectJdk());
myJdksTreeModel.setProjectSdk(ProjectRootManager.getInstance(myProject).getProjectSdk());
}
public boolean isModified() {
@@ -124,7 +124,7 @@ public abstract class ProjectOpenProcessorBase extends ProjectOpenProcessor {
wizardContext.setProjectFileDirectory(virtualFile.getParent().getPath());
Project defaultProject = ProjectManager.getInstance().getDefaultProject();
Sdk jdk = ProjectRootManager.getInstance(defaultProject).getProjectJdk();
Sdk jdk = ProjectRootManager.getInstance(defaultProject).getProjectSdk();
if (jdk == null) {
jdk = ProjectJdkTable.getInstance().findMostRecentSdkOfType(JavaSdk.getInstance());
}
@@ -110,7 +110,7 @@ public class IncreaseLanguageLevelFix implements IntentionAction {
@Nullable
private static Sdk getRelevantJdk(final Project project, @Nullable Module module) {
Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
Sdk moduleJdk = module == null ? null : ModuleRootManager.getInstance(module).getSdk();
return moduleJdk == null ? projectJdk : moduleJdk;
}
@@ -120,7 +120,7 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
if (isBadSdk(project, modules)) {
System.err.println(InspectionsBundle.message("inspection.no.jdk.error.message"));
System.err.println(
InspectionsBundle.message("offline.inspections.jdk.not.found", ProjectRootManager.getInstance(project).getProjectJdkName()));
InspectionsBundle.message("offline.inspections.jdk.not.found", ProjectRootManager.getInstance(project).getProjectSdkName()));
return false;
}
for (Module module : modules) {
@@ -152,7 +152,7 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
private static boolean isBadSdk(final Project project, final Module[] modules) {
boolean anyModuleAcceptsSdk = false;
boolean anyModuleUsesProjectSdk = false;
Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectJdk();
Sdk projectSdk = ProjectRootManager.getInstance(project).getProjectSdk();
for (Module module : modules) {
if (ModuleRootManager.getInstance(module).isSdkInherited()) {
anyModuleUsesProjectSdk = true;
@@ -34,7 +34,7 @@ public class InheritedJdkTest extends ModuleTestCase {
@Override
public void run() {
final ProjectRootManagerEx rootManagerEx = ProjectRootManagerEx.getInstanceEx(myProject);
rootManagerEx.setProjectJdkName(jdk.getName());
rootManagerEx.setProjectSdkName(jdk.getName());
final ModifiableRootModel rootModel = rootManager.getModifiableModel();
rootModel.inheritSdk();
rootModel.commit();
@@ -102,7 +102,7 @@ public class InheritedJdkTest extends ModuleTestCase {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
projectRootManager.setProjectJdk(mockJdk);
projectRootManager.setProjectSdk(mockJdk);
}
});
@@ -112,7 +112,7 @@ public class InheritedJdkTest extends ModuleTestCase {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run() {
projectRootManager.setProjectJdkName("jdk1");
projectRootManager.setProjectSdkName("jdk1");
}
});
@@ -99,7 +99,7 @@ public class RootsChangedTest extends ModuleTestCase {
ProjectJdkTable.getInstance().addJdk(jdk);
assertEventsCount(0);
ProjectRootManager.getInstance(myProject).setProjectJdk(jdkBBB);
ProjectRootManager.getInstance(myProject).setProjectSdk(jdkBBB);
assertEventsCount(0);
final ModifiableRootModel rootModelA = ModuleRootManager.getInstance(moduleA).getModifiableModel();
@@ -109,7 +109,7 @@ public class RootsChangedTest extends ModuleTestCase {
ProjectRootManager.getInstance(myProject).multiCommit(new ModifiableRootModel[]{rootModelA, rootModelB});
assertEventsCount(1);
ProjectRootManager.getInstance(myProject).setProjectJdk(jdk);
ProjectRootManager.getInstance(myProject).setProjectSdk(jdk);
assertEventsCount(1);
final SdkModificator sdkModificator = jdk.getSdkModificator();
@@ -56,7 +56,7 @@ public class WizardContext {
public WizardContext(Project project) {
myProject = project;
if (myProject != null){
myProjectJdk = ProjectRootManager.getInstance(myProject).getProjectJdk();
myProjectJdk = ProjectRootManager.getInstance(myProject).getProjectSdk();
}
}
@@ -65,8 +65,8 @@ public interface ModuleRootModel {
* Returns <code>true</code> if JDK for this module is inherited from a project.
*
* @return true if the JDK is inherited, false otherwise
* @see ProjectRootManager#getProjectJdk()
* @see ProjectRootManager#setProjectJdk(com.intellij.openapi.projectRoots.Sdk)
* @see ProjectRootManager#getProjectSdk()
* @see ProjectRootManager#setProjectSdk(com.intellij.openapi.projectRoots.Sdk)
*/
boolean isSdkInherited();
@@ -124,28 +124,28 @@ public abstract class ProjectRootManager implements ModificationTracker {
* to any existing JDK instance.
*/
@Nullable
public abstract Sdk getProjectJdk();
public abstract Sdk getProjectSdk();
/**
* Returns the name of the JDK selected for the project.
*
* @return the JDK name.
*/
public abstract String getProjectJdkName();
public abstract String getProjectSdkName();
/**
* Sets the JDK to be used for the project.
*
* @param jdk the JDK instance.
*/
public abstract void setProjectJdk(@Nullable Sdk jdk);
public abstract void setProjectSdk(@Nullable Sdk jdk);
/**
* Sets the name of the JDK to be used for the project.
*
* @param name the name of the JDK.
*/
public abstract void setProjectJdkName(String name);
public abstract void setProjectSdkName(String name);
/**
* Commits the change to the lists of roots for the specified modules.
@@ -177,14 +177,14 @@ public class OrderEntryCellAppearanceUtils {
public static CellAppearance forProjectJdk(final Project project) {
final ProjectRootManager projectRootManager = ProjectRootManager.getInstance(project);
final Sdk projectJdk = projectRootManager.getProjectJdk();
final Sdk projectJdk = projectRootManager.getProjectSdk();
final CellAppearance appearance;
if (projectJdk != null) {
appearance = forJdk(projectJdk, false, false);
}
else {
// probably invalid JDK
final String projectJdkName = projectRootManager.getProjectJdkName();
final String projectJdkName = projectRootManager.getProjectSdkName();
if (projectJdkName != null) {
appearance = SimpleTextCellAppearance.invalid(ProjectBundle.message("jdk.combo.box.invalid.item", projectJdkName),
CellAppearanceUtils.INVALID_ICON);
@@ -199,7 +199,6 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler {
LookupImpl lookup = (LookupImpl)LookupManager.getInstance(editor.getProject()).createLookup(editor, LookupElement.EMPTY_ARRAY, "", LookupArranger.DEFAULT);
if (editor.isOneLineMode()) {
lookup.setForceShowAsPopup(true);
lookup.setCancelOnClickOutside(true);
lookup.setCancelOnOtherWindowOpen(true);
lookup.setResizable(false);
@@ -31,8 +31,7 @@ public class ComboEditorCompletionContributor extends CompletionContributor{
@Override
public void fillCompletionVariants(final CompletionParameters parameters, final CompletionResultSet result) {
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
if (process != null && process.isAutopopupCompletion()) {
if (parameters.getInvocationCount() == 0) {
return;
}
@@ -38,15 +38,6 @@ public class BackspaceHandler extends EditorActionHandler {
return;
}
boolean toRestart = false;
final String prefix = lookup.getAdditionalPrefix();
if (prefix.length() > 0) {
lookup.setAdditionalPrefix(prefix.substring(0, prefix.length() - 1));
}
else {
toRestart = lookup.getLookupStart() < editor.getCaretModel().getOffset();
}
lookup.performGuardedChange(new Runnable() {
@Override
public void run() {
@@ -54,11 +45,13 @@ public class BackspaceHandler extends EditorActionHandler {
}
});
final String prefix = lookup.getAdditionalPrefix();
if (prefix.length() > 0) {
lookup.setAdditionalPrefix(prefix.substring(0, prefix.length() - 1));
return;
}
if (toRestart) {
if (lookup.getLookupStart() < editor.getCaretModel().getOffset()) {
final CompletionProcess process = CompletionService.getCompletionService().getCurrentCompletion();
if (process instanceof CompletionProgressIndicator) {
((CompletionProgressIndicator)process).restartCompletion();
@@ -83,10 +83,6 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
private final LookupCellRenderer myCellRenderer;
private Boolean myPositionedAbove = null;
private CaretListener myEditorCaretListener;
private SelectionListener myEditorSelectionListener;
private EditorMouseListener myEditorMouseListener;
private final ArrayList<LookupListener> myListeners = new ArrayList<LookupListener>();
private boolean myShown = false;
@@ -141,6 +137,8 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
updateListHeight(model);
setArranger(arranger);
addListeners();
}
public void setArranger(LookupArranger arranger) {
@@ -550,13 +548,6 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
return myLookupStartMarker.getStartOffset();
}
@Override
protected void beforeShow() {
if (isRealPopup()) {
getComponent().setBorder(null);
}
}
public void performGuardedChange(Runnable change) {
assert !myChangeGuard;
myChangeGuard = true;
@@ -578,6 +569,18 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
LOG.assertTrue(!myShown);
myShown = true;
if (ApplicationManager.getApplication().isUnitTestMode()) return;
getComponent().setBorder(null);
Point p = calculatePosition();
HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
hintManager.showEditorHint(this, myEditor, p, HintManagerImpl.HIDE_BY_ESCAPE | HintManagerImpl.UPDATE_BY_SCROLLING, 0, false);
myShownStamp = System.currentTimeMillis();
}
private void addListeners() {
myEditor.getDocument().addDocumentListener(new DocumentAdapter() {
public void documentChanged(DocumentEvent e) {
if (!myChangeGuard) {
@@ -586,29 +589,41 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
}
}, this);
myEditorCaretListener = new CaretListener() {
final CaretListener caretListener = new CaretListener() {
public void caretPositionChanged(CaretEvent e){
caretOrSelectionChanged();
if (!myChangeGuard) {
hide();
}
}
};
myEditorSelectionListener = new SelectionListener() {
final SelectionListener selectionListener = new SelectionListener() {
public void selectionChanged(final SelectionEvent e) {
caretOrSelectionChanged();
if (!myChangeGuard) {
hide();
}
}
};
myEditor.getCaretModel().addCaretListener(myEditorCaretListener);
myEditor.getSelectionModel().addSelectionListener(myEditorSelectionListener);
myEditorMouseListener = new EditorMouseAdapter() {
final EditorMouseListener mouseListener = new EditorMouseAdapter() {
public void mouseClicked(EditorMouseEvent e){
e.consume();
hide();
}
};
myEditor.addEditorMouseListener(myEditorMouseListener);
myEditor.getCaretModel().addCaretListener(caretListener);
myEditor.getSelectionModel().addSelectionListener(selectionListener);
myEditor.addEditorMouseListener(mouseListener);
Disposer.register(this, new Disposable() {
@Override
public void dispose() {
myEditor.getCaretModel().removeCaretListener(caretListener);
myEditor.getSelectionModel().removeSelectionListener(selectionListener);
myEditor.removeEditorMouseListener(mouseListener);
}
});
myList.addListSelectionListener(new ListSelectionListener() {
private LookupElement oldItem = null;
private LookupElement oldItem = null;
public void valueChanged(ListSelectionEvent e){
LookupElement item = getCurrentItem();
@@ -628,7 +643,7 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
final int i = myList.locationToIndex(point);
if (i >= 0) {
final LookupElement selected = (LookupElement)myList.getModel().getElementAt(i);
if (selected != null &&
if (selected != null &&
e.getClickCount() == 1 &&
point.x >= myList.getCellBounds(i, i).width - PopupIcons.EMPTY_ICON.getIconWidth() &&
ShowLookupActionsHandler.showItemActions(LookupImpl.this, selected)) {
@@ -645,20 +660,6 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
}
}
});
if (ApplicationManager.getApplication().isUnitTestMode()) return;
Point p = calculatePosition();
HintManagerImpl hintManager = HintManagerImpl.getInstanceImpl();
hintManager.showEditorHint(this, myEditor, p, HintManagerImpl.HIDE_BY_ESCAPE | HintManagerImpl.UPDATE_BY_SCROLLING, 0, false);
myShownStamp = System.currentTimeMillis();
}
private void caretOrSelectionChanged() {
if (!myChangeGuard) {
hide();
}
}
private int calcLookupStart() {
@@ -927,16 +928,7 @@ public class LookupImpl extends LightweightHint implements Lookup, Disposable {
assert !myDisposed;
Disposer.dispose(myProcessIcon);
if (myEditorCaretListener != null) {
myEditor.getCaretModel().removeCaretListener(myEditorCaretListener);
myEditor.getSelectionModel().removeSelectionListener(myEditorSelectionListener);
myEditorCaretListener = null;
myEditorSelectionListener = null;
}
if (myEditorMouseListener != null) {
myEditor.removeEditorMouseListener(myEditorMouseListener);
myEditorMouseListener = null;
}
myDisposed = true;
}
@@ -58,7 +58,6 @@ public class TypedHandler implements TypedActionHandler {
}
});
if (result == CharFilter.Result.ADD_TO_PREFIX) {
lookup.setAdditionalPrefix(lookup.getAdditionalPrefix() + charTyped);
Document document = editor.getDocument();
long modificationStamp = document.getModificationStamp();
@@ -67,6 +66,7 @@ public class TypedHandler implements TypedActionHandler {
EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, String.valueOf(charTyped), true);
}
});
lookup.setAdditionalPrefix(lookup.getAdditionalPrefix() + charTyped);
AutoHardWrapHandler.getInstance().wrapLineIfNecessary(editor, dataContext, modificationStamp);
@@ -125,7 +125,17 @@ public class TemplateState implements Disposable {
public void beforeCommandFinished(CommandEvent event) {
if (started) {
afterChangedUpdate();
Runnable runnable = new Runnable() {
public void run() {
afterChangedUpdate();
}
};
final LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myEditor);
if (lookup != null) {
lookup.performGuardedChange(runnable);
} else {
runnable.run();
}
}
}
};
@@ -55,7 +55,7 @@ public class PathUtilEx {
}
public static Sdk chooseJdk(Project project, Collection<Module> modules) {
Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (projectJdk != null) {
return projectJdk;
}
@@ -159,7 +159,7 @@ public class SdkConfigurationUtil {
public static void setDirectoryProjectSdk(final Project project, final Sdk sdk) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
ProjectRootManager.getInstance(project).setProjectJdk(sdk);
ProjectRootManager.getInstance(project).setProjectSdk(sdk);
final Module[] modules = ModuleManager.getInstance(project).getModules();
if (modules.length > 0) {
final ModifiableRootModel model = ModuleRootManager.getInstance(modules[0]).getModifiableModel();
@@ -171,7 +171,7 @@ public class SdkConfigurationUtil {
}
public static void configureDirectoryProjectSdk(final Project project, final SdkType... sdkTypes) {
Sdk existingSdk = ProjectRootManager.getInstance(project).getProjectJdk();
Sdk existingSdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (existingSdk != null && ArrayUtil.contains(existingSdk.getSdkType(), sdkTypes)) {
return;
}
@@ -185,7 +185,7 @@ public class SdkConfigurationUtil {
@Nullable
public static Sdk findOrCreateSdk(final SdkType... sdkTypes) {
final Project defaultProject = ProjectManager.getInstance().getDefaultProject();
final Sdk sdk = ProjectRootManager.getInstance(defaultProject).getProjectJdk();
final Sdk sdk = ProjectRootManager.getInstance(defaultProject).getProjectSdk();
if (sdk != null) {
for (SdkType type : sdkTypes) {
if (sdk.getSdkType() == type) {
@@ -89,7 +89,7 @@ public class InheritedJdkOrderEntryImpl extends LibraryOrderEntryBaseImpl implem
}
protected RootProvider getRootProvider() {
final Sdk projectJdk = myProjectRootManagerImpl.getProjectJdk();
final Sdk projectJdk = myProjectRootManagerImpl.getProjectSdk();
return projectJdk == null ? null : projectJdk.getRootProvider();
}
@@ -82,8 +82,8 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
private AppListener myApplicationListener;
private String myProjectJdkName;
private String myProjectJdkType;
private String myProjectSdkName;
private String myProjectSdkType;
private final List<CacheUpdater> myRootsChangeUpdaters = new ArrayList<CacheUpdater>();
private final List<CacheUpdater> myRefreshCacheUpdaters = new ArrayList<CacheUpdater>();
@@ -327,28 +327,28 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
return VfsUtil.toVirtualFileArray(result);
}
public Sdk getProjectJdk() {
if (myProjectJdkName != null) {
return ProjectJdkTable.getInstance().findJdk(myProjectJdkName, myProjectJdkType);
public Sdk getProjectSdk() {
if (myProjectSdkName != null) {
return ProjectJdkTable.getInstance().findJdk(myProjectSdkName, myProjectSdkType);
}
else {
return null;
}
}
public String getProjectJdkName() {
return myProjectJdkName;
public String getProjectSdkName() {
return myProjectSdkName;
}
public void setProjectJdk(Sdk projectJdk) {
public void setProjectSdk(Sdk projectSdk) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
if (projectJdk != null) {
myProjectJdkName = projectJdk.getName();
myProjectJdkType = projectJdk.getSdkType().getName();
if (projectSdk != null) {
myProjectSdkName = projectSdk.getName();
myProjectSdkType = projectSdk.getSdkType().getName();
}
else {
myProjectJdkName = null;
myProjectJdkType = null;
myProjectSdkName = null;
myProjectSdkType = null;
}
mergeRootsChangesDuring(new Runnable() {
public void run() {
@@ -357,9 +357,9 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
});
}
public void setProjectJdkName(String name) {
public void setProjectSdkName(String name) {
ApplicationManager.getApplication().assertWriteAccessAllowed();
myProjectJdkName = name;
myProjectSdkName = name;
mergeRootsChangesDuring(new Runnable() {
public void run() {
@@ -409,8 +409,8 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
for (ProjectExtension extension : Extensions.getExtensions(ProjectExtension.EP_NAME, myProject)) {
extension.readExternal(element);
}
myProjectJdkName = element.getAttributeValue(PROJECT_JDK_NAME_ATTR);
myProjectJdkType = element.getAttributeValue(PROJECT_JDK_TYPE_ATTR);
myProjectSdkName = element.getAttributeValue(PROJECT_JDK_NAME_ATTR);
myProjectSdkType = element.getAttributeValue(PROJECT_JDK_TYPE_ATTR);
}
public void writeExternal(Element element) throws WriteExternalException {
@@ -418,11 +418,11 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
for (ProjectExtension extension : Extensions.getExtensions(ProjectExtension.EP_NAME, myProject)) {
extension.writeExternal(element);
}
if (myProjectJdkName != null) {
element.setAttribute(PROJECT_JDK_NAME_ATTR, myProjectJdkName);
if (myProjectSdkName != null) {
element.setAttribute(PROJECT_JDK_NAME_ATTR, myProjectSdkName);
}
if (myProjectJdkType != null) {
element.setAttribute(PROJECT_JDK_TYPE_ATTR, myProjectJdkType);
if (myProjectSdkType != null) {
element.setAttribute(PROJECT_JDK_TYPE_ATTR, myProjectSdkType);
}
}
@@ -946,11 +946,11 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
myDispatcher.getMulticaster().jdkNameChanged(jdk, previousName);
}
});
String currentName = getProjectJdkName();
String currentName = getProjectSdkName();
if (previousName != null && previousName.equals(currentName)) {
// if already had jdk name and that name was the name of the jdk just changed
myProjectJdkName = jdk.getName();
myProjectJdkType = jdk.getSdkType().getName();
myProjectSdkName = jdk.getName();
myProjectSdkType = jdk.getSdkType().getName();
}
}
@@ -42,11 +42,11 @@ public class RootConfigurationAccessor {
}
public Sdk getProjectSdk(Project project) {
return ProjectRootManager.getInstance(project).getProjectJdk();
return ProjectRootManager.getInstance(project).getProjectSdk();
}
@Nullable
public String getProjectSdkName(final Project project) {
return ProjectRootManager.getInstance(project).getProjectJdkName();
return ProjectRootManager.getInstance(project).getProjectSdkName();
}
}
@@ -91,7 +91,7 @@ public class ProjectSdksModel implements SdkModel {
//can't be
}
}
myProjectSdk = findSdk(ProjectRootManager.getInstance(project).getProjectJdkName());
myProjectSdk = findSdk(ProjectRootManager.getInstance(project).getProjectSdkName());
myModified = false;
myInitialized = true;
}
@@ -175,8 +175,8 @@ public class Tree extends JTree implements ComponentWithEmptyText, ComponentWith
TreePath[] paths = getSelectionModel().getSelectionPaths();
if (paths != null) {
for (TreePath each : paths) {
Rectangle selection = getPathBounds(each);
if (g.getClipBounds().intersects(selection) || g.getClipBounds().contains(selection)) {
final Rectangle selection = getPathBounds(each);
if (selection != null && (g.getClipBounds().intersects(selection) || g.getClipBounds().contains(selection))) {
if (myBusy) {
Rectangle busyIconBounds = myBusyIcon.getBounds();
if (selection.contains(busyIconBounds) || selection.intersects(busyIconBounds)) {
@@ -51,7 +51,7 @@
</constraints>
<properties>
<margin top="2" left="0" bottom="2" right="2"/>
<text value="Confirm frame to open project in"/>
<text value="Confirm window to open project in"/>
</properties>
</component>
</children>
@@ -150,16 +150,7 @@ public class ProjectUtil {
}
if (!forceOpenInNewFrame && openProjects.length > 0) {
final GeneralSettings settings = GeneralSettings.getInstance();
int exitCode;
if (settings.getConfirmOpenNewProject() < 0) {
exitCode = Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe"),
CommonBundle.getCancelButtonText()}, 1, 0, Messages.getQuestionIcon(),
new ProjectNewWindowDoNotAskOption());
} else {
exitCode = settings.getConfirmOpenNewProject();
}
int exitCode = confirmOpenNewProject();
if (exitCode == 1) { // "No" option
if (!closeProject(projectToClose != null ? projectToClose : openProjects[openProjects.length - 1])) return null;
}
@@ -190,6 +181,18 @@ public class ProjectUtil {
return project;
}
public static int confirmOpenNewProject() {
final GeneralSettings settings = GeneralSettings.getInstance();
if (settings.getConfirmOpenNewProject() < 0) {
return Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe"),
CommonBundle.getCancelButtonText()}, 1, 0, Messages.getQuestionIcon(),
new ProjectNewWindowDoNotAskOption());
} else {
return settings.getConfirmOpenNewProject();
}
}
private static boolean isSameProject(String path, Project p) {
final IProjectStore projectStore = ((ProjectEx)p).getStateStore();
@@ -27,6 +27,7 @@ package com.intellij.openapi.application.ex;
import com.intellij.openapi.application.ApplicationInfo;
import java.awt.*;
import java.util.Calendar;
import java.util.List;
public abstract class ApplicationInfoEx extends ApplicationInfo {
@@ -35,6 +36,8 @@ public abstract class ApplicationInfoEx extends ApplicationInfo {
return (ApplicationInfoEx) getInstance();
}
public abstract Calendar getMajorReleaseBuildDate();
public abstract String getLogoUrl();
public abstract Color getLogoTextColor();
@@ -51,6 +51,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
@NonNls private String myOpaqueIconUrl = "/icon.png";
@NonNls private String myToolWindowIconUrl = "/general/toolWindowProject.png";
private Calendar myBuildDate = null;
private Calendar myMajorReleaseBuildDate = null;
private String myPackageCode = null;
private boolean myShowLicensee = true;
private String myWelcomeScreenCaptionUrl;
@@ -81,6 +82,7 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
@NonNls private static final String ELEMENT_BUILD = "build";
@NonNls private static final String ATTRIBUTE_NUMBER = "number";
@NonNls private static final String ATTRIBUTE_DATE = "date";
@NonNls private static final String ATTRIBUTE_MAJOR_RELEASE_DATE = "majorReleaseDate";
@NonNls private static final String ELEMENT_LOGO = "logo";
@NonNls private static final String ATTRIBUTE_URL = "url";
@NonNls private static final String ATTRIBUTE_TEXTCOLOR = "textcolor";
@@ -128,6 +130,10 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
return myBuildDate;
}
public Calendar getMajorReleaseBuildDate() {
return myMajorReleaseBuildDate != null ? myMajorReleaseBuildDate : myBuildDate;
}
@Override
public BuildNumber getBuild() {
return BuildNumber.fromString(myBuildNumber);
@@ -314,21 +320,11 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
myBuildDate = new GregorianCalendar();
}
else {
int year = 0;
int month = 0;
int day = 0;
try {
year = Integer.parseInt(dateString.substring(0, 4));
month = Integer.parseInt(dateString.substring(4, 6));
day = Integer.parseInt(dateString.substring(6, 8));
}
catch (Exception ex) {
//ignore
}
if (month > 0) {
month--;
}
myBuildDate = new GregorianCalendar(year, month, day);
myBuildDate = parseDate(dateString);
}
String majorReleaseDateString = buildElement.getAttributeValue(ATTRIBUTE_MAJOR_RELEASE_DATE);
if (majorReleaseDateString != null) {
myMajorReleaseBuildDate = parseDate(majorReleaseDateString);
}
}
@@ -446,6 +442,24 @@ public class ApplicationInfoImpl extends ApplicationInfoEx implements JDOMExtern
}
}
private static GregorianCalendar parseDate(String dateString) {
int year = 0;
int month = 0;
int day = 0;
try {
year = Integer.parseInt(dateString.substring(0, 4));
month = Integer.parseInt(dateString.substring(4, 6));
day = Integer.parseInt(dateString.substring(6, 8));
}
catch (Exception ex) {
//ignore
}
if (month > 0) {
month--;
}
return new GregorianCalendar(year, month, day);
}
public List<PluginChooserPage> getPluginChooserPages() {
return myPluginChooserPages;
}
@@ -45,8 +45,8 @@ public class DeleteLineAction extends TextComponentEditorAction {
int selectionEnd = selectionModel.getSelectionEnd();
selectionModel.removeSelection();
int lineStartOffset = document.getLineStartOffset(document.getLineNumber(selectionStart));
int lineEndOffset = document.getLineEndOffset(document.getLineNumber(selectionEnd));
document.deleteString(lineStartOffset, lineEndOffset);
int nextLineStartOffset = Math.min(document.getTextLength(), document.getLineStartOffset(document.getLineNumber(selectionEnd) + 1));
document.deleteString(lineStartOffset, nextLineStartOffset);
return;
}
deleteLineAtCaret(editor);
@@ -214,7 +214,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
try {
ProjectImpl project =
createAndInitProject(projectName, filePath, false, isDummy, ApplicationManager.getApplication().isUnitTestMode(),
createAndInitProject(projectName, filePath, false, ApplicationManager.getApplication().isUnitTestMode(),
useDefaultProjectSettings ? getDefaultProject() : null);
if (LOG_PROJECT_LEAKAGE_IN_TESTS) {
myProjects.put(project, null);
@@ -244,11 +244,8 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
return message;
}
private ProjectImpl createAndInitProject(String projectName, String filePath, boolean isDefault, boolean isDummy, boolean isOptimiseTestLoadSpeed,
private ProjectImpl createAndInitProject(String projectName, String filePath, boolean isDefault, boolean isOptimiseTestLoadSpeed,
@Nullable Project template) throws IOException {
if (isDummy) {
throw new UnsupportedOperationException("Dummy project is deprecated and shall not be used anymore.");
}
final ProjectImpl project = isDefault ? new DefaultProject(this, filePath, isOptimiseTestLoadSpeed, projectName) :
new ProjectImpl(this, filePath, isOptimiseTestLoadSpeed, projectName);
@@ -299,7 +296,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
filePath = canonicalize(filePath);
ProjectImpl project = null;
try {
project = createAndInitProject(null, filePath, false, false, false, null);
project = createAndInitProject(null, filePath, false, false, null);
}
catch (ProcessCanceledException e) {
if (project != null) {
@@ -332,7 +329,7 @@ public class ProjectManagerImpl extends ProjectManagerEx implements NamedJDOMExt
public synchronized Project getDefaultProject() {
if (myDefaultProject == null) {
try {
myDefaultProject = createAndInitProject(null, null, true, false, ApplicationManager.getApplication().isUnitTestMode(), null);
myDefaultProject = createAndInitProject(null, null, true, ApplicationManager.getApplication().isUnitTestMode(), null);
myDefaultProjectRootElement = null;
}
catch (IOException e) {
@@ -15,10 +15,6 @@
*/
package com.intellij.platform;
import com.intellij.CommonBundle;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.impl.ProjectNewWindowDoNotAskOption;
import com.intellij.ide.impl.ProjectUtil;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
@@ -29,7 +25,6 @@ import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.project.impl.ProjectManagerImpl;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.ToolWindowManager;
@@ -78,17 +73,7 @@ public class PlatformProjectOpenProcessor extends ProjectOpenProcessor {
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
if (!forceOpenInNewFrame && openProjects.length > 0) {
final GeneralSettings settings = GeneralSettings.getInstance();
int exitCode;
if (settings.getConfirmOpenNewProject() < 0) {
exitCode = Messages.showDialog(IdeBundle.message("prompt.open.project.in.new.frame"), IdeBundle.message("title.open.project"),
new String[]{IdeBundle.message("button.newframe"), IdeBundle.message("button.existingframe"),
CommonBundle.getCancelButtonText()}, 1, 0, Messages.getQuestionIcon(),
new ProjectNewWindowDoNotAskOption());
}
else {
exitCode = settings.getConfirmOpenNewProject();
}
int exitCode = ProjectUtil.confirmOpenNewProject();
if (exitCode == 1) { // "No" option
if (!ProjectUtil.closeProject(projectToClose != null ? projectToClose : openProjects[openProjects.length - 1])) return null;
}
@@ -0,0 +1,13 @@
<html>
<body style="font-family: Verdana; font-size: 13;" LEFTMARGIN="25" TOPMARGIN="25">
<table cellpadding="15" width="98%" border="0">
<tr>
<td>You can quickly find a setting you need in the Settings dialog, without browsing through the numerous options.
Just type some characters that to your opinion exist in the option description, and the list of settings will reduce to the
matching ones. Select the desired entry, and see the setting that contains the entered characters highlighted:
<p><img hspace="20" src="../../../../resources-en/src/tips/images/search_settings.png"></p>
</td>
</tr>
</table>
</body>
</html>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

@@ -334,9 +334,6 @@
<action id="TypeHierarchy">
<keyboard-shortcut first-keystroke="shift alt F12" />
</action>
<action id="Uml.PrintGraph">
<keyboard-shortcut first-keystroke="shift control alt P" />
</action>
<action id="Unwrap" />
<action id="ValidateJsp">
<keyboard-shortcut first-keystroke="shift alt F9" />
@@ -75,7 +75,7 @@ public class PathUtilEx {
}
public static Sdk chooseJdk(Project project, Collection<Module> modules) {
Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectSdk();
if (projectJdk != null) {
return projectJdk;
}
@@ -94,7 +94,7 @@ public class AntConfigurationImpl extends AntConfigurationBase implements Persis
public String get(final AbstractPropertyContainer container) {
if (!container.hasProperty(this)) return null;
AntConfiguration antConfiguration = AntConfigurationImpl.INSTANCE.get(container);
return ProjectRootManager.getInstance(antConfiguration.getProject()).getProjectJdkName();
return ProjectRootManager.getInstance(antConfiguration.getProject()).getProjectSdkName();
}
public String copy(final String jdkName) {
@@ -168,7 +168,7 @@ public abstract class AntDomProject extends AntDomNamedElement implements Proper
return ProjectJdkTable.getInstance().findJdk(jdkName);
}
}
return ProjectRootManager.getInstance(tag.getProject()).getProjectJdk();
return ProjectRootManager.getInstance(tag.getProject()).getProjectSdk();
}
@NotNull
@@ -283,21 +283,21 @@ public class CustomAntElementsRegistry {
clazz = loader.loadClass(classname);
}
catch (ClassNotFoundException e) {
error = e.getMessage();
error = "Class not found " + e.getMessage();
if (error == null) {
error = "";
}
clazz = null;
}
catch (NoClassDefFoundError e) {
error = e.getMessage();
error = "Class definition not found " + e.getMessage();
if (error == null) {
error = "";
}
clazz = null;
}
catch (UnsupportedClassVersionError e) {
error = e.getMessage();
error = "Unsupported class version " + e.getMessage();
if (error == null) {
error = "";
}
@@ -309,7 +309,7 @@ public class CustomAntElementsRegistry {
private void addCustomDefinition(@NotNull AntDomNamedElement declaringTag, String customTagName, String nsUri, Class clazz, String error) {
final XmlName xmlName = new XmlName(customTagName, nsUri == null? "" : nsUri);
if (error != null) {
myErrors.put(xmlName, customTagName);
myErrors.put(xmlName, error);
}
myCustomElements.put(xmlName, clazz);
myDeclarations.put(xmlName, declaringTag);
@@ -346,7 +346,7 @@ public class AntFileImpl extends LightPsiFileBase implements AntFile {
public Sdk getTargetJdk() {
final AntBuildFileImpl buildFile = (AntBuildFileImpl)getSourceElement().getCopyableUserData(AntBuildFile.ANT_BUILD_FILE_KEY);
if (buildFile == null) {
return ProjectRootManager.getInstance(getProject()).getProjectJdk();
return ProjectRootManager.getInstance(getProject()).getProjectSdk();
}
String jdkName = AntBuildFileImpl.CUSTOM_JDK_NAME.get(buildFile.getAllOptions());
@@ -356,7 +356,7 @@ public class AntFileImpl extends LightPsiFileBase implements AntFile {
if (jdkName != null && jdkName.length() > 0) {
return ProjectJdkTable.getInstance().findJdk(jdkName);
}
return ProjectRootManager.getInstance(getProject()).getProjectJdk();
return ProjectRootManager.getInstance(getProject()).getProjectSdk();
}
@Nullable
@@ -103,7 +103,7 @@ public class GitVcsApplicationSettings implements PersistentStateComponent<GitVc
* @return get last set path to git or null
*/
public String getPathToGit() {
return myPathToGit;
return myPathToGit == null ? defaultGit() : myPathToGit;
}
/**
@@ -199,7 +199,7 @@ public abstract class TestObject implements JavaCommandLine {
if (myJavaParameters.getJdk() == null){
myJavaParameters.setJdk(module != null
? ModuleRootManager.getInstance(module).getSdk()
: ProjectRootManager.getInstance(myProject).getProjectJdk());
: ProjectRootManager.getInstance(myProject).getProjectSdk());
}
myJavaParameters.getClassPath().add(JavaSdkUtil.getIdeaRtJarPath());
@@ -237,7 +237,7 @@ public class TestNGRunnableState extends JavaCommandLineState {
.getPath());//todo !do not hard code lib name!
// Configure rest of jars
JavaParametersUtil.configureConfiguration(javaParameters, config);
Sdk jdk = module == null ? ProjectRootManager.getInstance(project).getProjectJdk() : ModuleRootManager.getInstance(module).getSdk();
Sdk jdk = module == null ? ProjectRootManager.getInstance(project).getProjectSdk() : ModuleRootManager.getInstance(module).getSdk();
javaParameters.setJdk(jdk);
final Object[] patchers = Extensions.getExtensions(ExtensionPoints.JUNIT_PATCHER);
for (Object patcher : patchers) {
@@ -470,7 +470,7 @@ public final class XsltRunConfiguration extends RunConfigurationBase implements
jdk = ModuleRootManager.getInstance(module).getSdk();
}
if (jdk == null) {
jdk = ProjectRootManager.getInstance(getProject()).getProjectJdk();
jdk = ProjectRootManager.getInstance(getProject()).getProjectSdk();
}
return jdk;
}
+1
View File
@@ -84,6 +84,7 @@
<tip file="EclipseQuickOpen.html"/>
<tip file="ShowUsages.html"/>
<tip file="GoToAction.html"/>
<tip file="SearchInSettings.html"/>
<tip file="CompleteMethod.html"/>
<tip file="HighlightImplements.html"/>
<tip file="RecentSearch.html"/>
@@ -140,13 +140,13 @@ public class XmlSplitTagAction implements IntentionAction {
final String name = xmlTag.getName();
sb.append("<root><").append(name);
if (attrs.length() > 0) {
sb.append(' ').append(attrs.toString());
sb.append(' ').append(attrs);
}
sb.append('>');
sb.append(first);
sb.append("</").append(name).append("><").append(name);
if (attrsWoId.length() > 0) {
sb.append(' ').append(attrsWoId.toString());
sb.append(' ').append(attrsWoId);
}
sb.append('>');
sb.append(second).append("</").append(name).append("></root>");