geertjanw closed pull request #274: Backport of dbalek's fixes made after Apr 22, 2017 URL: https://github.com/apache/incubator-netbeans/pull/274
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/debugger.jpda/nbproject/project.properties b/debugger.jpda/nbproject/project.properties index 00a64e360..1c600a93c 100644 --- a/debugger.jpda/nbproject/project.properties +++ b/debugger.jpda/nbproject/project.properties @@ -22,7 +22,7 @@ javac.compilerargs=-Xlint:unchecked javac.source=1.8 javadoc.arch=${basedir}/arch.xml requires.nb.javac=true -spec.version.base=1.107.0 +spec.version.base=1.108.0 test-unit-sys-prop.test.dir.src=${basedir}/test/unit/src/ test-unit-sys-prop.netbeans.user=${basedir}/work/nb_user_dir diff --git a/editor.completion/nbproject/project.properties b/editor.completion/nbproject/project.properties index 5f6165c40..aac52705c 100644 --- a/editor.completion/nbproject/project.properties +++ b/editor.completion/nbproject/project.properties @@ -16,7 +16,7 @@ # under the License. javac.compilerargs=-Xlint:unchecked -javac.source=1.7 +javac.source=1.8 javadoc.arch=${basedir}/arch.xml javadoc.apichanges=${basedir}/apichanges.xml spec.version.base=1.45.0 diff --git a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java index 1455a938b..ff1a368dc 100644 --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java +++ b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java @@ -32,7 +32,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.logging.Level; import java.util.logging.LogRecord; @@ -320,6 +319,9 @@ public void insertUpdate(javax.swing.event.DocumentEvent e) { if (ensureActiveProviders()) { try { int modEndOffset = e.getOffset() + e.getLength(); + if (modEndOffset != getActiveComponent().getCaretPosition()) { + return; + } String typedText = e.getDocument().getText(e.getOffset(), e.getLength()); for (int i = 0; i < activeProviders.length; i++) { int type = activeProviders[i].getAutoQueryTypes(getActiveComponent(), typedText); @@ -756,6 +758,7 @@ private void dispatchKeyEvent(KeyEvent e) { CompletionItem item = layout.getSelectedCompletionItem(); if (item != null) { sendUndoableEdit(doc, CloneableEditorSupport.BEGIN_COMMIT_GROUP); + MulticaretHandler mch = MulticaretHandler.create(comp); try { if (compEditable && !guardedPos) { LogRecord r = new LogRecord(Level.FINE, "COMPL_KEY_SELECT"); // NOI18N @@ -785,6 +788,7 @@ private void dispatchKeyEvent(KeyEvent e) { return; } } finally { + mch.release(); sendUndoableEdit(doc, CloneableEditorSupport.END_COMMIT_GROUP); } } else if (e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_DOWN @@ -1144,10 +1148,12 @@ public void run() { if (block == null || block[1] == caretOffset) { // NOI18N CompletionItem item = sortedResultItems.get(0); sendUndoableEdit(doc, CloneableEditorSupport.BEGIN_COMMIT_GROUP); + MulticaretHandler mch = MulticaretHandler.create(c); try { if (item.instantSubstitution(c)) return; } finally { + mch.release(); sendUndoableEdit(doc, CloneableEditorSupport.END_COMMIT_GROUP); } } diff --git a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java index 4295d37af..6d097185d 100644 --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java +++ b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java @@ -400,9 +400,11 @@ public void mouseClicked(MouseEvent evt) { r.setParameters(new Object[] { null, completionScrollPane.getSelectedIndex(), selectedItem.getClass().getSimpleName()}); CompletionImpl.uilog(r); CompletionImpl.sendUndoableEdit(doc, CloneableEditorSupport.BEGIN_COMMIT_GROUP); + MulticaretHandler mch = MulticaretHandler.create(c); try { selectedItem.defaultAction(c); } finally { + mch.release(); CompletionImpl.sendUndoableEdit(doc, CloneableEditorSupport.END_COMMIT_GROUP); } } diff --git a/editor.completion/src/org/netbeans/modules/editor/completion/MulticaretHandler.java b/editor.completion/src/org/netbeans/modules/editor/completion/MulticaretHandler.java new file mode 100644 index 000000000..74c35fa8c --- /dev/null +++ b/editor.completion/src/org/netbeans/modules/editor/completion/MulticaretHandler.java @@ -0,0 +1,126 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.netbeans.modules.editor.completion; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import javax.swing.text.BadLocationException; +import javax.swing.text.Caret; +import javax.swing.text.Document; +import javax.swing.text.JTextComponent; +import javax.swing.text.Position; +import org.netbeans.api.editor.caret.CaretInfo; +import org.netbeans.api.editor.caret.EditorCaret; +import org.netbeans.editor.Utilities; +import org.netbeans.lib.editor.util.CharSequenceUtilities; +import org.netbeans.lib.editor.util.swing.DocumentUtilities; +import org.netbeans.lib.editor.util.swing.MutablePositionRegion; +import org.openide.text.NbDocument; +import org.openide.util.Exceptions; + +/** + * + * @author Dusan Balek + */ +class MulticaretHandler { + + static MulticaretHandler create(JTextComponent c) { + return new MulticaretHandler(c); + } + + private final Document doc; + private ArrayList<MutablePositionRegion> regions = null; + + private MulticaretHandler(final JTextComponent c) { + this.doc = c.getDocument(); + doc.render(() -> { + Caret caret = c.getCaret(); + if (caret instanceof EditorCaret) { + List<CaretInfo> carets = ((EditorCaret) caret).getCarets(); + if (carets.size() > 1) { + this.regions = new ArrayList<>(carets.size()); + carets.forEach((ci) -> { + try { + int[] block = ci.isSelectionShowing() ? null : Utilities.getIdentifierBlock(c, ci.getDot()); + Position start = NbDocument.createPosition(doc, block != null ? block[0] : ci.getSelectionStart(), Position.Bias.Backward); + Position end = NbDocument.createPosition(doc, block != null ? block[1] : ci.getSelectionEnd(), Position.Bias.Forward); + regions.add(new MutablePositionRegion(start, end)); + } catch (BadLocationException ex) {} + }); + Collections.reverse(regions); + } + } + }); + } + + void release() { + String firstRegionText = getFirstRegionText(); + if (firstRegionText != null) { + int regionCount = regions.size(); + for (int i = 1; i < regionCount; i++) { + MutablePositionRegion region = regions.get(i); + int offset = region.getStartOffset(); + int length = region.getEndOffset() - offset; + try { + final CharSequence old = DocumentUtilities.getText(doc, offset, length); + if (!CharSequenceUtilities.textEquals(firstRegionText, old)) { + int res = -1; + for(int k = 0; k < Math.min(old.length(), firstRegionText.length()); k++) { + if (old.charAt(k) == firstRegionText.charAt(k)) { + res = k; + } else { + break; + } + } + String insert = firstRegionText.substring(res+1); + CharSequence remove = old.subSequence(res + 1, old.length()); + if (insert.length() > 0) { + doc.insertString(offset + res + 1, insert, null); + } + if (remove.length() > 0) { + doc.remove(offset + res + 1 + insert.length(), remove.length()); + } + } + } catch (BadLocationException e) { + Exceptions.printStackTrace(e); + } + } + } + } + + private String getFirstRegionText() { + return getRegionText(0); + } + + private String getRegionText(int regionIndex) { + if (regions != null) { + try { + MutablePositionRegion region = regions.get(regionIndex); + int offset = region.getStartOffset(); + int length = region.getEndOffset() - offset; + return doc.getText(offset, length); + } catch (BadLocationException e) { + Exceptions.printStackTrace(e); + } + } + return null; + } +} diff --git a/editor.indent/nbproject/project.xml b/editor.indent/nbproject/project.xml index 6ff0f0e1c..63ae84922 100644 --- a/editor.indent/nbproject/project.xml +++ b/editor.indent/nbproject/project.xml @@ -48,7 +48,7 @@ <compile-dependency/> <run-dependency> <release-version>1</release-version> - <specification-version>1.18</specification-version> + <specification-version>1.58</specification-version> </run-dependency> </dependency> <dependency> diff --git a/editor.indent/src/org/netbeans/modules/editor/indent/IndentImpl.java b/editor.indent/src/org/netbeans/modules/editor/indent/IndentImpl.java index 81049d4ec..239140c8a 100644 --- a/editor.indent/src/org/netbeans/modules/editor/indent/IndentImpl.java +++ b/editor.indent/src/org/netbeans/modules/editor/indent/IndentImpl.java @@ -21,10 +21,13 @@ import java.util.logging.Level; import java.util.logging.Logger; +import java.util.prefs.Preferences; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Element; import javax.swing.text.StyledDocument; +import org.netbeans.api.editor.mimelookup.MimeLookup; +import org.netbeans.api.editor.settings.SimpleValueNames; import org.netbeans.modules.editor.indent.api.Indent; import org.netbeans.modules.editor.indent.api.Reformat; @@ -51,6 +54,8 @@ public static IndentImpl get(Document doc) { private final Document doc; + private final Preferences prefs; + private Indent indent; private Reformat reformat; @@ -71,6 +76,8 @@ public static IndentImpl get(Document doc) { public IndentImpl(Document doc) { this.doc = doc; + String mimeType = (String)doc.getProperty("mimeType"); //NOI18N + this.prefs = mimeType != null ? MimeLookup.getLookup(mimeType).lookup(Preferences.class) : null; } public Document document() { @@ -251,27 +258,29 @@ public int reindent(int startOffset, int endOffset, int caretOffset, boolean ind } } - int startLineIndex = lineRootElem.getElementIndex(startOffset); - Element lineElem = lineRootElem.getElement(startLineIndex); - int startLineOffset = lineElem.getStartOffset(); - // Find ending line element - by default use the same as for start offset - if (endOffset > lineElem.getEndOffset()) { // need to get a different line element - int endLineIndex = lineRootElem.getElementIndex(endOffset); - lineElem = lineRootElem.getElement(endLineIndex); - // Check if the given endOffset ends right after line's newline (in fact at the begining of the next line) - if (endLineIndex > 0 && lineElem.getStartOffset() == endOffset) { - endLineIndex--; + if (prefs == null || prefs.getBoolean(SimpleValueNames.ENABLE_INDENTATION, true)) { + int startLineIndex = lineRootElem.getElementIndex(startOffset); + Element lineElem = lineRootElem.getElement(startLineIndex); + int startLineOffset = lineElem.getStartOffset(); + // Find ending line element - by default use the same as for start offset + if (endOffset > lineElem.getEndOffset()) { // need to get a different line element + int endLineIndex = lineRootElem.getElementIndex(endOffset); lineElem = lineRootElem.getElement(endLineIndex); + // Check if the given endOffset ends right after line's newline (in fact at the begining of the next line) + if (endLineIndex > 0 && lineElem.getStartOffset() == endOffset) { + endLineIndex--; + lineElem = lineRootElem.getElement(endLineIndex); + } } - } - // Create context from begining of the start line till the end of the end line. - indentHandler.setGlobalBounds( - doc.createPosition(startLineOffset), - doc.createPosition(lineElem.getEndOffset() - 1)); + // Create context from begining of the start line till the end of the end line. + indentHandler.setGlobalBounds( + doc.createPosition(startLineOffset), + doc.createPosition(lineElem.getEndOffset() - 1)); - // Perform whole reindent on top and possibly embedded levels - indentHandler.runTasks(); + // Perform whole reindent on top and possibly embedded levels + indentHandler.runTasks(); + } // XXX: formatting infra cleanup // done = true; } diff --git a/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java b/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java index 24f22c484..12c06e296 100644 --- a/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java +++ b/editor.lib2/src/org/netbeans/api/editor/caret/EditorCaret.java @@ -1108,7 +1108,7 @@ public void paint(Graphics g) { int dot = caretItem.getDot(); Rectangle newCaretBounds = lvh.modelToViewBounds(dot, Position.Bias.Forward); Rectangle oldBounds = caretItem.setCaretBoundsWithRepaint(newCaretBounds, c, "EditorCaret.paint()", i); - if (caretItem == lastCaret) { + if (caretItem == lastCaret && oldBounds != null) { maybeSaveCaretOffset(c, oldBounds); } } @@ -1973,8 +1973,10 @@ private void update(boolean calledFromPaint) { } if (forceUpdate) { Rectangle cbounds = getLastCaretItem().getCaretBounds(); - // save relative position of the main caret - maybeSaveCaretOffset(c, cbounds); + if (cbounds != null) { + // save relative position of the main caret + maybeSaveCaretOffset(c, cbounds); + } } if (!calledFromPaint && !c.isValid() /* && maintainVisible == null */) { updateLaterDuringPaint = true; diff --git a/editor.settings/manifest.mf b/editor.settings/manifest.mf index efbf51d62..a93550176 100644 --- a/editor.settings/manifest.mf +++ b/editor.settings/manifest.mf @@ -1,5 +1,5 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.editor.settings/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/settings/Bundle.properties -OpenIDE-Module-Specification-Version: 1.57 +OpenIDE-Module-Specification-Version: 1.58 OpenIDE-Module-Needs: org.netbeans.api.editor.settings.implementation diff --git a/editor.settings/src/org/netbeans/api/editor/settings/SimpleValueNames.java b/editor.settings/src/org/netbeans/api/editor/settings/SimpleValueNames.java index 079d94940..151f1c597 100644 --- a/editor.settings/src/org/netbeans/api/editor/settings/SimpleValueNames.java +++ b/editor.settings/src/org/netbeans/api/editor/settings/SimpleValueNames.java @@ -38,6 +38,13 @@ public static final String TAB_SIZE = "tab-size"; // NOI18N /** + * Whether indentation is enabled. + * Values: java.lang.Boolean instances + * @since 1.58 + */ + public static final String ENABLE_INDENTATION = "enable-indent"; // NOI18N + + /** * Whether expand typed tabs to spaces. The number of spaces to substitute * per one typed tab is determined by SPACES_PER_TAB setting. * Values: java.lang.Boolean instances diff --git a/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/JavaPersistenceGenerator.java b/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/JavaPersistenceGenerator.java index 52bf00c64..f8c9278a4 100644 --- a/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/JavaPersistenceGenerator.java +++ b/j2ee.persistence/src/org/netbeans/modules/j2ee/persistence/wizard/fromdb/JavaPersistenceGenerator.java @@ -965,9 +965,12 @@ private Property(Modifier modifier, List<AnnotationTree> annotations, Comment co if (xmlTransient) { AnnotationTree xmlTransientAn = genUtils.createAnnotation( "javax.xml.bind.annotation.XmlTransient"); //NOI18N - TypeElement jsonIgnore = copy.getElements().getTypeElement( - moduleElement, - "org.codehaus.jackson.annotate.JsonIgnore"); // NOI18N + TypeElement jsonIgnore = moduleElement != null + ? copy.getElements().getTypeElement( + moduleElement, + "org.codehaus.jackson.annotate.JsonIgnore") // NOI18N + : copy.getElements().getTypeElement( + "org.codehaus.jackson.annotate.JsonIgnore"); // NOI18N List<AnnotationTree> annotationTrees; if ( jsonIgnore == null ){ annotationTrees = Collections.singletonList(xmlTransientAn); @@ -1431,7 +1434,9 @@ protected void generateRelationship(RelationshipRole role) throws IOException { if(replacedTypeNames.containsKey(typeName)) { typeName = replacedTypeNames.get(typeName); } - TypeElement typeEl = copy.getElements().getTypeElement(moduleElement, typeName); + TypeElement typeEl = moduleElement != null + ? copy.getElements().getTypeElement(moduleElement, typeName) + : copy.getElements().getTypeElement(typeName); //need some extended logging if null, see issue # 217461 if(typeEl == null) { Logger.getLogger(JavaPersistenceGenerator.class.getName()).log(Level.WARNING, "Null typeelement for {0}", typeName); //NOI18N @@ -1449,7 +1454,9 @@ protected void generateRelationship(RelationshipRole role) throws IOException { TypeMirror fieldType = typeEl.asType(); if (role.isToMany()) { // Use the collection type the user wants - TypeElement collectionTypeElem = copy.getElements().getTypeElement(moduleElement, collectionType.className()); + TypeElement collectionTypeElem = moduleElement != null + ? copy.getElements().getTypeElement(moduleElement, collectionType.className()) + : copy.getElements().getTypeElement(collectionType.className()); fieldType = copy.getTypes().getDeclaredType(collectionTypeElem, fieldType); } diff --git a/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java b/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java index 3cef6028c..c3b8eae3c 100644 --- a/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java +++ b/java.completion/src/org/netbeans/modules/java/completion/JavaCompletionTask.java @@ -3051,7 +3051,7 @@ public boolean accept(Element e, TypeMirror t) { if (e.getEnclosingElement() != enclClass && conflictsWithLocal(e.getSimpleName(), enclClass, locals)) { results.add(itemFactory.createStaticMemberItem(env.getController(), (DeclaredType)e.getEnclosingElement().asType(), e, et, false, anchorOffset, elements.isDeprecated(e), env.addSemicolon())); } else { - results.add(itemFactory.createExecutableItem(env.getController(), (ExecutableElement) e, et, anchorOffset, null, env.getScope().getEnclosingClass() != e.getEnclosingElement(), elements.isDeprecated(e), false, env.addSemicolon(), isOfSmartType(env, getCorrectedReturnType(env, et, (ExecutableElement) e, enclClass.asType()), smartTypes), env.assignToVarPos(), false)); + results.add(itemFactory.createExecutableItem(env.getController(), (ExecutableElement) e, et, anchorOffset, null, env.getScope().getEnclosingClass() != e.getEnclosingElement(), elements.isDeprecated(e), false, env.addSemicolon(), isOfSmartType(env, getCorrectedReturnType(env, et, (ExecutableElement) e, enclClass != null ? enclClass.asType() : null), smartTypes), env.assignToVarPos(), false)); } break; } @@ -3631,7 +3631,7 @@ private void addEnumConstants(Env env, TypeElement elem) { if (path != null && path.getLeaf().getKind() == Tree.Kind.SWITCH) { SwitchTree st = (SwitchTree)path.getLeaf(); for (CaseTree ct : st.getCases()) { - Element e = trees.getElement(new TreePath(path, ct.getExpression())); + Element e = ct.getExpression() != null ? trees.getElement(new TreePath(path, ct.getExpression())) : null; if (e != null && e.getKind() == ENUM_CONSTANT) { alreadyUsed.add(e); } @@ -4750,7 +4750,7 @@ public boolean accept(Element e, TypeMirror t) { private TypeMirror getCorrectedReturnType(Env env, ExecutableType et, ExecutableElement el, TypeMirror site) { TypeMirror type = et.getReturnType(); - if (site.getKind() == TypeKind.DECLARED) { + if (site != null && site.getKind() == TypeKind.DECLARED) { if ("getClass".contentEquals(el.getSimpleName()) && et.getParameterTypes().isEmpty() //NOI18N && type.getKind() == TypeKind.DECLARED && JAVA_LANG_CLASS.contentEquals(((TypeElement) ((DeclaredType) type).asElement()).getQualifiedName()) diff --git a/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionItem.java b/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionItem.java index 8077de375..7b341730a 100644 --- a/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionItem.java +++ b/java.editor/src/org/netbeans/modules/editor/java/JavaCompletionItem.java @@ -2011,6 +2011,7 @@ protected CharSequence substituteText(final JTextComponent c, final int offset, if (toAddText.length() > idx + 1) { sb.append(toAddText.substring(idx + 1)); } + showTooltip = true; } } } @@ -2055,7 +2056,6 @@ public void run(ResultIterator resultIterator) throws Exception { } }, NbBundle.getMessage(JavaCompletionItem.class, "JCI-import_resolve"), cancel, false); //NOI18N } - showTooltip = true; return sb; } diff --git a/java.editor/src/org/netbeans/modules/editor/java/MethodParamsTipPaintComponent.java b/java.editor/src/org/netbeans/modules/editor/java/MethodParamsTipPaintComponent.java index 1ea181225..f28d34022 100644 --- a/java.editor/src/org/netbeans/modules/editor/java/MethodParamsTipPaintComponent.java +++ b/java.editor/src/org/netbeans/modules/editor/java/MethodParamsTipPaintComponent.java @@ -21,6 +21,7 @@ import java.awt.*; import java.util.List; +import java.util.Map; import javax.swing.*; import javax.swing.text.JTextComponent; @@ -68,7 +69,21 @@ public void paintComponent(Graphics g) { Rectangle r = g.getClipBounds(); g.fillRect(r.x, r.y, r.width, r.height); g.setColor(getForeground()); - draw(g); + + Object value = (Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); //NOI18N + Map renderingHints = (value instanceof Map) ? (java.util.Map)value : null; + if (renderingHints != null && g instanceof Graphics2D) { + Graphics2D g2d = (Graphics2D) g; + RenderingHints oldHints = g2d.getRenderingHints(); + g2d.addRenderingHints(renderingHints); + try { + draw(g2d); + } finally { + g2d.setRenderingHints(oldHints); + } + } else { + draw(g); + } } protected void draw(Graphics g) { diff --git a/java.hints/src/org/netbeans/modules/java/hints/AssignResultToVariable.java b/java.hints/src/org/netbeans/modules/java/hints/AssignResultToVariable.java index 5635dfb13..39b8b8146 100644 --- a/java.hints/src/org/netbeans/modules/java/hints/AssignResultToVariable.java +++ b/java.hints/src/org/netbeans/modules/java/hints/AssignResultToVariable.java @@ -160,7 +160,7 @@ public AssignResultToVariable() { TypeMirror type = Utilities.resolveTypeForDeclaration( info, base ); - if (!error && !Utilities.isValidType(base)) { + if (!error && !Utilities.isValidType(base) && type.getKind() != TypeKind.EXECUTABLE) { if (treePath.getLeaf().getKind() == Tree.Kind.METHOD_INVOCATION) { TypeMirror retType = ((ExecutableElement)elem).getReturnType(); if (!info.getTypes().isAssignable(info.getTypes().erasure(retType), info.getTypes().erasure(type))) { diff --git a/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java b/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java index 31671c6ac..5dd80c3f4 100644 --- a/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java +++ b/java.hints/src/org/netbeans/modules/java/hints/errors/ImportClass.java @@ -285,7 +285,7 @@ public ImportClass() { fixes.add(new UseFQN(info, file, fqn, eh, "Z#" + fqn, treePath, prefered, false)); fixes.add(UseFQN.createShared(info, file, fqn, eh, fqn, treePath, prefered)); } else { - fixes.add(new FixImport(file, fqn, ElementHandle.create(element), sort.toString(), + fixes.add(new FixImport(file, fqn, eh, sort.toString(), prefered, info, changePath, replaceSuffix, doOrganize)); } } diff --git a/java.navigation/src/org/netbeans/modules/java/stackanalyzer/StackLineAnalyser.java b/java.navigation/src/org/netbeans/modules/java/stackanalyzer/StackLineAnalyser.java index d72b0e7ea..0a50e6a58 100644 --- a/java.navigation/src/org/netbeans/modules/java/stackanalyzer/StackLineAnalyser.java +++ b/java.navigation/src/org/netbeans/modules/java/stackanalyzer/StackLineAnalyser.java @@ -20,6 +20,8 @@ package org.netbeans.modules.java.stackanalyzer; import java.io.IOException; +import java.util.ArrayList; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.text.StyledDocument; @@ -75,14 +77,14 @@ static Link analyse(String line) { return null; } if (matcher.group(1)==null ) { - return new Link(matcher.group(4).split("\\$")[0], + return new Link(matcher.group(4), lineNumber, matcher.start(4), matcher.end(6)+1 ); } - return new Link(matcher.group(1) + matcher.group(4).split("\\$")[0], + return new Link(matcher.group(1) + matcher.group(4), lineNumber, matcher.start(1), matcher.end(6)+1 @@ -118,10 +120,18 @@ int getEndOffset () { return endOffset; } - void show () { - final String resource = className.replace ('.', '/') + ".java"; //NOI18N + void show () { + String name = className.replace('.', '/'); + final List<String> resources = new ArrayList<>(); + resources.add(name + ".java"); //NOI18N + int idx = name.lastIndexOf('$'); + while (idx >= 0) { + name = name.substring(0, idx); + resources.add(name + ".java"); //NOI18N + idx = name.lastIndexOf('$'); + } final ProgressHandle handle = ProgressHandleFactory.createHandle( - NbBundle.getMessage(StackLineAnalyser.class, "TXT_OpeningSource", resource)); + NbBundle.getMessage(StackLineAnalyser.class, "TXT_OpeningSource", resources.get(0))); handle.start(); RP.execute( new Runnable() { @@ -131,7 +141,11 @@ public void run() { try { final ClassPath classPath = ClassPathSupport.createClassPath( GlobalPathRegistry.getDefault().getSourceRoots().toArray(new FileObject[0])); - dobj = findDataObject(classPath.findResource(resource)); + for (String resource : resources) { + dobj = findDataObject(classPath.findResource(resource)); + if (dobj != null) + break; + } } finally { final DataObject dataObject = dobj; Mutex.EVENT.readAccess(new Runnable() { @@ -142,7 +156,7 @@ public void run() { StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(StackLineAnalyser.class, "AnalyzeStackTopComponent.sourceNotFound", - new Object[]{resource})); + new Object[]{resources.get(0)})); return; } try { diff --git a/java.source.base/src/org/netbeans/api/java/source/CompilationInfo.java b/java.source.base/src/org/netbeans/api/java/source/CompilationInfo.java index 8a47f53d5..dc26bf2d5 100644 --- a/java.source.base/src/org/netbeans/api/java/source/CompilationInfo.java +++ b/java.source.base/src/org/netbeans/api/java/source/CompilationInfo.java @@ -274,7 +274,8 @@ public CompilationUnitTree getCompilationUnit() { * @since 0.124 */ public @NonNull DocTrees getDocTrees() { - return (DocTrees) getTrees(); + final Trees ts = getTrees(); + return ts instanceof DocTrees ? (DocTrees) ts : JavacTrees.instance(impl.getJavacTask().getContext()); } /** diff --git a/java.source.base/src/org/netbeans/modules/java/source/PostFlowAnalysis.java b/java.source.base/src/org/netbeans/modules/java/source/PostFlowAnalysis.java index a82bb6f15..b8ee58fc6 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/PostFlowAnalysis.java +++ b/java.source.base/src/org/netbeans/modules/java/source/PostFlowAnalysis.java @@ -143,12 +143,16 @@ public void visitMethodDef(JCMethodDecl tree) { } Type type = types.erasure(tree.type); for (Symbol sym : s.getSymbolsByName(tree.name)) { - if (sym != tree.sym && !sym.type.isErroneous() && !type.isErroneous() && - !isUnknown(sym.type) && !isUnknown(type) && - types.isSameType(types.erasure(sym.type), type)) { - log.error(tree.pos(), "name.clash.same.erasure", tree.sym, sym); //NOI18N - return; - } + try { + boolean clash = sym != tree.sym + && !sym.type.isErroneous() + && !type.isErroneous() + && types.isSameType(types.erasure(sym.type), type); + if (clash) { + log.error(tree.pos(), "name.clash.same.erasure", tree.sym, sym); //NOI18N + return; + } + } catch (AssertionError e) {} } } @@ -228,18 +232,4 @@ private void checkStringConstant(DiagnosticPosition pos, Object constValue) { if (constValue instanceof String && ((String)constValue).length() >= Pool.MAX_STRING_LENGTH) log.error(pos, "limit.string"); //NOI18N } - - private boolean isUnknown(Type t) { - return t != null && t.accept(new Types.DefaultTypeVisitor<Boolean, Void>() { - @Override - public Boolean visitType(Type t, Void s) { - return t.hasTag(TypeTag.UNKNOWN); - } - - @Override - public Boolean visitMethodType(Type.MethodType t, Void s) { - return visit(t.getReturnType(), s); - } - }, null); - } } diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java index c84ad6f97..6eb2075bc 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java +++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java @@ -556,35 +556,35 @@ private static void clear( if (cont) { file = new File(classFolder, withoutExt + '.' + FileObjects.SIG); if (file.exists()) { - if (!javaContext.getFQNs().check(FileObjects.getBinaryName(file, classFolder), relURLPair.second())) { - String fileName = file.getName(); - fileName = fileName.substring(0, fileName.lastIndexOf('.')); - final String[][] patterns = new String[][]{ - new String[]{fileName + '.', "", FileObjects.SIG, FileObjects.RS, FileObjects.RAPT, FileObjects.RX}, //NOI18N - new String[]{fileName + '$', null, FileObjects.SIG} //NOI18N - }; - File parent = file.getParentFile(); - FilenameFilter filter = new FilenameFilter() { - - @Override - public boolean accept(File dir, String name) { - for (final String[] pattern : patterns) { - if (name.startsWith(pattern[0])) { - final String ext = FileObjects.getExtension(name); - for (int i = 2; i< pattern.length; i++) { - if (pattern[i].equals(ext) && (pattern[1] == null || name.length() == pattern[0].length() + pattern[i].length())) { - return true; - } + String fileName = file.getName(); + fileName = fileName.substring(0, fileName.lastIndexOf('.')); + final String[][] patterns = new String[][]{ + new String[]{fileName + '.', "", FileObjects.SIG, FileObjects.RS, FileObjects.RAPT, FileObjects.RX}, //NOI18N + new String[]{fileName + '$', null, FileObjects.SIG} //NOI18N + }; + File parent = file.getParentFile(); + FilenameFilter filter = new FilenameFilter() { + + @Override + public boolean accept(File dir, String name) { + for (final String[] pattern : patterns) { + if (name.startsWith(pattern[0])) { + final String ext = FileObjects.getExtension(name); + for (int i = 2; i< pattern.length; i++) { + if (pattern[i].equals(ext) && (pattern[1] == null || name.length() == pattern[0].length() + pattern[i].length())) { + return true; } } } - return false; } - }; - final File[] children = parent.listFiles(filter); - if (children != null) { - for (File f : children) { - String className = FileObjects.getBinaryName(f, classFolder); + return false; + } + }; + final File[] children = parent.listFiles(filter); + if (children != null) { + for (File f : children) { + String className = FileObjects.getBinaryName(f, classFolder); + if (!javaContext.getFQNs().check(className, relURLPair.second())) { javaContext.getFQNs().remove(className, relURLPair.second()); toDelete.add( FileObjects.MODULE_INFO.equals(className) ? diff --git a/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java b/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java index 5975abf76..2791df72c 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java +++ b/java.source.base/src/org/netbeans/modules/java/source/parsing/JavacParser.java @@ -703,7 +703,7 @@ static JavacTaskImpl createJavacTask( } if (Optional.ofNullable(mayBeParser.map(p->(p.file)) .orElse(file)) - .filter((f)->FileObjects.MODULE_INFO.equals(f.getName())).isPresent()) { + .filter((f)->FileObjects.MODULE_INFO.equals(f.getName())&&FileObjects.CLASS.equals(f.getExt())).isPresent()) { flags.add(ConfigFlags.MODULE_INFO); } try(final ModuleOraculum mo = ModuleOraculum.getInstance()) { @@ -1035,15 +1035,20 @@ private static JavacTaskImpl createJavacTask( xmoduleSeen = true; } else if (option.equals("-parameters") || option.startsWith("-Xlint")) { //NOI18N res.add(option); - } else if (i+1 < options.size() && ( - option.equals("--add-modules") || //NOI18N - option.equals("--limit-modules") || //NOI18N - option.equals("--add-exports") || //NOI18N - option.equals("--add-reads") || - option.equals(OPTION_PATCH_MODULE))) { - res.add(option); - option = options.get(++i); - res.add(option); + } else if ( + option.startsWith("--add-modules") || //NOI18N + option.startsWith("--limit-modules") || //NOI18N + option.startsWith("--add-exports") || //NOI18N + option.startsWith("--add-reads") || + option.startsWith(OPTION_PATCH_MODULE)) { + int idx = option.indexOf('='); + if (idx > 0) { + res.add(option); + } else if (i+1 < options.size()) { + res.add(option); + option = options.get(++i); + res.add(option); + } } } return res; diff --git a/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java b/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java index 4ffcf8aba..db2883092 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java +++ b/java.source.base/src/org/netbeans/modules/java/source/pretty/WidthEstimator.java @@ -86,6 +86,9 @@ private void width(Type ty) { } } public void widthQ(Symbol t) { + if (t == null) { + return; + } if (t.owner != null && t.owner != symbols.rootPackage && t.owner != t.packge().modle.unnamedPackage && !(t.type instanceof Type.TypeVar) && !(t.owner instanceof MethodSymbol)) { diff --git a/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java b/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java index f91046fa7..b68c6031f 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java +++ b/java.source.base/src/org/netbeans/modules/java/source/save/Reformatter.java @@ -618,10 +618,11 @@ public Boolean visitCompilationUnit(CompilationUnitTree node, Void p) { for (Tree typeDecl : node.getTypeDecls()) { if (semiRead && typeDecl.getKind() == Tree.Kind.EMPTY_STATEMENT) continue; - if (TreeUtilities.CLASS_TREE_KINDS.contains(typeDecl.getKind())) + if (TreeUtilities.CLASS_TREE_KINDS.contains(typeDecl.getKind())) { blankLines(cs.getBlankLinesBeforeClass()); - else - blankLines(1); + } else { + blankLines(typeDecl.getKind() == Tree.Kind.MODULE ? 0 : 1); + } scan(typeDecl, p); int index = tokens.index(); int c = col; @@ -2294,9 +2295,49 @@ public Boolean visitUnionType(UnionTypeTree node, Void p) { } return true; } + + /** + * Finds the end of the line (for brace insertion) after the statement Tree, provided + * the statement is followed nu whitespace only. + * @param statement + * @return + */ + private int findNewlineAfterStatement(Tree statement) { + int pos = (int)sp.getEndPosition(root, statement); + if (pos < 0) { + return pos; + } + int index = tokens.index(); + try { + tokens.move(pos); + while (tokens.moveNext()) { + Token<JavaTokenId> tukac = tokens.token(); + switch (tukac.id()) { + case WHITESPACE: { + int nl = tukac.text().toString().indexOf('\n'); + if (nl != -1) { + return tokens.offset() + nl + 1; + } + break; + } + case LINE_COMMENT: + // up to and including EOL: + return tokens.offset() + tukac.length(); + case BLOCK_COMMENT: + break; + default: + return pos; + } + } + } finally { + tokens.moveIndex(index); + tokens.moveNext(); + } + return pos; + } @Override - public Boolean visitIf(IfTree node, Void p) { + public Boolean visitIf(final IfTree node, Void p) { accept(IF); boolean old = continuationIndent; try { @@ -2308,9 +2349,11 @@ public Boolean visitIf(IfTree node, Void p) { } StatementTree elseStat = node.getElseStatement(); CodeStyle.BracesGenerationStyle redundantIfBraces = cs.redundantIfBraces(); + int eoln = findNewlineAfterStatement(node); if ((elseStat != null && redundantIfBraces == CodeStyle.BracesGenerationStyle.ELIMINATE && danglingElseChecker.hasDanglingElse(node.getThenStatement())) || - (redundantIfBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node) || node.getCondition().getKind() == Tree.Kind.ERRONEOUS))) + (redundantIfBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < eoln || node.getCondition().getKind() == Tree.Kind.ERRONEOUS))) { redundantIfBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; + } lastIndent = indent; boolean prevblock = wrapStatement(cs.wrapIfStatement(), redundantIfBraces, cs.spaceBeforeIfLeftBrace() ? 1 : 0, node.getThenStatement()); if (elseStat != null) { @@ -2339,8 +2382,9 @@ public Boolean visitIf(IfTree node, Void p) { lastIndent -= indentSize; } else { redundantIfBraces = cs.redundantIfBraces(); - if (redundantIfBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node))) + if (redundantIfBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < eoln)) { redundantIfBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; + } wrapElse = cs.wrapIfStatement(); } wrapStatement(wrapElse, redundantIfBraces, cs.spaceBeforeElseLeftBrace() ? 1 : 0, preserveNewLine, elseStat); @@ -2354,9 +2398,11 @@ public Boolean visitDoWhileLoop(DoWhileLoopTree node, Void p) { lastIndent = indent; boolean old = continuationIndent; try { + int eoln = findNewlineAfterStatement(node); CodeStyle.BracesGenerationStyle redundantDoWhileBraces = cs.redundantDoWhileBraces(); - if (redundantDoWhileBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node) || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)) + if (redundantDoWhileBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < eoln || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)) { redundantDoWhileBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; + } boolean isBlock = node.getStatement().getKind() == Tree.Kind.BLOCK || redundantDoWhileBraces == CodeStyle.BracesGenerationStyle.GENERATE; if (isBlock && redundantDoWhileBraces == CodeStyle.BracesGenerationStyle.ELIMINATE) { Iterator<? extends StatementTree> stats = ((BlockTree)node.getStatement()).getStatements().iterator(); @@ -2396,9 +2442,11 @@ public Boolean visitWhileLoop(WhileLoopTree node, Void p) { continuationIndent = old; } lastIndent = indent; + int eoln = findNewlineAfterStatement(node); CodeStyle.BracesGenerationStyle redundantWhileBraces = cs.redundantWhileBraces(); - if (redundantWhileBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node) || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)) + if (redundantWhileBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < eoln || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)) { redundantWhileBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; + } wrapStatement(cs.wrapWhileStatement(), redundantWhileBraces, cs.spaceBeforeWhileLeftBrace() ? 1 : 0, node.getStatement()); return true; } @@ -2459,8 +2507,10 @@ public Boolean visitForLoop(ForLoopTree node, Void p) { } lastIndent = indent; CodeStyle.BracesGenerationStyle redundantForBraces = cs.redundantForBraces(); - if (redundantForBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node))) + int eoln = findNewlineAfterStatement(node); + if (redundantForBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < eoln || node.getCondition().getKind() == Tree.Kind.ERRONEOUS)) { redundantForBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; + } wrapStatement(cs.wrapForStatement(), redundantForBraces, cs.spaceBeforeForLeftBrace() ? 1 : 0, node.getStatement()); return true; } @@ -2484,8 +2534,10 @@ public Boolean visitEnhancedForLoop(EnhancedForLoopTree node, Void p) { } lastIndent = indent; CodeStyle.BracesGenerationStyle redundantForBraces = cs.redundantForBraces(); - if (redundantForBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < sp.getEndPosition(root, node))) + int eoln = findNewlineAfterStatement(node); + if (redundantForBraces == CodeStyle.BracesGenerationStyle.GENERATE && (startOffset > sp.getStartPosition(root, node) || endOffset < eoln)) { redundantForBraces = CodeStyle.BracesGenerationStyle.LEAVE_ALONE; + } wrapStatement(cs.wrapForStatement(), redundantForBraces, cs.spaceBeforeForLeftBrace() ? 1 : 0, node.getStatement()); return true; } @@ -4229,6 +4281,12 @@ private void wrapList(CodeStyle.WrapStyle wrapStyle, boolean align, boolean prep for (Iterator<? extends Tree> it = trees.iterator(); it.hasNext();) { Tree impl = it.next(); if (wrapAnnotation && impl.getKind() == Tree.Kind.ANNOTATION) { + if (!first) { + boolean containedNewLine = spaces(spaceBeforeSeparator ? 1 : 0, false); + if (separator.equals(accept(separator)) && containedNewLine) { + newline(); + } + } wrapTree(CodeStyle.WrapStyle.WRAP_ALWAYS, alignIndent, spaceAfterSeparator ? 1 : 0, impl); } else if (impl.getKind() == Tree.Kind.ERRONEOUS) { scan(impl, null); diff --git a/java.source.base/src/org/netbeans/modules/java/source/save/Reindenter.java b/java.source.base/src/org/netbeans/modules/java/source/save/Reindenter.java index 91fb6bfa3..e97762d55 100644 --- a/java.source.base/src/org/netbeans/modules/java/source/save/Reindenter.java +++ b/java.source.base/src/org/netbeans/modules/java/source/save/Reindenter.java @@ -61,6 +61,8 @@ import java.util.Set; import javax.swing.text.BadLocationException; +import javax.tools.Diagnostic; +import javax.tools.DiagnosticListener; import javax.tools.JavaFileObject; import org.netbeans.api.java.lexer.JavaTokenId; @@ -211,7 +213,10 @@ private boolean initRegionData(final Region region) { ClassLoader origCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(Reindenter.class.getClassLoader()); - JavacTaskImpl javacTask = (JavacTaskImpl)JavacTool.create().getTask(null, null, diagnostic -> { + JavacTaskImpl javacTask = (JavacTaskImpl)JavacTool.create().getTask(null, null, new DiagnosticListener<JavaFileObject>() { + @Override + public void report(Diagnostic<? extends JavaFileObject> diagnostic) { + } }, Collections.singletonList("-proc:none"), null, Collections.<JavaFileObject>emptySet()); //NOI18N com.sun.tools.javac.util.Context ctx = javacTask.getContext(); JavaCompiler.instance(ctx).genEndPos = true; @@ -356,7 +361,7 @@ private int getNewIndent(int startOffset, int endOffset) throws BadLocationExcep if (prevTokenId != null) { switch (prevTokenId) { case LBRACE: - if (path.get(1).getKind() == Kind.NEW_CLASS && isLeftBraceOnNewLine(lastPos, startOffset)) { + if (path.size() > 1 && path.get(1).getKind() == Kind.NEW_CLASS && isLeftBraceOnNewLine(lastPos, startOffset)) { switch (cs.getClassDeclBracePlacement()) { case SAME_LINE: case NEW_LINE: @@ -594,7 +599,7 @@ private int getNewIndent(int startOffset, int endOffset) throws BadLocationExcep } else if (isStatic) { currentIndent += cs.getIndentSize(); } else if (isLeftBraceOnNewLine(lastPos, startOffset)) { - switch (path.get(1).getKind() == Kind.METHOD ? cs.getMethodDeclBracePlacement() : cs.getOtherBracePlacement()) { + switch (path.size() > 1 && path.get(1).getKind() == Kind.METHOD ? cs.getMethodDeclBracePlacement() : cs.getOtherBracePlacement()) { case SAME_LINE: case NEW_LINE: currentIndent += cs.getIndentSize(); @@ -630,10 +635,8 @@ private int getNewIndent(int startOffset, int endOffset) throws BadLocationExcep break; } } else if (!isLeftBraceOnNewLine(lastPos, startOffset)) { - int i = getCurrentIndent(path.get(1), path); - if (i >= 0) { - currentIndent = i; - } + int i = path.size() > 1 ? getCurrentIndent(path.get(1), path) : -1; + currentIndent = i < 0 ? currentIndent + cs.getIndentSize() : i; } break; case SWITCH: diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/save/FormatingTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/save/FormatingTest.java index c2f91bd69..bf448e3e2 100644 --- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/save/FormatingTest.java +++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/save/FormatingTest.java @@ -4180,8 +4180,19 @@ public void test133225() throws Exception { + " i++;\n" + " }\n" + "}\n"; + String golden2 = + "package hierbas.del.litoral;\n" + + "public class Test{\n" + + " public void test() {\n" + + " int i = 5;\n" + + " if (i > 0)\n" + + " i++;\n" + + " if (i > 0)\n" + + " i++;\n" + + " }\n" + + "}\n"; reformat(doc, content, golden, 92, 128); - reformat(doc, content, golden, 92, 127); + reformat(doc, content, golden2, 92, 127); golden = "package hierbas.del.litoral;\n" @@ -4195,8 +4206,19 @@ public void test133225() throws Exception { + " }\n" + " }\n" + "}\n"; - reformat(doc, content, golden, 128, 163); - reformat(doc, content, golden, 127, 163); + golden2 = + "package hierbas.del.litoral;\n" + + "public class Test{\n" + + " public void test() {\n" + + " int i = 5;\n" + + " if (i > 0)\n" + + " i++;\n" + + " if (i > 0)\n" + + " i++;\n" + + " }\n" + + "}\n"; + reformat(doc, content, golden, 128, 164); + reformat(doc, content, golden2, 127, 163); } public void test177858() throws Exception { diff --git a/java.source/src/org/netbeans/modules/java/ui/Bundle.properties b/java.source/src/org/netbeans/modules/java/ui/Bundle.properties index 489205918..12714e001 100644 --- a/java.source/src/org/netbeans/modules/java/ui/Bundle.properties +++ b/java.source/src/org/netbeans/modules/java/ui/Bundle.properties @@ -223,6 +223,7 @@ LBL_br_bracesPlacement=Braces Placement LBL_br_bracesGeneration=Braces Generation LBL_al_newLines=New Lines LBL_al_multilineAlignment=Multiline Alignment +LBL_bp_ModuleDecl=Modu&le Declaration\: LBL_bp_ClassDecl=&Class Declaration\: LBL_bp_MethodDecl=&Method Declaration\: LBL_bp_Other=&Other\: diff --git a/java.source/src/org/netbeans/modules/java/ui/FmtBraces.form b/java.source/src/org/netbeans/modules/java/ui/FmtBraces.form index 2289aaf66..399932fc6 100644 --- a/java.source/src/org/netbeans/modules/java/ui/FmtBraces.form +++ b/java.source/src/org/netbeans/modules/java/ui/FmtBraces.form @@ -43,49 +43,47 @@ <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <Component id="bracesPlacementLabel" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jSeparator1" max="32767" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="bracesGenerationLabel" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jSeparator2" max="32767" attributes="0"/> + </Group> <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0"> - <Component id="bracesPlacementLabel" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jSeparator1" pref="103" max="32767" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <Component id="bracesGenerationLabel" min="-2" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jSeparator2" pref="98" max="32767" attributes="0"/> - </Group> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="doWhileBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="otherLabel" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="methodDeclLabel" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="whileBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="12" max="-2" attributes="0"/> - <Group type="103" groupAlignment="1" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="otherCombo" linkSize="1" alignment="0" min="-2" max="-2" attributes="1"/> - <Component id="classDeclCombo" linkSize="1" alignment="0" min="-2" max="-2" attributes="1"/> - <Component id="ifBracesCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="1"/> - <Component id="forBracesCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="1"/> - <Component id="whileBracesCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/> - </Group> - <Component id="doWhileBracesCombo" linkSize="1" min="-2" max="-2" attributes="0"/> - <Component id="methodDeclCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="1"/> - </Group> + <Component id="doWhileBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="otherLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="methodDeclLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="whileBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="12" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Group type="103" alignment="1" groupAlignment="0" attributes="0"> + <Component id="otherCombo" linkSize="1" alignment="0" min="-2" max="-2" attributes="1"/> + <Component id="classDeclCombo" linkSize="1" alignment="0" min="-2" max="-2" attributes="1"/> + <Component id="ifBracesCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="1"/> + <Component id="forBracesCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="1"/> + <Component id="whileBracesCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="moduleDeclCombo" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <Component id="classDeclLabel" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="specialElseIfCheckBox" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="ifBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="forBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="doWhileBracesCombo" linkSize="1" min="-2" max="-2" attributes="0"/> + <Component id="methodDeclCombo" linkSize="1" alignment="1" min="-2" max="-2" attributes="1"/> </Group> </Group> + <Component id="classDeclLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="specialElseIfCheckBox" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="ifBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="forBracesLabel" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="moduleDeclLabel" alignment="0" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace max="-2" attributes="0"/> + <EmptySpace min="-2" pref="16" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -99,6 +97,11 @@ </Group> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> + <Component id="moduleDeclLabel" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="moduleDeclCombo" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> <Component id="classDeclLabel" alignment="3" min="-2" pref="18" max="-2" attributes="0"/> <Component id="classDeclCombo" alignment="3" min="-2" max="-2" attributes="0"/> </Group> @@ -115,7 +118,7 @@ <EmptySpace max="-2" attributes="0"/> <Component id="specialElseIfCheckBox" min="-2" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> + <Group type="102" alignment="0" attributes="0"> <EmptySpace min="-2" pref="20" max="-2" attributes="0"/> <Component id="bracesGenerationLabel" min="-2" max="-2" attributes="0"/> </Group> @@ -341,5 +344,30 @@ </Component> <Component class="javax.swing.JSeparator" name="jSeparator2"> </Component> + <Component class="javax.swing.JLabel" name="moduleDeclLabel"> + <Properties> + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> + <ComponentRef name="methodDeclCombo"/> + </Property> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/java/ui/Bundle.properties" key="LBL_bp_ModuleDecl" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JComboBox" name="moduleDeclCombo"> + <Properties> + <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> + <StringArray count="4"> + <StringItem index="0" value="Item 1"/> + <StringItem index="1" value="Item 2"/> + <StringItem index="2" value="Item 3"/> + <StringItem index="3" value="Item 4"/> + </StringArray> + </Property> + </Properties> + <AuxValues> + <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> + </AuxValues> + </Component> </SubComponents> </Form> diff --git a/java.source/src/org/netbeans/modules/java/ui/FmtBraces.java b/java.source/src/org/netbeans/modules/java/ui/FmtBraces.java index 55e6582e2..7d6257e82 100644 --- a/java.source/src/org/netbeans/modules/java/ui/FmtBraces.java +++ b/java.source/src/org/netbeans/modules/java/ui/FmtBraces.java @@ -33,6 +33,7 @@ /** Creates new form FmtAlignmentBraces */ public FmtBraces() { initComponents(); + moduleDeclCombo.putClientProperty(OPTION_ID, moduleDeclBracePlacement); classDeclCombo.putClientProperty(OPTION_ID, classDeclBracePlacement); methodDeclCombo.putClientProperty(OPTION_ID, methodDeclBracePlacement); otherCombo.putClientProperty(OPTION_ID, otherBracePlacement); @@ -76,6 +77,8 @@ private void initComponents() { doWhileBracesCombo = new javax.swing.JComboBox(); jSeparator1 = new javax.swing.JSeparator(); jSeparator2 = new javax.swing.JSeparator(); + moduleDeclLabel = new javax.swing.JLabel(); + moduleDeclCombo = new javax.swing.JComboBox<>(); setName(org.openide.util.NbBundle.getMessage(FmtBraces.class, "LBL_Braces")); // NOI18N setOpaque(false); @@ -129,14 +132,27 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { doWhileBracesCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + moduleDeclLabel.setLabelFor(methodDeclCombo); + org.openide.awt.Mnemonics.setLocalizedText(moduleDeclLabel, org.openide.util.NbBundle.getMessage(FmtBraces.class, "LBL_bp_ModuleDecl")); // NOI18N + + moduleDeclCombo.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addComponent(bracesPlacementLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator1)) + .addGroup(layout.createSequentialGroup() + .addComponent(bracesGenerationLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jSeparator2)) + .addGroup(layout.createSequentialGroup() + .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(doWhileBracesLabel) .addComponent(otherLabel) @@ -144,41 +160,24 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(whileBracesLabel)) .addGap(12, 12, 12) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(otherCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( ifBracesCombo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( forBracesCombo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent( whileBracesCombo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(doWhileBracesCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(otherCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(ifBracesCombo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(forBracesCombo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(whileBracesCombo, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(moduleDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(doWhileBracesCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(methodDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(layout.createSequentialGroup() - .addComponent(bracesPlacementLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(classDeclLabel)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(specialElseIfCheckBox)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(ifBracesLabel)) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addComponent(forBracesLabel)) - .addGroup(layout.createSequentialGroup() - .addComponent(bracesGenerationLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE))) - .addContainerGap()) + .addComponent(classDeclLabel) + .addComponent(specialElseIfCheckBox) + .addComponent(ifBracesLabel) + .addComponent(forBracesLabel) + .addComponent(moduleDeclLabel)) + .addGap(16, 16, 16)) ); - layout.linkSize( javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[]{classDeclCombo, doWhileBracesCombo, forBracesCombo, ifBracesCombo, methodDeclCombo, otherCombo, whileBracesCombo}); + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {classDeclCombo, doWhileBracesCombo, forBracesCombo, ifBracesCombo, methodDeclCombo, otherCombo, whileBracesCombo}); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -189,6 +188,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(moduleDeclLabel) + .addComponent(moduleDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(classDeclLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(classDeclCombo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) @@ -248,6 +251,8 @@ private void methodDeclComboActionPerformed(java.awt.event.ActionEvent evt) {//G private javax.swing.JSeparator jSeparator2; private javax.swing.JComboBox methodDeclCombo; private javax.swing.JLabel methodDeclLabel; + private javax.swing.JComboBox<String> moduleDeclCombo; + private javax.swing.JLabel moduleDeclLabel; private javax.swing.JComboBox otherCombo; private javax.swing.JLabel otherLabel; private javax.swing.JCheckBox specialElseIfCheckBox; diff --git a/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java b/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java index 8c7814831..b1be743e5 100644 --- a/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java +++ b/java.sourceui/src/org/netbeans/api/java/source/ui/ElementJavadoc.java @@ -1291,7 +1291,7 @@ private void appendReference(StringBuilder sb, ReferenceTree ref, List<? extends if (element != null) { createLink(sb, element, label == null || label.isEmpty() ? sig : inlineTags(label, docPath, doc, trees, null)); //NOI18N } else { - sb.append(sig); + sb.append(label == null || label.isEmpty() ? sig : inlineTags(label, docPath, doc, trees, null)); } } diff --git a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java index 0c14f4274..95adf50ba 100644 --- a/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java +++ b/lib.nbjavac/src/org/netbeans/lib/nbjavac/services/NBParserFactory.java @@ -79,7 +79,9 @@ public JavacParser newParser(CharSequence input, boolean keepDocComments, boolea public JavacParser newParser(CharSequence input, int startPos, final EndPosTable endPos) { Scanner lexer = scannerFactory.newScanner(input, true); lexer.seek(startPos); - ((NBJavacParser.EndPosTableImpl)endPos).resetErrorEndPos(); + if (endPos instanceof NBJavacParser.EndPosTableImpl) { + ((NBJavacParser.EndPosTableImpl)endPos).resetErrorEndPos(); + } return new NBJavacParser(this, lexer, true, false, true, false, cancelService) { @Override protected AbstractEndPosTable newEndPosTable(boolean keepEndPositions) { return new AbstractEndPosTable(this) { diff --git a/libs.javacapi/external/binaries-list b/libs.javacapi/external/binaries-list index c2a37ed4e..8a50118cb 100644 --- a/libs.javacapi/external/binaries-list +++ b/libs.javacapi/external/binaries-list @@ -14,4 +14,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -A0D73583DB9546DBC57E88181135039369827B5B nb-javac-api.jar +C6E5101D6A096D90AD8CF9E0F21C30F1D6DA74D4 nb-javac-api.jar diff --git a/libs.javacapi/nbproject/project.properties b/libs.javacapi/nbproject/project.properties index 66800e762..b31df1009 100644 --- a/libs.javacapi/nbproject/project.properties +++ b/libs.javacapi/nbproject/project.properties @@ -21,7 +21,7 @@ javac.source=1.6 javadoc.title=Javac API nbm.homepage=http://jackpot.netbeans.org/ nbm.module.author=Petr Hrebejk -spec.version.base=8.21.0 +spec.version.base=8.22.0 release.external/nb-javac-api.jar=modules/ext/nb-javac-api.jar javadoc.arch=${basedir}/arch.xml module.javadoc.packages=com.sun.source.tree,com.sun.source.util diff --git a/libs.javacimpl/external/binaries-list b/libs.javacimpl/external/binaries-list index 6982d1ac7..9f45e7de6 100644 --- a/libs.javacimpl/external/binaries-list +++ b/libs.javacimpl/external/binaries-list @@ -14,4 +14,4 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -071355012BD9E174619F838E72F1869277E24B69 nb-javac-impl.jar +BB17923713699B721CDB3BDBBAE863D8C8B291E3 nb-javac-impl.jar diff --git a/libs.javacimpl/nbproject/project.properties b/libs.javacimpl/nbproject/project.properties index b602c8a77..73b79d30b 100644 --- a/libs.javacimpl/nbproject/project.properties +++ b/libs.javacimpl/nbproject/project.properties @@ -18,7 +18,7 @@ is.autoload=true javac.source=1.6 nbm.homepage=http://jackpot.netbeans.org/ nbm.module.author=Petr Hrebejk -spec.version.base=0.47.0 +spec.version.base=0.48.0 release.external/nb-javac-impl.jar=modules/ext/nb-javac-impl.jar javadoc.arch=${basedir}/arch.xml diff --git a/libs.javacimpl/nbproject/project.xml b/libs.javacimpl/nbproject/project.xml index 7944a18f3..ccbd0ec15 100644 --- a/libs.javacimpl/nbproject/project.xml +++ b/libs.javacimpl/nbproject/project.xml @@ -30,7 +30,7 @@ <build-prerequisite/> <compile-dependency/> <run-dependency> - <specification-version>8.17</specification-version> + <specification-version>8.22</specification-version> </run-dependency> </dependency> </module-dependencies> diff --git a/options.editor/manifest.mf b/options.editor/manifest.mf index b3d6b8291..3526826f9 100644 --- a/options.editor/manifest.mf +++ b/options.editor/manifest.mf @@ -2,6 +2,6 @@ Manifest-Version: 1.0 OpenIDE-Module: org.netbeans.modules.options.editor/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/options/editor/Bundle.properties OpenIDE-Module-Layer: org/netbeans/modules/options/editor/mf-layer.xml -OpenIDE-Module-Specification-Version: 1.60 +OpenIDE-Module-Specification-Version: 1.61 AutoUpdate-Show-In-Client: false diff --git a/options.editor/nbproject/project.xml b/options.editor/nbproject/project.xml index 76941ae06..61f2d4f0f 100644 --- a/options.editor/nbproject/project.xml +++ b/options.editor/nbproject/project.xml @@ -84,23 +84,23 @@ <compile-dependency/> <run-dependency> <release-version>1</release-version> - <specification-version>1.44</specification-version> + <specification-version>1.58</specification-version> </run-dependency> </dependency> <dependency> - <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base> + <code-name-base>org.netbeans.modules.editor.settings.lib</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> - <release-version>1</release-version> <specification-version>1.49</specification-version> </run-dependency> </dependency> <dependency> - <code-name-base>org.netbeans.modules.editor.settings.lib</code-name-base> + <code-name-base>org.netbeans.modules.editor.settings.storage</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> + <release-version>1</release-version> <specification-version>1.49</specification-version> </run-dependency> </dependency> @@ -195,7 +195,7 @@ </run-dependency> </dependency> <dependency> - <code-name-base>org.openide.util.ui</code-name-base> + <code-name-base>org.openide.util</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> @@ -203,19 +203,19 @@ </run-dependency> </dependency> <dependency> - <code-name-base>org.openide.util</code-name-base> + <code-name-base>org.openide.util.lookup</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> - <specification-version>9.3</specification-version> + <specification-version>8.0</specification-version> </run-dependency> </dependency> <dependency> - <code-name-base>org.openide.util.lookup</code-name-base> + <code-name-base>org.openide.util.ui</code-name-base> <build-prerequisite/> <compile-dependency/> <run-dependency> - <specification-version>8.0</specification-version> + <specification-version>9.3</specification-version> </run-dependency> </dependency> <dependency> diff --git a/options.editor/src/org/netbeans/modules/options/indentation/Bundle.properties b/options.editor/src/org/netbeans/modules/options/indentation/Bundle.properties index 8236bae46..a172c4873 100644 --- a/options.editor/src/org/netbeans/modules/options/indentation/Bundle.properties +++ b/options.editor/src/org/netbeans/modules/options/indentation/Bundle.properties @@ -27,6 +27,9 @@ indentation-customizer-display-name=Tabs And Indents CTL_Override_Global_Options=&Use All Languages Settings AN_Override_Global_Options=Use All Languages Settings AD_Override_Global_Options=Use All Languages Settings +CTL_Enable_Indent=Enable &Indentation +AN_Enable_Indent=Enable &Indentation +AD_Enable_Indent=Enable &Indentation CTL_Expand_Tabs=&Expand Tabs to Spaces AN_Expand_Tabs=Expand Tabs to Spaces AD_Expand_Tabs=Expand Tabs to Spaces diff --git a/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.form b/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.form index 28bce824d..8d038ea64 100644 --- a/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.form +++ b/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.form @@ -52,7 +52,7 @@ <Group type="102" alignment="0" attributes="0"> <Component id="cbOverrideGlobalOptions" min="-2" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jPanel1" max="32767" attributes="0"/> + <Component id="jPanel1" min="-2" max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> @@ -81,39 +81,46 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="1" attributes="0"> - <Component id="lNumberOfSpacesPerIndent" min="-2" pref="207" max="-2" attributes="2"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="sNumberOfSpacesPerIndent" linkSize="3" min="-2" pref="53" max="-2" attributes="1"/> + <Group type="102" attributes="0"> + <Component id="cbEnableIndentation" min="-2" max="-2" attributes="0"/> + <EmptySpace min="0" pref="0" max="32767" attributes="0"/> </Group> - <Group type="102" alignment="1" attributes="0"> - <Component id="lTabSize" min="-2" pref="207" max="-2" attributes="1"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="sTabSize" linkSize="3" min="-2" pref="54" max="-2" attributes="1"/> - </Group> - <Group type="102" alignment="1" attributes="0"> - <Component id="lRightMargin" min="-2" pref="207" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="sRightMargin" linkSize="3" min="-2" pref="62" max="-2" attributes="1"/> - </Group> - <Group type="102" alignment="1" attributes="0"> - <Component id="lLineWrap" min="-2" pref="117" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="cboLineWrap" min="-2" pref="152" max="-2" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <Component id="lNumberOfSpacesPerIndent" min="-2" pref="207" max="-2" attributes="2"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="sNumberOfSpacesPerIndent" linkSize="3" min="-2" pref="53" max="-2" attributes="1"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="lTabSize" min="-2" pref="207" max="-2" attributes="1"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="sTabSize" linkSize="3" min="-2" pref="54" max="-2" attributes="1"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="lRightMargin" min="-2" pref="207" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="sRightMargin" linkSize="3" min="-2" pref="62" max="-2" attributes="1"/> + </Group> + <Group type="102" alignment="1" attributes="0"> + <Component id="lLineWrap" min="-2" pref="117" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="cboLineWrap" min="-2" pref="152" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace min="-2" pref="8" max="-2" attributes="0"/> </Group> + <Component id="cbExpandTabsToSpaces" alignment="0" max="32767" attributes="1"/> </Group> <EmptySpace max="-2" attributes="0"/> </Group> - <Group type="102" attributes="0"> - <EmptySpace min="20" pref="20" max="20" attributes="0"/> - <Component id="cbExpandTabsToSpaces" max="32767" attributes="1"/> - <EmptySpace min="-2" pref="54" max="-2" attributes="0"/> - </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> + <Group type="102" alignment="1" attributes="0"> + <Component id="cbEnableIndentation" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> <Component id="cbExpandTabsToSpaces" min="-2" pref="19" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> @@ -141,6 +148,16 @@ </DimensionLayout> </Layout> <SubComponents> + <Component class="javax.swing.JCheckBox" name="cbEnableIndentation"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="org/netbeans/modules/options/indentation/Bundle.properties" key="CTL_Enable_Indent" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + </Property> + </Properties> + <AuxValues> + <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new ControlledCheckBox()"/> + </AuxValues> + </Component> <Component class="javax.swing.JCheckBox" name="cbExpandTabsToSpaces"> <Properties> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> diff --git a/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.java b/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.java index 5cf59549b..d5dec97b2 100644 --- a/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.java +++ b/options.editor/src/org/netbeans/modules/options/indentation/IndentationPanel.java @@ -160,6 +160,7 @@ public IndentationPanel(MimePath mimePath, CustomizerSelector.PreferencesFactory loc (cbOverrideGlobalOptions, "Override_Global_Options"); //NOI18N loc (lNumberOfSpacesPerIndent, "Indent"); //NOI18N loc (lTabSize, "TabSize"); //NOI18N + loc (cbEnableIndentation, "Enable_Indent"); //NOI18N loc (cbExpandTabsToSpaces, "Expand_Tabs"); //NOI18N loc (lRightMargin, "Right_Margin"); //NOI18N loc (lLineWrap, "Line_Wrap"); //NOI18N @@ -187,6 +188,7 @@ public IndentationPanel(MimePath mimePath, CustomizerSelector.PreferencesFactory //listeners cbOverrideGlobalOptions.addActionListener(this); + cbEnableIndentation.addActionListener(this); cbExpandTabsToSpaces.addActionListener(this); sNumberOfSpacesPerIndent.addChangeListener(this); sTabSize.addChangeListener(this); @@ -220,6 +222,8 @@ public PreviewProvider getPreviewProvider() { public @Override void actionPerformed (ActionEvent e) { if (cbOverrideGlobalOptions == e.getSource()) { prefs.putBoolean(FormattingPanelController.OVERRIDE_GLOBAL_FORMATTING_OPTIONS, !cbOverrideGlobalOptions.isSelected()); + } else if (cbEnableIndentation == e.getSource()) { + prefs.putBoolean(SimpleValueNames.ENABLE_INDENTATION, cbEnableIndentation.isSelected()); } else if (cbExpandTabsToSpaces == e.getSource()) { prefs.putBoolean(SimpleValueNames.EXPAND_TABS, cbExpandTabsToSpaces.isSelected()); } else if (cboLineWrap == e.getSource()) { @@ -254,6 +258,14 @@ private void prefsChange(PreferenceChangeEvent evt) { // + (allLangPrefs == null ? "" : ", allLangPrefs(" + key + ")=" + allLangPrefs.get(key, null))) // + "; override=" + prefs.getBoolean(FormattingPanelController.OVERRIDE_GLOBAL_FORMATTING_OPTIONS, areGlobalOptionsOverriden())); + if (key == null || SimpleValueNames.ENABLE_INDENTATION.equals(key)) { + boolean value = prefs.getBoolean(SimpleValueNames.ENABLE_INDENTATION, getDefBoolean(SimpleValueNames.ENABLE_INDENTATION, true)); + if (value != cbEnableIndentation.isSelected()) { + cbEnableIndentation.setSelected(value); + } + needsRefresh = true; + } + if (key == null || SimpleValueNames.EXPAND_TABS.equals(key)) { boolean value = prefs.getBoolean(SimpleValueNames.EXPAND_TABS, getDefBoolean(SimpleValueNames.EXPAND_TABS, true)); if (value != cbExpandTabsToSpaces.isSelected()) { @@ -312,6 +324,7 @@ private void prefsChange(PreferenceChangeEvent evt) { } if (!nue) { + prefs.putBoolean(SimpleValueNames.ENABLE_INDENTATION, allLangPrefs.getBoolean(SimpleValueNames.ENABLE_INDENTATION, true)); prefs.putBoolean(SimpleValueNames.EXPAND_TABS, allLangPrefs.getBoolean(SimpleValueNames.EXPAND_TABS, true)); prefs.putInt(SimpleValueNames.INDENT_SHIFT_WIDTH, allLangPrefs.getInt(SimpleValueNames.INDENT_SHIFT_WIDTH, 4)); prefs.putInt(SimpleValueNames.SPACES_PER_TAB, allLangPrefs.getInt(SimpleValueNames.SPACES_PER_TAB, 4)); @@ -321,6 +334,7 @@ private void prefsChange(PreferenceChangeEvent evt) { } needsRefresh = true; + ((ControlledCheckBox) cbEnableIndentation).setEnabledInternal(nue); ((ControlledCheckBox) cbExpandTabsToSpaces).setEnabledInternal(nue); ((ControlledLabel) lNumberOfSpacesPerIndent).setEnabledInternal(nue); ((ControlledSpinner) sNumberOfSpacesPerIndent).setEnabledInternal(nue); @@ -356,6 +370,10 @@ private void allLangPrefsChange(PreferenceChangeEvent evt) { return; } + if (key == null || SimpleValueNames.ENABLE_INDENTATION.equals(key)) { + prefs.putBoolean(SimpleValueNames.ENABLE_INDENTATION, allLangPrefs.getBoolean(SimpleValueNames.ENABLE_INDENTATION, true)); + } + if (key == null || SimpleValueNames.EXPAND_TABS.equals(key)) { prefs.putBoolean(SimpleValueNames.EXPAND_TABS, allLangPrefs.getBoolean(SimpleValueNames.EXPAND_TABS, true)); } @@ -391,6 +409,7 @@ private void initComponents() { cbOverrideGlobalOptions = new javax.swing.JCheckBox(); jPanel1 = new javax.swing.JPanel(); + cbEnableIndentation = new ControlledCheckBox(); cbExpandTabsToSpaces = new ControlledCheckBox(); lNumberOfSpacesPerIndent = new ControlledLabel(); sNumberOfSpacesPerIndent = new ControlledSpinner(); @@ -405,6 +424,8 @@ private void initComponents() { org.openide.awt.Mnemonics.setLocalizedText(cbOverrideGlobalOptions, org.openide.util.NbBundle.getMessage(IndentationPanel.class, "CTL_Override_Global_Options")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(cbEnableIndentation, org.openide.util.NbBundle.getMessage(IndentationPanel.class, "CTL_Enable_Indent")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(cbExpandTabsToSpaces, org.openide.util.NbBundle.getMessage(IndentationPanel.class, "CTL_Expand_Tabs")); // NOI18N lNumberOfSpacesPerIndent.setLabelFor(sNumberOfSpacesPerIndent); @@ -428,34 +449,39 @@ private void initComponents() { .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(lNumberOfSpacesPerIndent, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sNumberOfSpacesPerIndent, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(lTabSize, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sTabSize, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(lRightMargin, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(sRightMargin, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(lLineWrap, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cboLineWrap, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(cbEnableIndentation) + .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(lNumberOfSpacesPerIndent, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(sNumberOfSpacesPerIndent, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(lTabSize, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(sTabSize, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(lRightMargin, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(sRightMargin, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(lLineWrap, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cboLineWrap, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(8, 8, 8)) + .addComponent(cbExpandTabsToSpaces, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(20, 20, 20) - .addComponent(cbExpandTabsToSpaces, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(54, 54, 54)) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {sNumberOfSpacesPerIndent, sRightMargin, sTabSize}); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(cbEnableIndentation) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(cbExpandTabsToSpaces, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) @@ -506,7 +532,7 @@ private void initComponents() { .addGroup(layout.createSequentialGroup() .addComponent(cbOverrideGlobalOptions) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ); cbOverrideGlobalOptions.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(IndentationPanel.class, "AN_Override_Global_Options")); // NOI18N @@ -515,6 +541,7 @@ private void initComponents() { // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JCheckBox cbEnableIndentation; private javax.swing.JCheckBox cbExpandTabsToSpaces; private javax.swing.JCheckBox cbOverrideGlobalOptions; private javax.swing.JComboBox cboLineWrap; diff --git a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveClassTransformer.java b/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveClassTransformer.java index 26c7a7469..b815f23dc 100644 --- a/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveClassTransformer.java +++ b/refactoring.java/src/org/netbeans/modules/refactoring/java/plugins/MoveClassTransformer.java @@ -145,6 +145,8 @@ public Tree visitCompilationUnit(CompilationUnitTree node, Element p) { if (!importToRemove.isEmpty()) { cut = make.CompilationUnit(cut.getPackageName(), imports, cut.getTypeDecls(), cut.getSourceFile()); } + + cut = GeneratorUtilities.get(workingCopy).importFQNs(cut); rewrite(node, cut); @@ -244,7 +246,6 @@ public Object visitIdentifier(IdentifierTree node, Element p) { get.copyComments(origTree, newClass, true); get.copyComments(origTree, newClass, false); newClass = get.insertClassMember(node, newClass); - newClass = get.importFQNs(newClass); original2Translated.put(node, newClass); } } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services