mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
JavaScript external documentation support [r=K.Safonov]
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.projectRoots.ui;
|
||||
|
||||
import com.intellij.openapi.roots.libraries.doc.DocUrlChooser;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Note: for languages other than Java use com.intellij.openapi.roots.libraries.doc.DocUrlChooser.
|
||||
* @author MYakovlev
|
||||
* Date: Oct 29, 2002
|
||||
* Time: 8:47:43 PM
|
||||
*/
|
||||
public class Util{
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile showSpecifyJavadocUrlDialog(JComponent parent) {
|
||||
return showSpecifyJavadocUrlDialog(parent, "");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile showSpecifyJavadocUrlDialog(JComponent parent, String initialValue){
|
||||
return DocUrlChooser.showSpecifyDocUrlDialog(parent, initialValue);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+23
-27
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -13,55 +13,51 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.libraries.doc;
|
||||
package com.intellij.openapi.projectRoots.ui;
|
||||
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.ui.InputValidator;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @author Rustam Vishnyakov
|
||||
* @author MYakovlev
|
||||
* Date: Oct 29, 2002
|
||||
* Time: 8:47:43 PM
|
||||
*/
|
||||
public class DocUrlChooser {
|
||||
public class Util{
|
||||
|
||||
private DocUrlChooser() {
|
||||
public static VirtualFile showSpecifyJavadocUrlDialog(JComponent parent) {
|
||||
return showSpecifyJavadocUrlDialog(parent, "");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile showSpecifyDocUrlDialog(JComponent parent) {
|
||||
return showSpecifyDocUrlDialog(parent, "");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static VirtualFile showSpecifyDocUrlDialog(JComponent parent, String initialValue) {
|
||||
public static VirtualFile showSpecifyJavadocUrlDialog(JComponent parent, String initialValue){
|
||||
final String url = Messages.showInputDialog(parent, ProjectBundle.message("sdk.configure.javadoc.url.prompt"),
|
||||
ProjectBundle.message("sdk.configure.javadoc.url.title"), Messages.getQuestionIcon(),
|
||||
initialValue, new InputValidator() {
|
||||
public boolean checkInput(String inputString) {
|
||||
ProjectBundle.message("sdk.configure.javadoc.url.title"), Messages.getQuestionIcon(), initialValue, new InputValidator() {
|
||||
public boolean checkInput(String inputString) {
|
||||
return true;
|
||||
}
|
||||
public boolean canClose(String inputString) {
|
||||
try {
|
||||
new URL(inputString);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canClose(String inputString) {
|
||||
try {
|
||||
new URL(inputString);
|
||||
return true;
|
||||
}
|
||||
catch (MalformedURLException e1) {
|
||||
Messages.showErrorDialog(e1.getMessage(), ProjectBundle.message("sdk.configure.javadoc.url.title"));
|
||||
}
|
||||
return false;
|
||||
catch (MalformedURLException e1) {
|
||||
Messages.showErrorDialog(e1.getMessage(), ProjectBundle.message("sdk.configure.javadoc.url.title"));
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
return VirtualFileManager.getInstance().findFileByUrl(url);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.libraries.doc;
|
||||
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.PersistentOrderRootType;
|
||||
|
||||
public class DocOrderRootType extends PersistentOrderRootType {
|
||||
|
||||
private DocOrderRootType() {
|
||||
super("DOCUMENTATION", "docPath", "doc-paths", "docPathEntry");
|
||||
}
|
||||
|
||||
public static OrderRootType getInstance() {
|
||||
return getOrderRootType(DocOrderRootType.class);
|
||||
}
|
||||
|
||||
public boolean collectFromDependentModules() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.openapi.roots.libraries.doc;
|
||||
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.projectRoots.ui.PathEditor;
|
||||
import com.intellij.openapi.roots.ui.OrderRootTypeUIFactory;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author Rustam Vishnyakov
|
||||
*/
|
||||
public class DocOrderRootTypeUIFactory implements OrderRootTypeUIFactory {
|
||||
private static final Icon ICON = IconLoader.getIcon("/nodes/javaDocFolder.png");
|
||||
|
||||
@Nullable
|
||||
public PathEditor createPathEditor(Sdk sdk) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeText() {
|
||||
return ProjectBundle.message("library.docs.node");
|
||||
}
|
||||
|
||||
}
|
||||
+4
-8
@@ -18,6 +18,7 @@ package com.intellij.openapi.roots.libraries.scripting;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.roots.JavadocOrderRootType;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableBase;
|
||||
@@ -25,7 +26,6 @@ import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar;
|
||||
import com.intellij.openapi.roots.libraries.LibraryType;
|
||||
//import com.intellij.openapi.roots.libraries.doc.DocOrderRootType;
|
||||
import com.intellij.openapi.util.EmptyRunnable;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -81,7 +81,7 @@ public class ScriptingLibraryManager {
|
||||
}
|
||||
|
||||
private void updateLibraries(LibraryTable.ModifiableModel libTableModel) {
|
||||
//final OrderRootType docRootType = DocOrderRootType.getInstance();
|
||||
final OrderRootType docRootType = JavadocOrderRootType.getInstance();
|
||||
for (Library library : libTableModel.getLibraries()) {
|
||||
ScriptingLibraryTable.LibraryModel scriptingLibModel = myLibTable.getLibraryByName(library.getName());
|
||||
if (scriptingLibModel == null) {
|
||||
@@ -91,11 +91,9 @@ public class ScriptingLibraryManager {
|
||||
Library.ModifiableModel libModel = library.getModifiableModel();
|
||||
removeRoots(libModel, OrderRootType.CLASSES);
|
||||
removeRoots(libModel, OrderRootType.SOURCES);
|
||||
/*
|
||||
for (String docUrl : libModel.getUrls(DocOrderRootType.getInstance())) {
|
||||
for (String docUrl : libModel.getUrls(JavadocOrderRootType.getInstance())) {
|
||||
libModel.removeRoot(docUrl, docRootType);
|
||||
}
|
||||
*/
|
||||
addAllRoots(libModel, scriptingLibModel);
|
||||
libModel.commit();
|
||||
}
|
||||
@@ -118,14 +116,12 @@ public class ScriptingLibraryManager {
|
||||
}
|
||||
|
||||
private static void addAllRoots(Library.ModifiableModel libModel, ScriptingLibraryTable.LibraryModel srcModel) {
|
||||
//final OrderRootType docRootType = DocOrderRootType.getInstance();
|
||||
final OrderRootType docRootType = JavadocOrderRootType.getInstance();
|
||||
addRoots(libModel, srcModel, OrderRootType.CLASSES);
|
||||
addRoots(libModel, srcModel, OrderRootType.SOURCES);
|
||||
/*
|
||||
for (String docUrl : srcModel.getDocUrls()) {
|
||||
libModel.addRoot(docUrl, docRootType);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private static void addRoots(Library.ModifiableModel libModel,
|
||||
|
||||
+2
-2
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package com.intellij.openapi.roots.libraries.scripting;
|
||||
|
||||
import com.intellij.openapi.roots.JavadocOrderRootType;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.libraries.LibraryType;
|
||||
import com.intellij.openapi.roots.libraries.doc.DocOrderRootType;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
@@ -52,7 +52,7 @@ public class ScriptingLibraryTable {
|
||||
LibraryModel libModel = new LibraryModel(library.getName());
|
||||
libModel.setSourceFiles(library.getFiles(SOURCE_ROOT_TYPE));
|
||||
libModel.setCompactFiles(library.getFiles(COMPACT_ROOT_TYPE));
|
||||
//libModel.setDocUrls(library.getUrls(DocOrderRootType.getInstance())); // TODO: Rustam, write tests first!
|
||||
libModel.setDocUrls(library.getUrls(JavadocOrderRootType.getInstance()));
|
||||
myLibraryModels.add(libModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -853,10 +853,6 @@
|
||||
implementationClass="com.intellij.openapi.roots.ui.configuration.libraryEditor.ClassesOrderRootTypeUIFactory"/>
|
||||
<OrderRootTypeUI key="SOURCES"
|
||||
implementationClass="com.intellij.openapi.roots.ui.configuration.libraryEditor.SourcesOrderRootTypeUIFactory"/>
|
||||
<!--
|
||||
<OrderRootTypeUI key="DOCUMENTATION"
|
||||
implementationClass="com.intellij.openapi.roots.libraries.doc.DocOrderRootTypeUIFactory"/>
|
||||
-->
|
||||
|
||||
<getDataRule key="analysisScope" implementationClass="com.intellij.analysis.AnalysisScopeRule"/>
|
||||
<getDataRule key="context.ProjectFileDirectory" implementationClass="com.intellij.ide.impl.dataRules.ProjectFileDirectoryRule"/>
|
||||
@@ -939,8 +935,6 @@
|
||||
|
||||
<orderRootType implementation="com.intellij.openapi.roots.AnnotationOrderRootType"/>
|
||||
<orderRootType implementation="com.intellij.openapi.roots.JavadocOrderRootType"/>
|
||||
|
||||
<!-- <orderRootType implementation="com.intellij.openapi.roots.libraries.doc.DocOrderRootType"/> -->
|
||||
|
||||
<highlightUsagesHandlerFactory implementation="com.intellij.codeInsight.highlighting.HighlightExceptionsHandlerFactory"/>
|
||||
<highlightUsagesHandlerFactory implementation="com.intellij.codeInsight.highlighting.HighlightSuppressedWarningsFactory"/>
|
||||
|
||||
Reference in New Issue
Block a user