mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.psi.impl.source;
|
||||
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.LexerUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class ParsingContext {
|
||||
private final CharTable myTable;
|
||||
|
||||
public ParsingContext(final CharTable table) {
|
||||
myTable = table;
|
||||
}
|
||||
|
||||
public CharTable getCharTable() {
|
||||
return myTable;
|
||||
}
|
||||
|
||||
public CharSequence tokenText(Lexer lexer) {
|
||||
return LexerUtil.internToken(lexer, myTable);
|
||||
}
|
||||
}
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.psi.impl.source.parsing;
|
||||
|
||||
import com.intellij.lang.ASTFactory;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.impl.source.ParsingContext;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
|
||||
public abstract class DefaultWhiteSpaceTokenProcessorImpl implements TokenProcessor {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.parsing.DefaultWhiteSpaceTokenProcessorImpl");
|
||||
|
||||
@Override
|
||||
public boolean isTokenValid(IElementType tokenType) {
|
||||
return tokenType != null && isInSet(tokenType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TreeElement process(Lexer lexer, ParsingContext context) {
|
||||
TreeElement first = null;
|
||||
TreeElement last = null;
|
||||
while (isTokenValid(lexer.getTokenType())) {
|
||||
TreeElement tokenElement = ASTFactory.leaf(lexer.getTokenType(), context.tokenText(lexer));
|
||||
IElementType type = lexer.getTokenType();
|
||||
|
||||
if (!isInSet(type)) {
|
||||
LOG.error("Missed token should be white space or comment:" + tokenElement + "; type:" + type);
|
||||
throw new RuntimeException();
|
||||
}
|
||||
if (last != null) {
|
||||
last.rawInsertAfterMe(tokenElement);
|
||||
last = tokenElement;
|
||||
}
|
||||
else {
|
||||
first = last = tokenElement;
|
||||
}
|
||||
lexer.advance();
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
protected abstract boolean isInSet(final IElementType type);
|
||||
}
|
||||
-173
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.psi.impl.source.parsing;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.psi.impl.source.ParsingContext;
|
||||
import com.intellij.psi.impl.source.tree.CompositeElement;
|
||||
import com.intellij.psi.impl.source.tree.LeafElement;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
import com.intellij.psi.impl.source.tree.TreeUtil;
|
||||
import com.intellij.psi.templateLanguages.OuterLanguageElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.ILazyParseableElementType;
|
||||
|
||||
public class MissingTokenInserter {
|
||||
protected final CompositeElement myRoot;
|
||||
protected final Lexer myLexer;
|
||||
private final int myStartOffset;
|
||||
private final int myEndOffset;
|
||||
private final int myState;
|
||||
private final TokenProcessor myProcessor;
|
||||
private final ParsingContext myContext;
|
||||
|
||||
public MissingTokenInserter(final CompositeElement root,
|
||||
final Lexer lexer,
|
||||
final int startOffset,
|
||||
final int endOffset,
|
||||
final int state,
|
||||
final TokenProcessor processor,
|
||||
final ParsingContext context) {
|
||||
myRoot = root;
|
||||
myLexer = lexer;
|
||||
myStartOffset = startOffset;
|
||||
myEndOffset = endOffset;
|
||||
myState = state;
|
||||
myProcessor = processor;
|
||||
myContext = context;
|
||||
}
|
||||
|
||||
public void invoke() {
|
||||
if (myState < 0) {
|
||||
myLexer.start(myLexer.getBufferSequence(), myStartOffset, myEndOffset);
|
||||
}
|
||||
else {
|
||||
myLexer.start(myLexer.getBufferSequence(), myStartOffset, myEndOffset, myState);
|
||||
}
|
||||
|
||||
TreeElement leaf = TreeUtil.findFirstLeafOrChameleon(myRoot);
|
||||
if (leaf == null) {
|
||||
final TreeElement firstMissing = myProcessor.process(myLexer, myContext);
|
||||
if (firstMissing != null) {
|
||||
myRoot.rawAddChildren(firstMissing);
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// Missing in the beginning
|
||||
final IElementType tokenType = getNextTokenType();
|
||||
if (tokenType != leaf.getElementType() && myProcessor.isTokenValid(tokenType)) {
|
||||
final TreeElement firstMissing = myProcessor.process(myLexer, myContext);
|
||||
if (firstMissing != null) {
|
||||
myRoot.getFirstChildNode().rawInsertBeforeMe(firstMissing);
|
||||
}
|
||||
}
|
||||
passTokenOrChameleon(leaf);
|
||||
}
|
||||
// Missing in tree body
|
||||
insertMissingTokensInTreeBody(leaf);
|
||||
if (myLexer.getTokenType() != null) {
|
||||
// whitespaces at the end of the file
|
||||
final TreeElement firstMissing = myProcessor.process(myLexer, myContext);
|
||||
if (firstMissing != null) {
|
||||
ASTNode current = myRoot;
|
||||
while (current instanceof CompositeElement) {
|
||||
if (current.getUserData(TreeUtil.UNCLOSED_ELEMENT_PROPERTY) != null) break;
|
||||
current = current.getLastChildNode();
|
||||
}
|
||||
if (current instanceof CompositeElement) {
|
||||
((CompositeElement)current).rawAddChildren(firstMissing);
|
||||
}
|
||||
else {
|
||||
myRoot.getLastChildNode().rawInsertAfterMe(firstMissing);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected IElementType getNextTokenType() {
|
||||
return myLexer.getTokenType();
|
||||
}
|
||||
|
||||
private void insertMissingTokensInTreeBody(TreeElement leaf) {
|
||||
final TreeUtil.CommonParentState commonParents = new TreeUtil.CommonParentState();
|
||||
while (leaf != null) {
|
||||
commonParents.strongWhiteSpaceHolder = null;
|
||||
final IElementType tokenType = getNextTokenType();
|
||||
final TreeElement next = TreeUtil.nextLeaf(leaf, commonParents, tokenType instanceof ILazyParseableElementType ? tokenType : null, false);
|
||||
|
||||
if (next == null || tokenType == null) break;
|
||||
if (tokenType != next.getElementType() && myProcessor.isTokenValid(tokenType)) {
|
||||
final TreeElement firstMissing = myProcessor.process(myLexer, myContext);
|
||||
final CompositeElement unclosedElement = commonParents.strongWhiteSpaceHolder;
|
||||
if (unclosedElement != null) {
|
||||
if (commonParents.isStrongElementOnRisingSlope || unclosedElement.getFirstChildNode() == null) {
|
||||
unclosedElement.rawAddChildren(firstMissing);
|
||||
}
|
||||
else {
|
||||
unclosedElement.getFirstChildNode().rawInsertBeforeMe(firstMissing);
|
||||
}
|
||||
}
|
||||
else {
|
||||
final ASTNode insertBefore = commonParents.nextLeafBranchStart;
|
||||
TreeElement insertAfter = commonParents.startLeafBranchStart;
|
||||
TreeElement current = commonParents.startLeafBranchStart;
|
||||
while (current != insertBefore) {
|
||||
final TreeElement treeNext = current.getTreeNext();
|
||||
if (treeNext == insertBefore) {
|
||||
insertAfter = current;
|
||||
break;
|
||||
}
|
||||
if (isInsertAfterElement(treeNext)) {
|
||||
insertAfter = current;
|
||||
break;
|
||||
}
|
||||
if (treeNext.getUserData(TreeUtil.UNCLOSED_ELEMENT_PROPERTY) != null) {
|
||||
insertAfter = null;
|
||||
((CompositeElement)treeNext).rawAddChildren(firstMissing);
|
||||
break;
|
||||
}
|
||||
current = treeNext;
|
||||
}
|
||||
if (insertAfter != null) insertAfter.rawInsertAfterMe(firstMissing);
|
||||
}
|
||||
}
|
||||
passTokenOrChameleon(next);
|
||||
leaf = next;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isInsertAfterElement(TreeElement treeNext) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void passTokenOrChameleon(final ASTNode node) {
|
||||
if (node instanceof LeafElement && node instanceof OuterLanguageElement
|
||||
|| TreeUtil.isCollapsedChameleon(node)) {
|
||||
final int endOfChameleon = node.getTextLength() + myLexer.getTokenStart();
|
||||
while (myLexer.getTokenType() != null && myLexer.getTokenEnd() < endOfChameleon) {
|
||||
myLexer.advance();
|
||||
}
|
||||
}
|
||||
advanceLexer(node);
|
||||
}
|
||||
|
||||
protected void advanceLexer(final ASTNode next) {
|
||||
myLexer.advance();
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.psi.impl.source.parsing;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
import com.intellij.psi.impl.source.ParsingContext;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.lexer.Lexer;
|
||||
|
||||
public interface TokenProcessor {
|
||||
@Nullable
|
||||
TreeElement process(Lexer lexer, ParsingContext context);
|
||||
|
||||
boolean isTokenValid(IElementType tokenType);
|
||||
}
|
||||
@@ -18,6 +18,7 @@ package com.intellij.openapi.editor.colors;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class EditorColorsManager {
|
||||
@NonNls public static final String DEFAULT_SCHEME_NAME = "Default";
|
||||
|
||||
@@ -50,6 +50,7 @@ class DragHelper extends MouseDragHelper {
|
||||
if (myDragSource == null || !myDragSource.canBeDraggedOut()) return false;
|
||||
|
||||
TabLabel label = myTabs.myInfo2Label.get(myDragSource);
|
||||
if (label == null) return false;
|
||||
|
||||
int dX = dragToScreenPoint.x - startScreenPoint.x;
|
||||
int dY = dragToScreenPoint.y - startScreenPoint.y;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package com.intellij.ui.tabs.impl;
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.awt.RelativePoint;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@@ -31,7 +31,7 @@ public abstract class TabLayout {
|
||||
return new ShapeTransform.Top(rectangle);
|
||||
}
|
||||
|
||||
public boolean isDragOut(TabLabel tabLabel, int deltaX, int deltaY) {
|
||||
public boolean isDragOut(@NotNull TabLabel tabLabel, int deltaX, int deltaY) {
|
||||
return Math.abs(deltaY) > tabLabel.getSize().height * getDragOutMultiplier();
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -172,6 +172,7 @@ public class NotificationsConfigurationImpl extends NotificationsConfiguration i
|
||||
}
|
||||
|
||||
public synchronized void loadState(final Element state) {
|
||||
myIdToSettingsMap.clear();
|
||||
for (@NonNls Element child : (Iterable<? extends Element>)state.getChildren("notification")) {
|
||||
final NotificationSettings settings = NotificationSettings.load(child);
|
||||
if (settings != null) {
|
||||
|
||||
+10
-2
@@ -285,13 +285,21 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Name
|
||||
|
||||
@Override
|
||||
public void setGlobalScheme(EditorColorsScheme scheme) {
|
||||
mySchemesManager.setCurrentSchemeName(scheme == null ? DefaultColorSchemesManager.getInstance().getAllSchemes()[0].getName() : scheme.getName());
|
||||
mySchemesManager.setCurrentSchemeName(scheme == null ? getDefaultScheme().getName() : scheme.getName());
|
||||
fireChanges(scheme);
|
||||
}
|
||||
|
||||
private static DefaultColorsScheme getDefaultScheme() {
|
||||
return DefaultColorSchemesManager.getInstance().getAllSchemes()[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditorColorsScheme getGlobalScheme() {
|
||||
return mySchemesManager.getCurrentScheme();
|
||||
final EditorColorsScheme scheme = mySchemesManager.getCurrentScheme();
|
||||
if (scheme == null) {
|
||||
return getDefaultScheme();
|
||||
}
|
||||
return scheme;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile vFile, final EditorColorsScheme settings, final Project project) {
|
||||
public EditorHighlighter createEditorHighlighter(@NotNull final VirtualFile vFile, @NotNull final EditorColorsScheme settings, final Project project) {
|
||||
final FileType fileType = vFile.getFileType();
|
||||
if (fileType instanceof LanguageFileType) {
|
||||
LanguageFileType substFileType = substituteFileType(((LanguageFileType)fileType).getLanguage(), vFile, project);
|
||||
|
||||
+7
-4
@@ -40,14 +40,17 @@ public class CheckForUpdateAction extends AnAction implements DumbAware {
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
actionPerformed(project, true, null);
|
||||
actionPerformed(project, true, null, UpdateSettings.getInstance());
|
||||
}
|
||||
|
||||
public static void actionPerformed(Project project, final boolean enableLink, final @Nullable PluginHostsConfigurable hostsConfigurable) {
|
||||
public static void actionPerformed(Project project,
|
||||
final boolean enableLink,
|
||||
final @Nullable PluginHostsConfigurable hostsConfigurable,
|
||||
final UpdateSettings instance) {
|
||||
ProgressManager.getInstance().run(new Task.Modal(project, "Checking for updates", false) {
|
||||
@Override
|
||||
public void run(@NotNull ProgressIndicator indicator) {
|
||||
final CheckForUpdateResult result = UpdateChecker.checkForUpdates(UpdateSettings.getInstance(), PropertiesComponent.getInstance(),
|
||||
final CheckForUpdateResult result = UpdateChecker.checkForUpdates(instance, PropertiesComponent.getInstance(),
|
||||
true
|
||||
);
|
||||
|
||||
@@ -60,7 +63,7 @@ public class CheckForUpdateAction extends AnAction implements DumbAware {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateSettings.getInstance().LAST_TIME_CHECKED = System.currentTimeMillis();
|
||||
instance.LAST_TIME_CHECKED = System.currentTimeMillis();
|
||||
UpdateChecker.showUpdateResult(result, updatedPlugins, true, enableLink, true);
|
||||
}
|
||||
});
|
||||
|
||||
+4
-2
@@ -20,7 +20,6 @@ import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.actionSystem.PlatformDataKeys;
|
||||
import com.intellij.openapi.application.ApplicationInfo;
|
||||
import com.intellij.openapi.options.BaseConfigurable;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -118,7 +117,10 @@ public class UpdateSettingsConfigurable extends BaseConfigurable implements Sear
|
||||
myBtnCheckNow.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Project project = PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(myBtnCheckNow));
|
||||
CheckForUpdateAction.actionPerformed(project, false, null); //todo load configured hosts on the fly
|
||||
UpdateSettings settings = new UpdateSettings();
|
||||
settings.loadState(UpdateSettings.getInstance().getState());
|
||||
settings.UPDATE_CHANNEL_TYPE = getSelectedChannelType().getCode();
|
||||
CheckForUpdateAction.actionPerformed(project, false, null, settings); //todo load configured hosts on the fly
|
||||
updateLastCheckedLabel();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,10 +20,10 @@ import com.intellij.ide.CommonActionsManager;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.ActionToolbar;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.impl.ActionToolbarImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.CaptionPanel;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.border.CustomLineBorder;
|
||||
@@ -58,6 +58,8 @@ public class XFramesView extends XDebugViewBase {
|
||||
private XExecutionStack mySelectedStack;
|
||||
private boolean myListenersEnabled;
|
||||
private final Map<XExecutionStack, StackFramesListBuilder> myBuilders = new HashMap<XExecutionStack, StackFramesListBuilder>();
|
||||
private final ActionToolbarImpl myToolbar;
|
||||
private final Wrapper myThreadsPanel;
|
||||
|
||||
public XFramesView(final XDebugSession session, final Disposable parentDisposable) {
|
||||
super(session, parentDisposable);
|
||||
@@ -85,27 +87,28 @@ public class XFramesView extends XDebugViewBase {
|
||||
myThreadComboBox = new JComboBox();
|
||||
myThreadComboBox.setRenderer(new ThreadComboBoxRenderer(myThreadComboBox));
|
||||
myThreadComboBox.addItemListener(new MyItemListener());
|
||||
final ActionToolbar toolbar = createToolbar();
|
||||
Wrapper threadsPanel = new Wrapper();
|
||||
myToolbar = createToolbar();
|
||||
myThreadsPanel = new Wrapper();
|
||||
CustomLineBorder border = new CustomLineBorder(CaptionPanel.CNT_ACTIVE_COLOR, 0, 0, 1, 0);
|
||||
threadsPanel.setBorder(border);
|
||||
threadsPanel.add(toolbar.getComponent(), BorderLayout.EAST);
|
||||
threadsPanel.add(myThreadComboBox, BorderLayout.CENTER);
|
||||
myMainPanel.add(threadsPanel, BorderLayout.NORTH);
|
||||
myThreadsPanel.setBorder(border);
|
||||
myThreadsPanel.add(myToolbar.getComponent(), BorderLayout.EAST);
|
||||
myThreadsPanel.add(myThreadComboBox, BorderLayout.CENTER);
|
||||
myMainPanel.add(myThreadsPanel, BorderLayout.NORTH);
|
||||
|
||||
rebuildView(SessionEvent.RESUMED);
|
||||
}
|
||||
|
||||
private ActionToolbar createToolbar() {
|
||||
private ActionToolbarImpl createToolbar() {
|
||||
final DefaultActionGroup framesGroup = new DefaultActionGroup();
|
||||
|
||||
CommonActionsManager actionsManager = CommonActionsManager.getInstance();
|
||||
framesGroup.add(actionsManager.createPrevOccurenceAction(getFramesList()));
|
||||
framesGroup.add(actionsManager.createNextOccurenceAction(getFramesList()));
|
||||
|
||||
final ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
|
||||
final ActionToolbarImpl toolbar =
|
||||
(ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(ActionPlaces.DEBUGGER_TOOLBAR, framesGroup, true);
|
||||
toolbar.setReservePlaceAutoPopupIcon(false);
|
||||
((ActionToolbarImpl)toolbar).setAddSeparatorFirst(true);
|
||||
toolbar.setAddSeparatorFirst(true);
|
||||
toolbar.getComponent().setBorder(new EmptyBorder(1, 0, 0, 0));
|
||||
return toolbar;
|
||||
}
|
||||
@@ -152,6 +155,15 @@ public class XFramesView extends XDebugViewBase {
|
||||
}
|
||||
XExecutionStack activeExecutionStack = suspendContext.getActiveExecutionStack();
|
||||
myThreadComboBox.setSelectedItem(activeExecutionStack);
|
||||
final boolean invisible = executionStacks.length == 1 && StringUtil.isEmpty(executionStacks[0].getDisplayName());
|
||||
myThreadsPanel.removeAll();
|
||||
if (invisible) {
|
||||
myThreadsPanel.add(myToolbar.getComponent(), BorderLayout.WEST);
|
||||
} else {
|
||||
myThreadsPanel.add(myToolbar.getComponent(), BorderLayout.EAST);
|
||||
myThreadsPanel.add(myThreadComboBox, BorderLayout.CENTER);
|
||||
}
|
||||
myToolbar.setAddSeparatorFirst(!invisible);
|
||||
updateFrames(activeExecutionStack);
|
||||
myListenersEnabled = true;
|
||||
}
|
||||
|
||||
+21
-6
@@ -34,6 +34,7 @@ import org.jetbrains.idea.maven.dom.converters.MavenPluginCustomParameterValueCo
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomConfiguration;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomConfigurationParameter;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomPluginExecution;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomPluginManagement;
|
||||
import org.jetbrains.idea.maven.dom.plugin.MavenDomMojo;
|
||||
import org.jetbrains.idea.maven.dom.plugin.MavenDomParameter;
|
||||
import org.jetbrains.idea.maven.dom.plugin.MavenDomPluginModel;
|
||||
@@ -52,11 +53,23 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
return;
|
||||
}
|
||||
|
||||
boolean isInPluginManagement = isInPluginManagement(config);
|
||||
|
||||
for (ParameterData each : collectParameters(pluginModel, config)) {
|
||||
registerPluginParameter(r, each);
|
||||
registerPluginParameter(isInPluginManagement, r, each);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isInPluginManagement(MavenDomConfiguration config) {
|
||||
DomElement pluginNode = config.getParent();
|
||||
if (pluginNode == null) return false;
|
||||
|
||||
DomElement pluginsNode = pluginNode.getParent();
|
||||
if (pluginsNode == null) return false;
|
||||
|
||||
return pluginsNode.getParent() instanceof MavenDomPluginManagement;
|
||||
}
|
||||
|
||||
private static Collection<ParameterData> collectParameters(MavenDomPluginModel pluginModel, MavenDomConfiguration config) {
|
||||
List<String> selectedGoals = null;
|
||||
|
||||
@@ -124,15 +137,15 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPluginParameter(DomExtensionsRegistrar r, final ParameterData parameter) {
|
||||
private static void registerPluginParameter(boolean isInPluginManagement, DomExtensionsRegistrar r, final ParameterData parameter) {
|
||||
String paramName = parameter.parameter.getName().getStringValue();
|
||||
String alias = parameter.parameter.getAlias().getStringValue();
|
||||
|
||||
registerPluginParameter(r, parameter, paramName);
|
||||
if (alias != null) registerPluginParameter(r, parameter, alias);
|
||||
registerPluginParameter(isInPluginManagement, r, parameter, paramName);
|
||||
if (alias != null) registerPluginParameter(isInPluginManagement, r, parameter, alias);
|
||||
}
|
||||
|
||||
private static void registerPluginParameter(DomExtensionsRegistrar r, final ParameterData data, final String parameterName) {
|
||||
private static void registerPluginParameter(boolean isInPluginManagement, DomExtensionsRegistrar r, final ParameterData data, final String parameterName) {
|
||||
DomExtension e;
|
||||
if (isCollection(data.parameter)) {
|
||||
e = r.registerFixedNumberChildExtension(new XmlName(parameterName), MavenDomConfigurationParameter.class);
|
||||
@@ -149,7 +162,9 @@ public class MavenPluginConfigurationDomExtender extends DomExtender<MavenDomCon
|
||||
e = r.registerFixedNumberChildExtension(new XmlName(parameterName), MavenDomConfigurationParameter.class);
|
||||
|
||||
addValueConverter(e, data.parameter);
|
||||
addRequiredAnnotation(e, data);
|
||||
if (!isInPluginManagement) {
|
||||
addRequiredAnnotation(e, data);
|
||||
}
|
||||
}
|
||||
|
||||
e.setDeclaringElement(data.parameter);
|
||||
|
||||
+48
@@ -344,6 +344,54 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
|
||||
checkHighlighting();
|
||||
}
|
||||
|
||||
public void testGoalsCompletionAndHighlightingInPluginManagement() throws Throwable {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<build>" +
|
||||
" <pluginManagement>" +
|
||||
" <plugins>" +
|
||||
" <plugin>" +
|
||||
" <artifactId>maven-compiler-plugin</artifactId>" +
|
||||
" <executions>" +
|
||||
" <execution>" +
|
||||
" <goals>" +
|
||||
" <goal><caret></goal>" +
|
||||
" </goals>" +
|
||||
" </execution>" +
|
||||
" </executions>" +
|
||||
" </plugin>" +
|
||||
" </plugins>" +
|
||||
" </pluginManagement>" +
|
||||
"</build>");
|
||||
|
||||
assertCompletionVariants(myProjectPom, "compile", "testCompile");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<build>" +
|
||||
" <pluginManagement>" +
|
||||
" <plugins>" +
|
||||
" <plugin>" +
|
||||
" <artifactId>maven-compiler-plugin</artifactId>" +
|
||||
" <executions>" +
|
||||
" <execution>" +
|
||||
" <goals>" +
|
||||
" <goal><error>xxx</error></goal>" +
|
||||
" </goals>" +
|
||||
" </execution>" +
|
||||
" </executions>" +
|
||||
" </plugin>" +
|
||||
" </plugins>" +
|
||||
" </pluginManagement>" +
|
||||
"</build>");
|
||||
|
||||
checkHighlighting();
|
||||
}
|
||||
|
||||
public void testGoalsResolution() throws Throwable {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
|
||||
@@ -22,8 +22,6 @@ import com.intellij.lexer.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.impl.source.DummyHolderFactory;
|
||||
import com.intellij.psi.impl.source.ParsingContext;
|
||||
import com.intellij.psi.impl.source.parsing.TokenProcessor;
|
||||
import com.intellij.psi.impl.source.tree.*;
|
||||
import com.intellij.psi.templateLanguages.OuterLanguageElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -49,10 +47,10 @@ public class OldXmlParsing implements XmlElementType {
|
||||
public static final TokenSet XML_COMMENT_BIT_SET =
|
||||
TokenSet.create(new IElementType[]{XML_COMMENT_START, XML_COMMENT_CHARACTERS, XML_COMMENT_END});
|
||||
|
||||
private final ParsingContext myContext;
|
||||
private final XmlParsingContext myContext;
|
||||
private int myLastTokenEnd = -1;
|
||||
|
||||
public OldXmlParsing(ParsingContext context) {
|
||||
public OldXmlParsing(XmlParsingContext context) {
|
||||
myContext = context;
|
||||
}
|
||||
|
||||
@@ -931,13 +929,13 @@ public class OldXmlParsing implements XmlElementType {
|
||||
}
|
||||
}
|
||||
|
||||
public static class WhiteSpaceAndCommentsProcessor implements TokenProcessor {
|
||||
public static final TokenProcessor INSTANCE = new WhiteSpaceAndCommentsProcessor();
|
||||
public static class WhiteSpaceAndCommentsProcessor {
|
||||
public static final WhiteSpaceAndCommentsProcessor INSTANCE = new WhiteSpaceAndCommentsProcessor();
|
||||
|
||||
private WhiteSpaceAndCommentsProcessor() {
|
||||
}
|
||||
|
||||
public TreeElement process(Lexer lexer, ParsingContext context) {
|
||||
public TreeElement process(Lexer lexer, XmlParsingContext context) {
|
||||
TreeElement first = null;
|
||||
TreeElement last = null;
|
||||
while (isTokenValid(lexer.getTokenType())) {
|
||||
@@ -972,7 +970,7 @@ public class OldXmlParsing implements XmlElementType {
|
||||
return tokenType != null && XML_WHITE_SPACE_OR_COMMENT_BIT_SET.contains(tokenType);
|
||||
}
|
||||
|
||||
private TreeElement parseComment(Lexer lexer, ParsingContext context) {
|
||||
private TreeElement parseComment(Lexer lexer, XmlParsingContext context) {
|
||||
final CompositeElement comment = ASTFactory.composite(XML_COMMENT);
|
||||
|
||||
while (lexer.getTokenType() != null && XML_COMMENT_BIT_SET.contains(lexer.getTokenType())) {
|
||||
@@ -990,8 +988,8 @@ public class OldXmlParsing implements XmlElementType {
|
||||
int startOffset,
|
||||
int endOffset,
|
||||
int state,
|
||||
TokenProcessor processor,
|
||||
ParsingContext context) {
|
||||
WhiteSpaceAndCommentsProcessor processor,
|
||||
XmlParsingContext context) {
|
||||
if (state < 0) {
|
||||
lexer.start(lexer.getBufferSequence(), startOffset, endOffset);
|
||||
}
|
||||
@@ -1039,9 +1037,9 @@ public class OldXmlParsing implements XmlElementType {
|
||||
}
|
||||
}
|
||||
|
||||
public static void insertMissingTokensInTreeBody(TreeElement leaf, Lexer lexer,
|
||||
TokenProcessor processor,
|
||||
ParsingContext context,
|
||||
private static void insertMissingTokensInTreeBody(TreeElement leaf, Lexer lexer,
|
||||
WhiteSpaceAndCommentsProcessor processor,
|
||||
XmlParsingContext context,
|
||||
ASTNode endToken) {
|
||||
final TreeUtil.CommonParentState commonParents = new TreeUtil.CommonParentState();
|
||||
while (leaf != null) {
|
||||
|
||||
@@ -15,21 +15,31 @@
|
||||
*/
|
||||
package com.intellij.psi.impl.source.parsing.xml;
|
||||
|
||||
import com.intellij.psi.impl.source.ParsingContext;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.LexerUtil;
|
||||
import com.intellij.util.CharTable;
|
||||
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
public class XmlParsingContext extends ParsingContext {
|
||||
protected final OldXmlParsing myXmlParsing;
|
||||
public class XmlParsingContext {
|
||||
private final OldXmlParsing myXmlParsing;
|
||||
private final CharTable myTable;
|
||||
|
||||
public XmlParsingContext(final CharTable table) {
|
||||
myTable = table;
|
||||
myXmlParsing = new OldXmlParsing(this);
|
||||
}
|
||||
|
||||
public CharTable getCharTable() {
|
||||
return myTable;
|
||||
}
|
||||
|
||||
public CharSequence tokenText(Lexer lexer) {
|
||||
return LexerUtil.internToken(lexer, myTable);
|
||||
}
|
||||
|
||||
public OldXmlParsing getXmlParsing() {
|
||||
return myXmlParsing;
|
||||
}
|
||||
|
||||
public XmlParsingContext(final CharTable table) {
|
||||
super(table);
|
||||
myXmlParsing = new OldXmlParsing(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user