/** * Gets <code>CodeStyle</code> for files in the given project. * * <p>Please see the other two <code>getDefault</code> methods as they are * the preferred way of getting <code>CodeStyle</code>. * * @param project The project to get the <code>CodeStyle</code> for. * @return The current code style that would be used by documents opened * from files belonging to the <code>project</code>. * * @deprecated Please use {@link #getDefault(javax.swing.text.Document)} * or {@link #getDefault(org.openide.filesystems.FileObject)} respectively. */ public static CodeStyle getDefault(Project project) { return getDefault(project.getProjectDirectory()); }
public static final CodeStyle getCodeStyle(CompilationInfo info) { if (info != null) { try { Document doc = info.getDocument(); if (doc != null) { CodeStyle cs = (CodeStyle)doc.getProperty(CodeStyle.class); return cs != null ? cs : CodeStyle.getDefault(doc); } } catch (IOException ioe) { // ignore } FileObject file = info.getFileObject(); if (file != null) { return CodeStyle.getDefault(file); } } return CodeStyle.getDefault((Document)null); }
@Override public void reformat() throws BadLocationException { CodeStyle cs = (CodeStyle) doc.getProperty(CodeStyle.class); if (cs == null) { cs = CodeStyle.getDefault(doc); } List<Context.Region> indentRegions = context.indentRegions(); Collections.reverse(indentRegions); for (Context.Region region : indentRegions) { if (initRegionData(region)) { reformatImpl(region, cs); } } }
currentEmbeddingLength = -1; newIndents = new HashMap<Integer, Integer>(); cs = CodeStyle.getDefault(context.document()); for (Region region : context.indentRegions()) { if (initRegionData(region)) {
CodeStyle codeStyle = CodeStyle.getDefault(controller.getDocument()); for (VariableElement variableElement : ElementFilter.fieldsIn(controller.getElements().getAllMembers(te))) { Name name = variableElement.getSimpleName();
for (String name : Utilities.varNamesSuggestions(tm, varKind, varMods, null, prefix, controller.getTypes(), controller.getElements(), controller.getElementUtilities().getLocalMembersAndVars(scope, acceptor), CodeStyle.getDefault(controller.getDocument()))) { results.add(itemFactory.createVariableItem(env.getController(), name, anchorOffset, true, false)); controller.getElementUtilities().getLocalMembersAndVars(scope, acceptor), CodeStyle.getDefault(controller.getDocument()))) { results.add(itemFactory.createVariableItem(env.getController(), name, anchorOffset, true, false)); controller.getElements(), controller.getElementUtilities().getLocalMembersAndVars(scope, acceptor), CodeStyle.getDefault(controller.getDocument()))) { results.add(itemFactory.createVariableItem(env.getController(), name, anchorOffset, true, false)); for (String name : Utilities.varNamesSuggestions(tm, varKind, varMods, null, prefix, controller.getTypes(), controller.getElements(), controller.getElementUtilities().getLocalMembersAndVars(scope, acceptor), CodeStyle.getDefault(controller.getDocument()))) { results.add(itemFactory.createVariableItem(env.getController(), name, anchorOffset, true, false));