+
+
+
diff --git a/editor.indent.project/build.xml b/editor.indent.project/build.xml
new file mode 100644
--- /dev/null
+++ b/editor.indent.project/build.xml
@@ -0,0 +1,5 @@
+
+
+ Builds, tests, and runs the project org.netbeans.modules.editor.indent.project
+
+
diff --git a/editor.indent.project/manifest.mf b/editor.indent.project/manifest.mf
new file mode 100644
--- /dev/null
+++ b/editor.indent.project/manifest.mf
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+OpenIDE-Module: org.netbeans.modules.editor.indent.project/0
+OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/indent/project/Bundle.properties
+OpenIDE-Module-Provides: org.netbeans.modules.editor.indent.spi.CodeStylePreferences.Provider
+OpenIDE-Module-Specification-Version: 1.0
+
diff --git a/editor.indent.project/nbproject/project.properties b/editor.indent.project/nbproject/project.properties
new file mode 100644
--- /dev/null
+++ b/editor.indent.project/nbproject/project.properties
@@ -0,0 +1,46 @@
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
+#
+# The contents of this file are subject to the terms of either the GNU
+# General Public License Version 2 only ("GPL") or the Common
+# Development and Distribution License("CDDL") (collectively, the
+# "License"). You may not use this file except in compliance with the
+# License. You can obtain a copy of the License at
+# http://www.netbeans.org/cddl-gplv2.html
+# or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+# specific language governing permissions and limitations under the
+# License. When distributing the software, include this License Header
+# Notice in each file and include the License file at
+# nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Sun in the GPL Version 2 section of the License file that
+# accompanied this code. If applicable, add the following below the
+# License Header, with the fields enclosed by brackets [] replaced by
+# your own identifying information:
+# "Portions Copyrighted [year] [name of copyright owner]"
+#
+# Contributor(s):
+#
+# The Original Software is NetBeans. The Initial Developer of the Original
+# Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+# Microsystems, Inc. All Rights Reserved.
+#
+# If you wish your version of this file to be governed by only the CDDL
+# or only the GPL Version 2, indicate your decision by adding
+# "[Contributor] elects to include this software in this distribution
+# under the [CDDL or GPL Version 2] license." If you do not indicate a
+# single choice of license, a recipient has the option to distribute
+# your version of this file under either the CDDL, the GPL Version 2 or
+# to extend the choice of license to its licensees as provided above.
+# However, if you add GPL Version 2 code and therefore, elected the GPL
+# Version 2 license, then the option applies only if the new code is
+# made subject to such option by the copyright holder.
+
+is.eager=true
+javac.source=1.6
+javac.compilerargs=-Xlint -Xlint:-serial
+
+javadoc.arch=${basedir}/arch.xml
+javadoc.apichanges=${basedir}/apichanges.xml
+javadoc.title=Editor Indentation for Projects
diff --git a/editor.indent.project/nbproject/project.xml b/editor.indent.project/nbproject/project.xml
new file mode 100644
--- /dev/null
+++ b/editor.indent.project/nbproject/project.xml
@@ -0,0 +1,165 @@
+
+
+ org.netbeans.modules.apisupport.project
+
+
+ org.netbeans.modules.editor.indent.project
+
+
+ org.jdesktop.layout
+
+
+
+ 1
+ 1.12
+
+
+
+ org.netbeans.modules.editor.indent
+
+
+
+ 2
+ 1.17
+
+
+
+ org.netbeans.modules.editor.mimelookup
+
+
+
+ 1
+ 1.15
+
+
+
+ org.netbeans.modules.editor.settings
+
+
+
+ 1
+ 1.28
+
+
+
+ org.netbeans.modules.editor.settings.storage
+
+
+
+ 1
+ 1.24
+
+
+
+ org.netbeans.modules.options.api
+
+
+
+ 1
+ 1.17
+
+
+
+ org.netbeans.modules.options.editor
+
+
+
+ 1
+ 1.19
+
+
+
+ org.netbeans.modules.projectapi
+
+
+
+ 1
+ 1.29
+
+
+
+ org.netbeans.modules.projectuiapi
+
+
+
+ 1
+ 1.41
+
+
+
+ org.openide.awt
+
+
+
+ 7.21
+
+
+
+ org.openide.dialogs
+
+
+
+ 7.14
+
+
+
+ org.openide.filesystems
+
+
+
+ 7.35
+
+
+
+ org.openide.loaders
+
+
+
+ 7.12
+
+
+
+ org.openide.nodes
+
+
+
+ 7.14
+
+
+
+ org.openide.util
+
+
+
+ 8.1
+
+
+
+ org.openide.util.lookup
+
+
+
+ 8.1
+
+
+
+
+
+ unit
+
+ org.netbeans.libs.junit4
+
+
+
+ org.netbeans.modules.nbjunit
+
+
+
+
+
+
+ org.netbeans.modules.editor.indent.project.api
+
+
+
+
diff --git a/editor.indent.project/src/org/netbeans/modules/editor/indent/project/Bundle.properties b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/Bundle.properties
new file mode 100644
--- /dev/null
+++ b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/Bundle.properties
@@ -0,0 +1,28 @@
+OpenIDE-Module-Name=Editor Indentation for Projects
+
+#FormattingCustomizerPanel
+LBL_CategoryFormatting=Formatting
+LBL_FormattingCustomizer_Global=Use &global options
+LBL_FormattingCustomizer_Project=Use &project specific options
+LBL_FormattingCustomizer_EditGlobal=&Edit global options
+LBL_ForamttingCustomizer_Load=Load from &other project
+
+# Messages in FormattingCustomizerPanel
+MSG_CodeStyle_Import_Forbidden_From_The_Same_Project=Loading formatting settings from the same project is not allowed.
+MSG_No_CodeStyle_Info_To_Import=The project you chose contains no formatting settings.
+MSG_CodeStyle_Import_Successful=The formatting settings were successfully imported.
+MSG_CodeStyle_Import_Failed=Importing the formatting settings failed.
+
+#FormattingCustomizerPanel
+MSG_use_global_settings_confirmation=This will remove all formatting settings and their customizations from this project. Do you want to proceed?
+MSG_use_global_settings_confirmation_title=Use global formatting settings
+FormattingPanel.languageCombo.AccessibleContext.accessibleDescription=Language list.
+FormattingPanel.languageCombo.AccessibleContext.accessibleName=Language
+FormattingPanel.categoryCombo.AccessibleContext.accessibleDescription=Category list.
+FormattingPanel.categoryCombo.AccessibleContext.accessibleName=Category
+FormattingCustomizerPanel.editGlobalButton.AccessibleContext.accessibleDescription=Edit global options
+FormattingCustomizerPanel.loadButton.AccessibleContext.accessibleDescription=Load from other project
+FormattingCustomizerPanel.globalButton.AccessibleContext.accessibleDescription=Use global options
+FormattingCustomizerPanel.projectButton.AccessibleContext.accessibleDescription=Use project specific options
+AD_Language=Language
+AD_Category=Category
diff --git a/options.editor/src/org/netbeans/modules/options/indentation/FormattingCustomizerPanel.form b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/FormattingCustomizerPanel.form
rename from options.editor/src/org/netbeans/modules/options/indentation/FormattingCustomizerPanel.form
rename to editor.indent.project/src/org/netbeans/modules/editor/indent/project/FormattingCustomizerPanel.form
--- a/options.editor/src/org/netbeans/modules/options/indentation/FormattingCustomizerPanel.form
+++ b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/FormattingCustomizerPanel.form
@@ -5,9 +5,6 @@
-
-
-
diff --git a/options.editor/src/org/netbeans/modules/options/indentation/FormattingCustomizerPanel.java b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/FormattingCustomizerPanel.java
rename from options.editor/src/org/netbeans/modules/options/indentation/FormattingCustomizerPanel.java
rename to editor.indent.project/src/org/netbeans/modules/editor/indent/project/FormattingCustomizerPanel.java
--- a/options.editor/src/org/netbeans/modules/options/indentation/FormattingCustomizerPanel.java
+++ b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/FormattingCustomizerPanel.java
@@ -39,7 +39,7 @@
* made subject to such option by the copyright holder.
*/
-package org.netbeans.modules.options.indentation;
+package org.netbeans.modules.editor.indent.project;
import java.awt.BorderLayout;
import java.awt.Component;
@@ -65,10 +65,15 @@
import org.netbeans.api.project.ProjectManager;
import org.netbeans.api.project.ProjectUtils;
import org.netbeans.modules.editor.indent.api.IndentUtils;
+import org.netbeans.modules.editor.indent.project.api.Customizers;
import org.netbeans.modules.editor.settings.storage.api.EditorSettings;
import org.netbeans.modules.editor.settings.storage.api.EditorSettingsStorage;
import org.netbeans.modules.editor.settings.storage.spi.TypedValue;
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer;
+import org.netbeans.modules.options.indentation.CustomizerSelector;
+import org.netbeans.modules.options.indentation.FormattingPanel;
+import org.netbeans.modules.options.indentation.FormattingPanelController;
+import org.netbeans.modules.options.indentation.ProxyPreferences;
import org.netbeans.spi.project.ui.support.ProjectChooser;
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
import org.openide.DialogDisplayer;
@@ -104,10 +109,12 @@
* @param attrs The map of FileObject attributes
*
* @return A new 'Formatting' category provider.
- * @since 1.10
+ * @since 1.0
+ * @deprecated Use {@link Customizers#createFormattingCategoryProvider(java.util.Map) } instead.
*/
+ @Deprecated
public static ProjectCustomizer.CompositeCategoryProvider createCategoryProvider(Map attrs) {
- return new Factory((String)attrs.get("allowedMimeTypes")); //NOI18N
+ return Customizers.createFormattingCategoryProvider(attrs);
}
public static class Factory implements ProjectCustomizer.CompositeCategoryProvider {
@@ -241,7 +248,7 @@
.add(loadButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.add(layout.createSequentialGroup()
.add(12, 12, 12)
- .add(customizerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 490, Short.MAX_VALUE))
+ .add(customizerPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 534, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
diff --git a/editor.indent.project/src/org/netbeans/modules/editor/indent/project/ProjectAwareCodeStylePreferences.java b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/ProjectAwareCodeStylePreferences.java
new file mode 100644
--- /dev/null
+++ b/editor.indent.project/src/org/netbeans/modules/editor/indent/project/ProjectAwareCodeStylePreferences.java
@@ -0,0 +1,252 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2010 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.editor.indent.project;
+
+import java.lang.ref.Reference;
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.logging.Logger;
+import java.util.prefs.AbstractPreferences;
+import java.util.prefs.PreferenceChangeEvent;
+import java.util.prefs.PreferenceChangeListener;
+import java.util.prefs.Preferences;
+import javax.swing.text.Document;
+import org.netbeans.api.editor.mimelookup.MimeLookup;
+import org.netbeans.api.editor.mimelookup.MimePath;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.api.project.ProjectUtils;
+import org.netbeans.modules.editor.indent.api.IndentUtils;
+import org.netbeans.modules.editor.indent.spi.CodeStylePreferences;
+import org.openide.filesystems.FileObject;
+import org.openide.loaders.DataObject;
+import org.openide.util.Utilities;
+import org.openide.util.WeakListeners;
+import org.openide.util.lookup.ServiceProvider;
+
+/**
+ *
+ * @author vita
+ */
+@ServiceProvider(service=CodeStylePreferences.Provider.class)
+public final class ProjectAwareCodeStylePreferences implements CodeStylePreferences.Provider {
+
+ @Override
+ public Preferences forFile(FileObject file, String mimeType) {
+ return singleton.forFile(file, mimeType);
+ }
+
+ @Override
+ public Preferences forDocument(Document doc, String mimeType) {
+ return singleton.forDocument(doc, mimeType);
+ }
+
+ // ----------------------------------------------------------------------
+ // private implementation
+ // ----------------------------------------------------------------------
+
+ private static final Logger LOG = Logger.getLogger(ProjectAwareCodeStylePreferences.class.getName());
+ private static final CodeStylePreferences.Provider singleton = new CodeStylePreferences.Provider() {
+
+ @Override
+ public Preferences forFile(FileObject file, String mimeType) {
+ return getCsp(file, mimeType).getPreferences();
+ }
+
+ @Override
+ public Preferences forDocument(Document doc, String mimeType) {
+ return getCsp(doc, mimeType).getPreferences();
+ }
+
+ // --------------------------------------------------------------------
+ // private implementation
+ // --------------------------------------------------------------------
+
+ private final Map