Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Jemerov
2012-04-03 17:12:53 +02:00
40 changed files with 294 additions and 157 deletions
@@ -26,6 +26,7 @@ import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.FoldingGroup;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
@@ -715,7 +716,12 @@ public class JavaFoldingBuilder extends CustomFoldingBuilder implements DumbAwar
}
}
return !OverrideImplementUtil.getMethodSignaturesToImplement(baseClass).isEmpty();
try {
return !OverrideImplementUtil.getMethodSignaturesToImplement(baseClass).isEmpty();
}
catch (IndexNotReadyException e) {
return false;
}
}
private static boolean addToFold(List<FoldingDescriptor> list, PsiElement elementToFold, Document document, boolean allowOneLiners) {
@@ -22,6 +22,7 @@ import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Ref;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMigration;
import com.intellij.psi.impl.migration.PsiMigrationManager;
import com.intellij.refactoring.BaseRefactoringProcessor;
@@ -71,6 +72,11 @@ class MigrationProcessor extends BaseRefactoringProcessor {
}
}
@Override
protected void refreshElements(PsiElement[] elements) {
myPsiMigration = startMigration(myProject);
}
@NotNull
protected UsageInfo[] findUsages() {
ArrayList<UsageInfo> usagesVector = new ArrayList<UsageInfo>();
@@ -1409,7 +1409,7 @@ public class Mappings {
debug("Processing removed fields:");
for (FieldRepr f : diff.fields().removed()) {
debug("Field: ", it.name);
debug("Field: ", f.name);
if ((f.access & Opcodes.ACC_PRIVATE) == 0 && (f.access & mask) == mask && f.hasValue()) {
debug("Field had value and was (non-private) final static => a switch to non-incremental mode requested");
@@ -32,8 +32,7 @@ class UsageRepr {
}
public static class Cluster implements RW.Savable {
final Set<Usage> usages = new HashSet<Usage>();
final Map<Usage, Set<DependencyContext.S>> residentialMap = new HashMap<Usage, Set<DependencyContext.S>>();
private final Map<Usage, Set<DependencyContext.S>> myUsageToDependenciesMap = new HashMap<Usage, Set<DependencyContext.S>>();
public Cluster() {
}
@@ -44,11 +43,8 @@ class UsageRepr {
for (int i = 0; i < size; i++) {
final Usage u = externalizer(context).read(in);
final Set<DependencyContext.S> s =
(Set<DependencyContext.S>)RW.read(DependencyContext.descriptorS, new HashSet<DependencyContext.S>(), in);
usages.add(u);
residentialMap.put(u, s);
final Set<DependencyContext.S> s = (Set<DependencyContext.S>)RW.read(DependencyContext.descriptorS, new HashSet<DependencyContext.S>(), in);
myUsageToDependenciesMap.put(u, s);
}
}
catch (IOException e) {
@@ -59,10 +55,12 @@ class UsageRepr {
@Override
public void save(final DataOutput out) {
try {
out.writeInt(usages.size());
for (Usage u : usages) {
out.writeInt(myUsageToDependenciesMap.size());
for (Map.Entry<Usage, Set<DependencyContext.S>> entry : myUsageToDependenciesMap.entrySet()) {
final Usage u = entry.getKey();
u.save(out);
RW.save(residentialMap.get(u), DependencyContext.descriptorS, out);
final Set<DependencyContext.S> deps = entry.getValue();
RW.save(deps, DependencyContext.descriptorS, out);
}
}
catch (IOException e) {
@@ -71,27 +69,26 @@ class UsageRepr {
}
public void addUsage(final DependencyContext.S residence, final Usage usage) {
Set<DependencyContext.S> s = residentialMap.get(usage);
Set<DependencyContext.S> s = myUsageToDependenciesMap.get(usage);
if (s == null) {
s = new HashSet<DependencyContext.S>();
residentialMap.put(usage, s);
myUsageToDependenciesMap.put(usage, s);
}
s.add(residence);
usages.add(usage);
}
public Set<Usage> getUsages() {
return usages;
return Collections.unmodifiableSet(myUsageToDependenciesMap.keySet());
}
public Set<DependencyContext.S> getResidence(final Usage usage) {
return residentialMap.get(usage);
return myUsageToDependenciesMap.get(usage);
}
public boolean isEmpty() {
return usages.isEmpty();
return myUsageToDependenciesMap.isEmpty();
}
public static DataExternalizer<Cluster> clusterExternalizer(final DependencyContext context) {
@@ -115,17 +112,14 @@ class UsageRepr {
Cluster cluster = (Cluster)o;
if (!residentialMap.equals(cluster.residentialMap)) return false;
if (!usages.equals(cluster.usages)) return false;
if (!myUsageToDependenciesMap.equals(cluster.myUsageToDependenciesMap)) return false;
return true;
}
@Override
public int hashCode() {
int result = usages.hashCode();
result = 31 * result + residentialMap.hashCode();
return result;
return myUsageToDependenciesMap.hashCode();
}
}
@@ -116,7 +116,7 @@ public class LayeredIcon implements Icon {
@Override
public int getIconWidth() {
if (myWidth == 0) {
if (myWidth <= 1) { //icon is not loaded yet
recalculateSize();
}
return myWidth;
@@ -124,7 +124,7 @@ public class LayeredIcon implements Icon {
@Override
public int getIconHeight() {
if (myHeight == 0) {
if (myHeight <= 1) { //icon is not loaded yet
recalculateSize();
}
return myHeight;
@@ -46,7 +46,6 @@ public class InspectionDescriptionLinkHandler extends TooltipLinkHandler {
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
LOG.error(editor.getDocument());
return null;
}
@@ -101,4 +101,8 @@ public class CommonShortcuts {
public static ShortcutSet getFind() {
return new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_FIND));
}
public static ShortcutSet getContextHelp() {
return new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_CONTEXT_HELP));
}
}
@@ -20,10 +20,7 @@ import com.intellij.ide.ui.UISettings;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.MnemonicHelper;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CustomShortcutSet;
import com.intellij.openapi.actionSystem.MacOtherAction;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
@@ -1416,17 +1413,29 @@ public abstract class DialogWrapper {
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
if (ApplicationInfo.contextHelpAvailable()) {
ShortcutSet help = CommonShortcuts.getContextHelp();
for (Shortcut shortcut : help.getShortcuts()) {
if (shortcut instanceof KeyboardShortcut) {
KeyboardShortcut ks = (KeyboardShortcut)shortcut;
KeyStroke first = ks.getFirstKeyStroke();
KeyStroke second = ks.getSecondKeyStroke();
if (second == null) {
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
}
}, first, JComponent.WHEN_IN_FOCUSED_WINDOW);
}
}
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
getRootPane().registerKeyboardAction(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doHelpAction();
}
}, KeyStroke.getKeyStroke(KeyEvent.VK_HELP, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
if (myButtons != null) {
getRootPane().registerKeyboardAction(new AbstractAction() {
@@ -32,10 +32,12 @@ import com.intellij.openapi.extensions.ExtensionPoint;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.updateSettings.impl.UpdateChecker;
import com.intellij.openapi.updateSettings.impl.UpdateSettings;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.WindowManager;
import com.intellij.openapi.wm.impl.WindowManagerImpl;
import com.intellij.ui.Splash;
@@ -212,9 +214,14 @@ public class IdeaApplication {
loadProject();
}
if (UpdateChecker.isMyVeryFirstOpening() && UpdateChecker.checkNeeded()) {
UpdateChecker.setMyVeryFirstOpening(false);
UpdateChecker.updateAndShowResult();
final UpdateSettings settings = UpdateSettings.getInstance();
if (settings != null) {
final ApplicationInfo appInfo = ApplicationInfo.getInstance();
if (StringUtil.compareVersionNumbers(settings.LAST_BUILD_CHECKED, appInfo.getBuild().asString()) < 0 ||
(UpdateChecker.isMyVeryFirstOpening() && UpdateChecker.checkNeeded())) {
UpdateChecker.setMyVeryFirstOpening(false);
UpdateChecker.updateAndShowResult();
}
}
SwingUtilities.invokeLater(new Runnable() {
@@ -62,7 +62,7 @@ public class CheckForUpdateAction extends AnAction implements DumbAware {
return;
}
instance.LAST_TIME_CHECKED = System.currentTimeMillis();
instance.saveLastCheckedInfo();
UpdateChecker.showUpdateResult(result, updatedPlugins, true, enableLink, true);
}
});
@@ -428,7 +428,7 @@ public final class UpdateChecker {
final CheckForUpdateResult result = doCheckForUpdates(updateSettings);
if (result.getState() == UpdateStrategy.State.LOADED) {
updateSettings.LAST_TIME_CHECKED = System.currentTimeMillis();
updateSettings.saveLastCheckedInfo();
settings.setKnownChannelIds(result.getAllChannelsIds());
}
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.updateSettings.impl;
import com.intellij.openapi.application.ApplicationInfo;
import com.intellij.openapi.application.impl.ApplicationInfoImpl;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
@@ -55,6 +56,7 @@ public class UpdateSettings implements PersistentStateComponent<Element>, UserUp
public boolean CHECK_NEEDED = true;
public long LAST_TIME_CHECKED = 0;
public String LAST_BUILD_CHECKED = "";
public String UPDATE_CHANNEL_TYPE = ChannelStatus.RELEASE_CODE;
public static UpdateSettings getInstance() {
@@ -65,6 +67,12 @@ public class UpdateSettings implements PersistentStateComponent<Element>, UserUp
updateDefaultChannel();
}
public void saveLastCheckedInfo() {
LAST_TIME_CHECKED = System.currentTimeMillis();
ApplicationInfo appInfo = ApplicationInfo.getInstance();
LAST_BUILD_CHECKED = appInfo.getBuild().asString();
}
private void updateDefaultChannel() {
if (ApplicationInfoImpl.getShadowInstance().isEAP()) {
UPDATE_CHANNEL_TYPE = ChannelStatus.EAP_CODE;
@@ -21,7 +21,6 @@ import com.intellij.reference.SoftReference;
import com.intellij.util.ImageLoader;
import com.intellij.util.containers.ConcurrentHashMap;
import com.intellij.util.containers.WeakHashMap;
import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -46,7 +45,7 @@ public final class IconLoader {
*/
private static final Map<Icon, Icon> ourIcon2DisabledIcon = new WeakHashMap<Icon, Icon>(200);
private static final Icon EMPTY_ICON = new EmptyIcon(0,0) {
private static final ImageIcon EMPTY_ICON = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_3BYTE_BGR)) {
@NonNls
public String toString() {
return "Empty icon " + super.toString();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -150,4 +150,16 @@ public abstract class AbstractVcsHelper {
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption);
@Nullable
public Collection<FilePath> selectFilePathsToProcess(List<FilePath> files,
final String title,
@Nullable final String prompt,
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption,
@Nullable String okActionName,
@Nullable String cancelActionName) {
return selectFilePathsToProcess(files, title, prompt, singleFileTitle, singleFilePromptTemplate, confirmationOption);
};
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -27,14 +27,26 @@ public class ConfirmationDialog extends OptionsMessageDialog{
private final VcsShowConfirmationOption myOption;
private String myDoNotShowAgainMessage;
private final String myOkActionName;
private final String myCancelActionName;
public static boolean requestForConfirmation(@NotNull VcsShowConfirmationOption option,
@NotNull Project project,
@NotNull String message,
@NotNull String title,
@Nullable Icon icon) {
return requestForConfirmation(option, project, message, title, icon, null, null);
}
public static boolean requestForConfirmation(@NotNull VcsShowConfirmationOption option,
@NotNull Project project,
@NotNull String message,
@NotNull String title,
@Nullable Icon icon,
@Nullable String okActionName,
@Nullable String cancelActionName) {
if (option.getValue() == VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) return false;
final ConfirmationDialog dialog = new ConfirmationDialog(project, message, title, icon, option);
final ConfirmationDialog dialog = new ConfirmationDialog(project, message, title, icon, option, okActionName, cancelActionName);
if (! option.isPersistent()) {
dialog.setDoNotAskOption(null);
} else {
@@ -45,9 +57,16 @@ public class ConfirmationDialog extends OptionsMessageDialog{
}
public ConfirmationDialog(Project project, final String message, String title, final Icon icon, final VcsShowConfirmationOption option) {
this(project, message, title, icon, option, null, null);
}
public ConfirmationDialog(Project project, final String message, String title, final Icon icon, final VcsShowConfirmationOption option,
@Nullable String okActionName, @Nullable String cancelActionName) {
super(project, message, title, icon);
myOption = option;
init();
myOkActionName = okActionName != null ? okActionName : CommonBundle.getYesButtonText();
myCancelActionName = cancelActionName != null ? cancelActionName : CommonBundle.getNoButtonText();
init();
}
public void setDoNotShowAgainMessage(final String doNotShowAgainMessage) {
@@ -61,11 +80,11 @@ public class ConfirmationDialog extends OptionsMessageDialog{
}
protected String getOkActionName() {
return CommonBundle.message("button.yes");
return myOkActionName;
}
protected String getCancelActionName() {
return CommonBundle.message("button.no");
return myCancelActionName;
}
protected boolean isToBeShown() {
@@ -41,7 +41,7 @@ import java.util.*;
*/
public class ChangesCacheFile {
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.vcs.changes.committed.ChangesCacheFile");
private static final int VERSION = 6;
private static final int VERSION = 7;
private final File myPath;
private final File myIndexPath;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -22,6 +22,7 @@ import com.intellij.openapi.vcs.VcsShowConfirmationOption;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.tree.DefaultTreeModel;
import java.util.Collection;
import java.util.List;
@@ -31,10 +32,11 @@ import java.util.List;
*/
public class SelectFilePathsDialog extends AbstractSelectFilesDialog<FilePath> {
private ChangesTreeList<FilePath> myFileList;
private final ChangesTreeList<FilePath> myFileList;
public SelectFilePathsDialog(final Project project, List<FilePath> originalFiles, final String prompt,
final VcsShowConfirmationOption confirmationOption) {
final VcsShowConfirmationOption confirmationOption,
@Nullable String okActionName, @Nullable String cancelActionName) {
super(project, false, confirmationOption, prompt, true);
myFileList = new ChangesTreeList<FilePath>(project, originalFiles, true, true, null, null) {
protected DefaultTreeModel buildTreeModel(final List<FilePath> changes, ChangeNodeDecorator changeNodeDecorator) {
@@ -54,6 +56,12 @@ public class SelectFilePathsDialog extends AbstractSelectFilesDialog<FilePath> {
return null;
}
};
if (okActionName != null) {
getOKAction().putValue(Action.NAME, okActionName);
}
if (cancelActionName != null) {
getCancelAction().putValue(Action.NAME, cancelActionName);
}
myFileList.setChangesToDisplay(originalFiles);
init();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -170,22 +170,25 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
}
@Nullable
public Collection<FilePath> selectFilePathsToProcess(final List<FilePath> files,
final String title,
@Nullable final String prompt,
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption) {
public Collection<FilePath> selectFilePathsToProcess(List<FilePath> files,
String title,
@Nullable String prompt,
String singleFileTitle,
String singleFilePromptTemplate,
VcsShowConfirmationOption confirmationOption,
@Nullable String okActionName,
@Nullable String cancelActionName) {
if (files.size() == 1 && singleFilePromptTemplate != null) {
String filePrompt = MessageFormat.format(singleFilePromptTemplate, files.get(0).getPresentableUrl());
if (ConfirmationDialog
.requestForConfirmation(confirmationOption, myProject, filePrompt, singleFileTitle, Messages.getQuestionIcon())) {
final String filePrompt = MessageFormat.format(singleFilePromptTemplate, files.get(0).getPresentableUrl());
if (ConfirmationDialog.requestForConfirmation(confirmationOption, myProject, filePrompt, singleFileTitle,
Messages.getQuestionIcon(), okActionName, cancelActionName)) {
return files;
}
return null;
}
SelectFilePathsDialog dlg = new SelectFilePathsDialog(myProject, files, prompt, confirmationOption);
final SelectFilePathsDialog dlg =
new SelectFilePathsDialog(myProject, files, prompt, confirmationOption, okActionName, cancelActionName);
dlg.setTitle(title);
if (! confirmationOption.isPersistent()) {
dlg.setDoNotAskOption(null);
@@ -194,6 +197,16 @@ public class AbstractVcsHelperImpl extends AbstractVcsHelper {
return dlg.isOK() ? dlg.getSelectedFiles() : null;
}
@Nullable
public Collection<FilePath> selectFilePathsToProcess(final List<FilePath> files,
final String title,
@Nullable final String prompt,
final String singleFileTitle,
final String singleFilePromptTemplate,
final VcsShowConfirmationOption confirmationOption) {
return selectFilePathsToProcess(files, title, prompt, singleFileTitle, singleFilePromptTemplate, confirmationOption, null, null);
}
public void showErrors(final List<VcsException> abstractVcsExceptions, @NotNull final String tabDisplayName) {
showErrorsImpl(abstractVcsExceptions.isEmpty(), new Getter<VcsException>() {
public VcsException get() {
@@ -320,9 +320,14 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
float xdpi = deviceConfiguration.getDevice().getXDpi();
float ydpi = deviceConfiguration.getDevice().getYDpi();
mySession = RenderUtil
.createRenderSession(getProject(), layoutXmlText, myFile, manager.getSelectedTarget(), facet, config, xdpi, ydpi,
manager.getSelectedTheme());
while (true) {
mySession = RenderUtil
.createRenderSession(getProject(), layoutXmlText, myFile, manager.getSelectedTarget(), facet, config, xdpi, ydpi,
manager.getSelectedTheme(), 10000);
if (mySession.getResult().getStatus() != Result.Status.ERROR_TIMEOUT) {
break;
}
}
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
@@ -69,7 +69,7 @@ class RenderService {
@Nullable
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
public RenderSession createRenderSession(@NotNull String layoutXmlText, @NotNull String appLabel)
public RenderSession createRenderSession(@NotNull String layoutXmlText, @NotNull String appLabel, long timeout)
throws FileNotFoundException, XmlPullParserException {
final ILayoutPullParser parser = new XmlParser();
@@ -102,6 +102,7 @@ class RenderService {
params.setExtendedViewInfoMode(false);
params.setAppLabel(appLabel);
params.setTimeout(timeout);
final ScreenSizeQualifier screenSizeQualifier = myConfig.getScreenSizeQualifier();
params.setConfigScreenSize(screenSizeQualifier != null ? screenSizeQualifier.getValue() : ScreenSize.NORMAL);
@@ -1,8 +1,6 @@
package org.jetbrains.android.uipreview;
import com.android.ide.common.rendering.api.RenderResources;
import com.android.ide.common.rendering.api.RenderSession;
import com.android.ide.common.rendering.api.Result;
import com.android.ide.common.rendering.api.*;
import com.android.ide.common.resources.ResourceDeltaKind;
import com.android.ide.common.resources.ResourceFolder;
import com.android.ide.common.resources.ResourceRepository;
@@ -73,7 +71,8 @@ public class RenderUtil {
@NotNull FolderConfiguration config,
float xdpi,
float ydpi,
@NotNull ThemeData theme)
@NotNull ThemeData theme,
long timeout)
throws RenderingException, IOException, AndroidSdkNotConfiguredException {
final Sdk sdk = ModuleRootManager.getInstance(facet.getModule()).getSdk();
if (sdk == null || !(sdk.getSdkType() instanceof AndroidSdkType)) {
@@ -121,7 +120,7 @@ public class RenderUtil {
final RenderService renderService = factory.createService(pair.getFirst(), pair.getSecond(), config, xdpi, ydpi, callback, minSdkVersion);
try {
return renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet));
return renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet), timeout);
}
catch (XmlPullParserException e) {
throw new RenderingException(e);
@@ -198,7 +197,7 @@ public class RenderUtil {
final RenderSession session;
try {
session = renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet));
session = renderService.createRenderSession(layoutXmlText, getAppLabelToShow(facet), RenderParams.DEFAULT_TIMEOUT);
}
catch (XmlPullParserException e) {
throw new RenderingException(e);
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -15,6 +15,7 @@
*/
package com.intellij.cvsSupport2.actions;
import com.intellij.CommonBundle;
import com.intellij.CvsBundle;
import com.intellij.cvsSupport2.CvsUtil;
import com.intellij.cvsSupport2.CvsVcs2;
@@ -55,9 +56,8 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
}
protected CvsHandler getCvsHandler(CvsContext context) {
Project project = context.getProject();
final Project project = context.getProject();
final boolean showDialog = myOptions.isToBeShown(project) || OptionsDialog.shiftIsPressed(context.getModifiers());
return getCvsHandler(project, getFilesToRemove(context), showDialog);
}
@@ -68,7 +68,7 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
private static CvsHandler getCvsHandler(final Project project,
final Collection<File> filesToRemove,
final boolean showDialog) {
ArrayList<File> files = new ArrayList<File>();
final ArrayList<File> files = new ArrayList<File>();
for (final File file : filesToRemove) {
if (CvsUtil.fileIsLocallyAdded(file)) {
@@ -88,14 +88,16 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
null,
CvsBundle.message("dialog.title.delete.file.from.cvs"),
CvsBundle.message("confirmation.text.delete.file.from.cvs"),
CvsVcs2.getInstance(project).getRemoveConfirmation());
CvsVcs2.getInstance(project).getRemoveConfirmation(),
CvsBundle.message("button.text.delete.from.cvs"),
CommonBundle.getCancelButtonText());
if (filesToBeRemoved == null || filesToBeRemoved.isEmpty()) return CvsHandler.NULL;
}
return CommandCvsHandler.createRemoveFilesHandler(project, ChangesUtil.filePathsToFiles(filesToBeRemoved));
}
private static List<FilePath> filesToFilePaths(final ArrayList<File> files) {
List<FilePath> result = new ArrayList<FilePath>();
final List<FilePath> result = new ArrayList<FilePath>();
for(File f: files) {
result.add(VcsContextFactory.SERVICE.getInstance().createFilePathOnDeleted(f, false));
}
@@ -103,8 +105,8 @@ public class RemoveLocallyFileOrDirectoryAction extends ActionOnSelectedElement
}
protected Collection<File> getFilesToRemove(CvsContext context) {
Collection<String> deletedFileNames = context.getDeletedFileNames();
ArrayList<File> result = new ArrayList<File>();
final Collection<String> deletedFileNames = context.getDeletedFileNames();
final ArrayList<File> result = new ArrayList<File>();
for (final String deletedFileName : deletedFileNames) {
result.add(new File(deletedFileName));
}
@@ -264,7 +264,8 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
final PsiElement constructor = constructorResolveResult.getElement();
if (constructor != null) {
checkConstructorApplicability(constructorResolveResult, refElement);
if (!checkConstructorApplicability(constructorResolveResult, refElement)) return;
if (!checkUnknownParams(refElement)) return;
}
else {
final GroovyResolveResult[] results = constructorCall.multiResolveConstructor();
@@ -275,7 +276,7 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
if (!checkConstructorApplicability(result, refElement)) return;
}
}
if (!checkUnknownParams(refElement)) return;
registerError(getElementToHighlight(refElement, argList), GroovyBundle.message("constructor.call.is.ambiguous"));
}
else {
@@ -419,12 +420,12 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
final PsiType type = referenceExpression.getType();
if (resolved != null ) {
if (resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty()) {
checkMethodApplicability(resolveResult, referenceExpression);
if (!checkMethodApplicability(resolveResult, referenceExpression)) return;
}
else {
checkCallApplicability(type, referenceExpression);
if (!checkCallApplicability(type, referenceExpression)) return;
}
if (!checkUnknownParams(referenceExpression)) return;
}
else if (results.length > 0) {
for (GroovyResolveResult result : results) {
@@ -436,6 +437,7 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
if (!checkCallApplicability(type, referenceExpression)) return;
}
}
if (!checkUnknownParams(referenceExpression)) return;
registerError(getElementToHighlight(referenceExpression, PsiUtil.getArgumentsList(referenceExpression)),
GroovyBundle.message("method.call.is.ambiguous"));
@@ -443,6 +445,20 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
}
}
private boolean checkUnknownParams(PsiElement place) {
PsiType[] args = PsiUtil.getArgumentTypes(place, true);
if (args == null) return true;
for (PsiType arg : args) {
if (arg == null) {
registerError(getElementToHighlight(place, PsiUtil.getArgumentsList(place)), GroovyBundle.message("cannot.infer.argument.types"),
LocalQuickFix.EMPTY_ARRAY, ProblemHighlightType.WEAK_WARNING);
return false;
}
}
return true;
}
private boolean checkCannotInferArgumentTypes(PsiElement referenceExpression) {
if (PsiUtil.getArgumentTypes(referenceExpression, true) != null) return false;
@@ -553,10 +569,12 @@ public class GroovyAssignabilityCheckInspection extends BaseInspection {
PsiElement resolved = result.getElement();
if (resolved instanceof PsiMethod && !result.isInvokedOnProperty()) {
if (!checkMethodApplicability(result, invokedExpr)) return false;
if (!checkUnknownParams(invokedExpr)) return false;
}
else if (resolved instanceof PsiField) {
if (!checkCallApplicability(((PsiField)resolved).getType(), invokedExpr)) return false;
}
if (!checkUnknownParams(invokedExpr)) return false;
}
if (calls.length == 0 && !(invokedExpr instanceof GrString)) {
registerCannotApplyError(invokedExpr, argumentTypes, invokedExpr.getText());
@@ -52,8 +52,8 @@ public class ArgumentInstruction extends InstructionImpl implements MixinTypeIns
PsiElement parent = element.getParent().getParent();
LOG.assertTrue(parent instanceof GrCall, "elemText: " + element.getText() +
"\n elemParent = " + (element.getParent() == null ? "null" : element.getParent().getClass()) +
"\n elemPParent" + (parent == null ? "null" : parent.getClass()));
"\nParent = " + (element.getParent() == null ? "null" : element.getParent().getClass()) +
"\nPParent" + (parent == null ? "null" : parent.getClass()));
GrCall call = (GrCall)parent;
@@ -437,7 +437,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
else {
boolean isWrite = !myAssertionsOnly && PsiUtil.isLValue(refExpr);
addNodeAndCheckPending(new ReadWriteVariableInstruction(name, refExpr, myInstructionNumber++, isWrite ? WRITE : READ));
if (refExpr.getParent() instanceof GrArgumentList) {
if (refExpr.getParent() instanceof GrArgumentList && refExpr.getParent().getParent() instanceof GrCall) {
addNodeAndCheckPending(new ArgumentInstruction(refExpr, myInstructionNumber++));
}
}
@@ -299,7 +299,7 @@ public class TypesUtil {
}
}
if (isClassType(rType, GroovyCommonClassNames.GROOVY_LANG_GSTRING)) {
if (isClassType(rType, GROOVY_LANG_GSTRING)) {
if (isAssignable(lType, GroovyPsiManager.getInstance(manager.getProject()).createTypeByFQClassName(JAVA_LANG_STRING, scope), manager, scope)) {
return true;
}
@@ -584,9 +584,9 @@ public class TypesUtil {
public static PsiClassType createListType(@NotNull PsiClass elements) {
JavaPsiFacade facade = JavaPsiFacade.getInstance(elements.getProject());
GlobalSearchScope resolveScope = elements.getResolveScope();
PsiClass listClass = facade.findClass(CommonClassNames.JAVA_UTIL_LIST, resolveScope);
PsiClass listClass = facade.findClass(JAVA_UTIL_LIST, resolveScope);
if (listClass == null) {
return facade.getElementFactory().createTypeByFQClassName(CommonClassNames.JAVA_UTIL_LIST, resolveScope);
return facade.getElementFactory().createTypeByFQClassName(JAVA_UTIL_LIST, resolveScope);
}
return facade.getElementFactory().createType(listClass, facade.getElementFactory().createType(elements));
}
@@ -596,12 +596,12 @@ public class TypesUtil {
JavaPsiFacade facade = JavaPsiFacade.getInstance(context.getProject());
GlobalSearchScope resolveScope = context.getResolveScope();
PsiClass setClass = facade.findClass(CommonClassNames.JAVA_UTIL_SET, resolveScope);
PsiClass setClass = facade.findClass(JAVA_UTIL_SET, resolveScope);
if (setClass != null) {
return facade.getElementFactory().createType(setClass, type);
}
return facade.getElementFactory().createTypeByFQClassName(CommonClassNames.JAVA_UTIL_SET, resolveScope);
return facade.getElementFactory().createTypeByFQClassName(JAVA_UTIL_SET, resolveScope);
}
public static Map<String, PsiClass> getSuperClassesWithCache(@NotNull PsiClass aClass) {
@@ -52,6 +52,7 @@ import java.util.*;
/**
* @author Maxim.Medvedev
*/
@SuppressWarnings("unchecked")
public class GrClosureSignatureUtil {
private GrClosureSignatureUtil() {
}
@@ -549,7 +550,7 @@ public class GrClosureSignatureUtil {
for (GrExpression expression : expressionArgs) {
PsiType type = expression.getType();
if (expression instanceof GrNewExpression && com.intellij.psi.util.PsiUtil.resolveClassInType(type) == null) {
if (partial && expression instanceof GrNewExpression && com.intellij.psi.util.PsiUtil.resolveClassInType(type) == null) {
type = null;
}
if (eraseArgs) {
@@ -649,24 +650,6 @@ public class GrClosureSignatureUtil {
return generateAllMethodSignaturesByClosureSignature(name, signature, PsiTypeParameter.EMPTY_ARRAY, PsiSubstitutor.EMPTY);
}
@Nullable
public static PsiType getTypeByTypeArg(ArgInfo<PsiType> arg, PsiManager manager, GlobalSearchScope resolveScope) {
if (arg.isMultiArg) {
if (arg.args.size() == 0) return PsiType.getJavaLangObject(manager, resolveScope).createArrayType();
PsiType leastUpperBound = null;
for (PsiType type : arg.args) {
leastUpperBound = TypesUtil.getLeastUpperBoundNullable(leastUpperBound, type, manager);
}
if (leastUpperBound == null) return null;
return leastUpperBound.createArrayType();
}
else {
if (arg.args.size() > 0) return arg.args.get(0);
return null;
}
}
@Nullable
public static PsiType getTypeByArg(ArgInfo<PsiElement> arg, PsiManager manager, GlobalSearchScope resolveScope) {
if (arg.isMultiArg) {
@@ -251,7 +251,7 @@ public class PsiUtil {
}
else {
if (type == null) {
result.add(nullAsBottom ? PsiType.NULL : TypesUtil.getJavaLangObject(expression));
result.add(nullAsBottom ? null : TypesUtil.getJavaLangObject(expression));
}
else {
if (stopAt == expression) {
@@ -84,7 +84,7 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
private void doTest(InspectionProfileEntry... tools) {
myFixture.enableInspections(tools);
myFixture.testHighlighting(true, false, false, getTestName(false) + ".groovy");
myFixture.testHighlighting(true, false, true, getTestName(false) + ".groovy");
}
public void testCircularInheritance() throws Throwable {
@@ -477,11 +477,11 @@ class A {
doTest(new GroovyUnresolvedAccessInspection());
}
public void testUnknownVarInArgList() {
public void testImplicitEnumCoercion() {
doTest(new GroovyAssignabilityCheckInspection());
}
public void testImplicitEnumCoercion() {
public void testUnknownVarInArgList() {
doTest(new GroovyAssignabilityCheckInspection());
}
@@ -1,12 +1,11 @@
package org.jetbrains.plugins.groovy.spock
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import com.intellij.codeInsight.lookup.LookupElement
import com.intellij.util.containers.CollectionFactory
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiVariable
import com.intellij.psi.CommonClassNames
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiVariable
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import com.intellij.util.containers.CollectionFactory
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
import org.jetbrains.plugins.groovy.codeInspection.untypedUnresolvedAccess.GroovyUnresolvedAccessInspection
@@ -203,13 +202,13 @@ class FooSpec extends spock.lang.Specification {
public void testVariable_resolved() {
myFixture.enableInspections(GroovyAssignabilityCheckInspection, GroovyUnresolvedAccessInspection)
myFixture.configureByText("FooSpec.groovy", """
myFixture.configureByText("FooSpec.groovy", """\
class FooSpec extends spock.lang.Specification {
def "foo test"() {
String subscriber = <warning>Mock</warning>()
then: (0.._) * subscriber.concat(_)
subscriber.concat(<warning>asdasdasd</warning>)
subscriber.concat<warning>(23)</warning>
String subscriber = <warning descr="Can not resolve symbol 'Mock'">Mock</warning>()
then: (0.._) * subscriber.concat<weak_warning descr="Cannot infer argument types">(_)</weak_warning>
subscriber.concat<weak_warning descr="Cannot infer argument types">(<warning descr="Can not resolve symbol 'asdasdasd'">asdasdasd</warning>)</weak_warning>
subscriber.concat<warning descr="'concat' in 'java.lang.String' cannot be applied to '(java.lang.Integer)'">(23)</warning>
}
}
""")
@@ -5,5 +5,5 @@ enum My {
My var = 'foo'
var = <warning descr="Cannot find enum constant 'fail' in enum 'My'">'fail'</warning>
var = "fo"+"o"
var="fo${'o'}"
var = <weak_warning descr="Cannot assign string to enum 'My'">"fo"+"o"</weak_warning>
var=<weak_warning descr="Cannot assign string to enum 'My'">"fo${'o'}"</weak_warning>
@@ -4,5 +4,4 @@ foo(1, 2, '3')
foo(1, *[2, '3'])
foo<warning descr="'foo' in 'SpreadArguments' cannot be applied to '(java.lang.Integer, java.lang.Integer, java.lang.Integer)'">(1, *[2, 3])</warning>
def list = new ArrayList()
foo(1, *list)
foo<weak_warning descr="Cannot infer argument types">(1, *list)</weak_warning>
@@ -1,7 +1,7 @@
def foo(Date d) {}
def a = unknown
foo(a)
foo<weak_warning descr="Cannot infer argument types">(a)</weak_warning>
foo<warning descr="'foo' in 'UnknownVarInArgList' cannot be applied to '(java.lang.Integer)'">(1)</warning>
@@ -10,4 +10,4 @@ def abc(Date d){}
def abc(int i) {}
def x = unknown2
abc<warning descr="'abc' in 'UnknownVarInArgList' cannot be applied to '(null)'">(x)</warning>
abc<weak_warning descr="Cannot infer argument types">(x)</weak_warning>
-1
View File
@@ -3,7 +3,6 @@
<id>Subversion</id>
<version>1.1</version>
<category>VCS Integration</category>
<idea-version since-build="111.275"/>
<description>For Subversion 1.7 and older versions</description>
<depends>com.intellij.modules.vcs</depends>
<vendor logo="/general/ijLogo.png">JetBrains</vendor>
@@ -220,6 +220,7 @@ label.working.copy.root.outside.text=Working copy root is outside the directory
progress.text.loading.contents=Loading contents of ''{0}''
progress.text2.revision.information=Revision {0}
progress.title.loading.file.content=Loading Remote File Content
progress.title.loading.file.properties=Loading Remote File Properties
exception.text.file.miss.svn=File ''{0}'' is readonly, but miss svn:needs-lock property
confirmation.text.edit.file=File(s) you're are going to edit needs to be locked before editing
@@ -46,7 +46,8 @@ public class SvnDiffProvider implements DiffProvider, DiffMixin {
final SVNStatusClient client = myVcs.createStatusClient();
try {
final SVNStatus svnStatus = client.doStatus(new File(file.getPresentableUrl()), false, false);
if (svnStatus.getCommittedRevision().equals(SVNRevision.UNDEFINED) && svnStatus.isCopied()) {
if (svnStatus == null) return null;
if (SVNRevision.UNDEFINED.equals(svnStatus.getCommittedRevision()) && svnStatus.isCopied()) {
return new SvnRevisionNumber(svnStatus.getCopyFromRevision());
}
return new SvnRevisionNumber(svnStatus.getRevision());
@@ -17,6 +17,7 @@ package org.jetbrains.idea.svn;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.FilePathImpl;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.vcsUtil.VcsUtil;
@@ -205,9 +206,17 @@ public class SvnRecursiveStatusWalker {
if ((vFile != null) && myPartner.isExcluded(vFile)) return;
if ((vFile != null) && (SvnVcs.svnStatusIsUnversioned(status))) {
myReceiver.processUnversioned(vFile);
if (vFile.isDirectory()) {
processRecursively(vFile, myCurrentItem.getDepth());
if (myCurrentItem.getPath().getIOFile().equals(ioFile)) {
myReceiver.processUnversioned(vFile);
processRecursively(vFile, myCurrentItem.getDepth());
} else {
final MyItem childItem = new MyItem(myProject, new FilePathImpl(vFile), SVNDepth.INFINITY,
myPartner.createStatusClient(), true);
myQueue.add(childItem);
}
} else {
myReceiver.processUnversioned(vFile);
}
} else {
final FilePath path = VcsUtil.getFilePath(ioFile, status.getKind().equals(SVNNodeKind.DIR));
@@ -145,6 +145,7 @@ public class SvnChangeList implements CommittedChangeList {
final boolean supportsReplaced) throws IOException {
myVcs = vcs;
myLocation = location;
myKnownAsDirectories = new HashSet<String>();
readFromStream(stream, supportsCopyFromInfo, supportsReplaced);
myCommonPathSearcher = new CommonPathSearcher();
for (String path : myAddedPaths) {
@@ -156,7 +157,6 @@ public class SvnChangeList implements CommittedChangeList {
for (String path : myChangedPaths) {
myCommonPathSearcher.next(path);
}
myKnownAsDirectories = new HashSet<String>(0);
}
public Change getByPath(final String path) {
@@ -632,6 +632,11 @@ public class SvnChangeList implements CommittedChangeList {
writeFiles(stream, myDeletedPaths);
writeMap(stream, myCopiedAddedPaths);
writeFiles(stream, myReplacedPaths);
stream.writeInt(myKnownAsDirectories.size());
for (String directory : myKnownAsDirectories) {
stream.writeUTF(directory);
}
}
// to be able to update plugin only
@@ -670,6 +675,11 @@ public class SvnChangeList implements CommittedChangeList {
if (supportsReplaced) {
readFiles(stream, myReplacedPaths);
}
final int size = stream.readInt();
for (int i = 0; i < size; i++) {
myKnownAsDirectories.add(stream.readUTF());
}
}
private static void writeMap(final DataOutput stream, final Map<String, String> map) throws IOException {
@@ -15,12 +15,17 @@
*/
package org.jetbrains.idea.svn.history;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.svn.SvnBundle;
import org.jetbrains.idea.svn.SvnRevisionNumber;
import org.jetbrains.idea.svn.SvnVcs;
import org.jetbrains.idea.svn.actions.AbstractShowPropertiesDiffAction;
@@ -59,18 +64,30 @@ public class SvnLazyPropertyContentRevision implements ContentRevision {
private String loadContent() {
final SvnVcs vcs = SvnVcs.getInstance(myProject);
final SVNWCClient client = vcs.createWCClient();
String list;
try {
list = AbstractShowPropertiesDiffAction.getPropertyList(myUrl, ((SvnRevisionNumber) myNumber).getRevision(), client);
final Ref<String> ref = new Ref<String>();
final Runnable runnable = new Runnable() {
@Override
public void run() {
try {
ref.set(AbstractShowPropertiesDiffAction.getPropertyList(myUrl, ((SvnRevisionNumber) myNumber).getRevision(), client));
}
catch (SVNException e) {
// unknown node kind (node deleted)
/*if (e.getErrorMessage().getErrorCode().getCode() == 145000) {
return "";
}*/
ref.set("Can not get properties: " + e.getMessage());
}
}
};
if (ApplicationManager.getApplication().isDispatchThread()) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(runnable, SvnBundle.message("progress.title.loading.file.properties"),
false, myProject);
}
catch (SVNException e) {
// unknown node kind (node deleted)
/*if (e.getErrorMessage().getErrorCode().getCode() == 145000) {
return "";
}*/
list = "Can not get properties: " + e.getMessage();
else {
runnable.run();
}
return list;
return ref.get();
}
@NotNull
@@ -227,9 +227,9 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
ElementReference, AttributeReference, GroupReference, AttributeGroupReference, TypeReference
}
private final ReferenceType myType;
private final @Nullable ReferenceType myType;
protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, ReferenceType type) {
protected TypeOrElementOrAttributeReference(PsiElement element, TextRange range, @Nullable ReferenceType type) {
myElement = element;
myRange = range;
@@ -245,6 +245,9 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
@Nullable
private static ReferenceType determineReferenceType(PsiElement element) {
final XmlAttribute attribute = PsiTreeUtil.getParentOfType(element, XmlAttribute.class);
if (attribute == null) {
return null;
}
final XmlTag tag = attribute.getParent();
final String localName = tag.getLocalName();
final String attributeLocalName = attribute.getLocalName();
@@ -463,7 +466,7 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
@NotNull
public Object[] getVariants() {
final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, true);
if (tag == null) return null;
if (tag == null || myType == null) return ArrayUtil.EMPTY_OBJECT_ARRAY;
String[] tagNames = null;
@@ -488,7 +491,14 @@ public class SchemaReferencesProvider extends PsiReferenceProvider {
CompletionProcessor processor = new CompletionProcessor();
processor.tag = tag;
XmlDocument document = ((XmlFile)PsiTreeUtil.getContextOfType(myElement, XmlElement.class, false).getContainingFile()).getDocument();
final XmlElement context = PsiTreeUtil.getContextOfType(myElement, XmlElement.class, false);
if (context == null) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final XmlDocument document = ((XmlFile)context.getContainingFile()).getDocument();
if (document == null) {
return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
final XmlTag rootTag = document.getRootTag();
String ourNamespace = rootTag != null ? rootTag.getAttributeValue(TARGET_NAMESPACE) : "";
if (ourNamespace == null) ourNamespace = "";