mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CRLF Dmitry Trofimov MUST DIE %E~
This commit is contained in:
@@ -1,369 +1,369 @@
|
||||
/*
|
||||
* 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.execution.applet;
|
||||
|
||||
import com.intellij.execution.*;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.junit.RefactoringListeners;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigurationModule> implements SingleClassConfiguration, RefactoringListenerProvider {
|
||||
|
||||
public String MAIN_CLASS_NAME;
|
||||
public String HTML_FILE_NAME;
|
||||
public boolean HTML_USED;
|
||||
public int WIDTH;
|
||||
public int HEIGHT;
|
||||
public String POLICY_FILE;
|
||||
public String VM_PARAMETERS;
|
||||
private AppletParameter[] myAppletParameters;
|
||||
public boolean ALTERNATIVE_JRE_PATH_ENABLED;
|
||||
public String ALTERNATIVE_JRE_PATH;
|
||||
@NonNls
|
||||
protected static final String NAME_ATTR = "name";
|
||||
@NonNls
|
||||
protected static final String VALUE_ATTR = "value";
|
||||
@NonNls
|
||||
protected static final String PARAMETER_ELEMENT_NAME = "parameter";
|
||||
|
||||
public AppletConfiguration(final String name, final Project project, ConfigurationFactory factory) {
|
||||
super(name, new JavaRunConfigurationModule(project, false), factory);
|
||||
}
|
||||
|
||||
public void setMainClass(final PsiClass psiClass) {
|
||||
final Module originalModule = getConfigurationModule().getModule();
|
||||
setMainClassName(JavaExecutionUtil.getRuntimeQualifiedName(psiClass));
|
||||
setModule(JavaExecutionUtil.findModule(psiClass));
|
||||
restoreOriginalModule(originalModule);
|
||||
}
|
||||
|
||||
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
|
||||
final JavaCommandLineState state = new JavaCommandLineState(env) {
|
||||
private AppletHtmlFile myHtmlURL = null;
|
||||
|
||||
protected JavaParameters createJavaParameters() throws ExecutionException {
|
||||
final JavaParameters params = new JavaParameters();
|
||||
myHtmlURL = getHtmlURL();
|
||||
if (myHtmlURL != null) {
|
||||
final int classPathType = myHtmlURL.isHttp() ? JavaParameters.JDK_ONLY : JavaParameters.JDK_AND_CLASSES;
|
||||
final RunConfigurationModule runConfigurationModule = getConfigurationModule();
|
||||
JavaParametersUtil.configureModule(runConfigurationModule, params, classPathType, ALTERNATIVE_JRE_PATH_ENABLED ? ALTERNATIVE_JRE_PATH : null);
|
||||
final String policyFileParameter = getPolicyFileParameter();
|
||||
if (policyFileParameter != null) {
|
||||
params.getVMParametersList().add(policyFileParameter);
|
||||
}
|
||||
params.getVMParametersList().addParametersString(VM_PARAMETERS);
|
||||
params.setMainClass("sun.applet.AppletViewer");
|
||||
params.getProgramParametersList().add(myHtmlURL.getUrl());
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
protected OSProcessHandler startProcess() throws ExecutionException {
|
||||
final OSProcessHandler handler = super.startProcess();
|
||||
final AppletHtmlFile htmlUrl = myHtmlURL;
|
||||
if (htmlUrl != null) {
|
||||
handler.addProcessListener(new ProcessAdapter() {
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
htmlUrl.deleteFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
};
|
||||
state.setConsoleBuilder(TextConsoleBuilderFactory.getInstance().createBuilder(getProject()));
|
||||
return state;
|
||||
}
|
||||
|
||||
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
|
||||
return new AppletConfigurable(getProject());
|
||||
}
|
||||
|
||||
@NonNls private String getPolicyFileParameter() {
|
||||
if (POLICY_FILE != null && POLICY_FILE.length() > 0) {
|
||||
return "-Djava.security.policy=" + getPolicyFile();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPolicyFile(final String localPath) {
|
||||
POLICY_FILE = ExternalizablePath.urlValue(localPath);
|
||||
}
|
||||
|
||||
public String getPolicyFile() {
|
||||
return ExternalizablePath.localPathValue(POLICY_FILE);
|
||||
}
|
||||
|
||||
public static class AppletParameter {
|
||||
public String myName;
|
||||
public String myValue;
|
||||
|
||||
public AppletParameter(@NonNls final String name, final String value) {
|
||||
myName = name;
|
||||
myValue = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
public void setValue(final String value) {
|
||||
myValue = value;
|
||||
}
|
||||
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof AppletParameter)) return false;
|
||||
final AppletParameter second = (AppletParameter)obj;
|
||||
return Comparing.equal(myName, second.myName) && Comparing.equal(myValue, second.myValue);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Comparing.hashcode(myName, myValue);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<Module> getValidModules() {
|
||||
return JavaRunConfigurationModule.getModulesForClass(getProject(), MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void readExternal(final Element parentNode) throws InvalidDataException {
|
||||
DefaultJDOMExternalizer.readExternal(this, parentNode);
|
||||
readModule(parentNode);
|
||||
final ArrayList<AppletParameter> parameters = new ArrayList<AppletParameter>();
|
||||
for (
|
||||
Iterator iterator = parentNode.getChildren(PARAMETER_ELEMENT_NAME).iterator(); iterator.hasNext();) {
|
||||
final Element element = (Element)iterator.next();
|
||||
final String name = element.getAttributeValue(NAME_ATTR);
|
||||
final String value = element.getAttributeValue(VALUE_ATTR);
|
||||
parameters.add(new AppletParameter(name, value));
|
||||
}
|
||||
myAppletParameters = parameters.toArray(new AppletParameter[parameters.size()]);
|
||||
}
|
||||
|
||||
public void writeExternal(final Element parentNode) throws WriteExternalException {
|
||||
writeModule(parentNode);
|
||||
DefaultJDOMExternalizer.writeExternal(this, parentNode);
|
||||
if (myAppletParameters != null) {
|
||||
for (int i = 0; i < myAppletParameters.length; i++) {
|
||||
final Element element = new Element(PARAMETER_ELEMENT_NAME);
|
||||
parentNode.addContent(element);
|
||||
element.setAttribute(NAME_ATTR, myAppletParameters[i].getName());
|
||||
element.setAttribute(VALUE_ATTR, myAppletParameters[i].getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ModuleBasedConfiguration createInstance() {
|
||||
return new AppletConfiguration(getName(), getProject(), AppletConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
}
|
||||
|
||||
public String getGeneratedName() {
|
||||
if (MAIN_CLASS_NAME == null) return null;
|
||||
return JavaExecutionUtil.getPresentableClassName(MAIN_CLASS_NAME, getConfigurationModule());
|
||||
}
|
||||
|
||||
public RefactoringElementListener getRefactoringElementListener(final PsiElement element) {
|
||||
if (HTML_USED) return null;
|
||||
return RefactoringListeners.getClassOrPackageListener(element, new RefactoringListeners.SingleClassConfigurationAccessor(this));
|
||||
}
|
||||
|
||||
public PsiClass getMainClass() {
|
||||
return getConfigurationModule().findClass(MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void setGeneratedName() {
|
||||
setName(getGeneratedName());
|
||||
}
|
||||
|
||||
public boolean isGeneratedName() {
|
||||
return Comparing.equal(getName(), getGeneratedName());
|
||||
}
|
||||
|
||||
public String suggestedName() {
|
||||
return ProgramRunnerUtil.shortenName(JavaExecutionUtil.getShortClassName(MAIN_CLASS_NAME), 0);
|
||||
}
|
||||
|
||||
public void setMainClassName(final String qualifiedName) {
|
||||
final boolean generatedName = isGeneratedName();
|
||||
MAIN_CLASS_NAME = qualifiedName;
|
||||
if (generatedName) setGeneratedName();
|
||||
}
|
||||
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {
|
||||
if (ALTERNATIVE_JRE_PATH_ENABLED){
|
||||
if (ALTERNATIVE_JRE_PATH == null ||
|
||||
ALTERNATIVE_JRE_PATH.length() == 0 ||
|
||||
!JavaSdkImpl.checkForJre(ALTERNATIVE_JRE_PATH)){
|
||||
throw new RuntimeConfigurationWarning(ExecutionBundle.message("jre.not.valid.error.message", ALTERNATIVE_JRE_PATH));
|
||||
}
|
||||
}
|
||||
getConfigurationModule().checkForWarning();
|
||||
if (HTML_USED) {
|
||||
if (HTML_FILE_NAME == null || HTML_FILE_NAME.length() == 0) {
|
||||
throw new RuntimeConfigurationWarning(ExecutionBundle.message("html.file.not.specified.error.message"));
|
||||
}
|
||||
try {
|
||||
new URL(HTML_FILE_NAME);
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
throw new RuntimeConfigurationWarning("URL " + HTML_FILE_NAME + " is not valid: " + ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
else {
|
||||
getConfigurationModule().checkClassName(MAIN_CLASS_NAME, ExecutionBundle.message("no.applet.class.specified.error.message"));
|
||||
}
|
||||
}
|
||||
|
||||
public AppletParameter[] getAppletParameters() {
|
||||
return myAppletParameters;
|
||||
}
|
||||
|
||||
public void setAppletParameters(final AppletParameter[] appletParameters) {
|
||||
myAppletParameters = appletParameters;
|
||||
}
|
||||
|
||||
public void setAppletParameters(final List<AppletParameter> parameters) {
|
||||
setAppletParameters(parameters.toArray(new AppletParameter[parameters.size()]));
|
||||
}
|
||||
|
||||
private AppletHtmlFile getHtmlURL() throws CantRunException {
|
||||
if (HTML_USED) {
|
||||
if (HTML_FILE_NAME == null || HTML_FILE_NAME.length() == 0) {
|
||||
throw new CantRunException(ExecutionBundle.message("html.file.not.specified.error.message"));
|
||||
}
|
||||
return new AppletHtmlFile(HTML_FILE_NAME, null);
|
||||
}
|
||||
else {
|
||||
if (MAIN_CLASS_NAME == null || MAIN_CLASS_NAME.length() == 0) {
|
||||
throw new CantRunException(ExecutionBundle.message("class.not.specified.error.message"));
|
||||
}
|
||||
|
||||
// generate html
|
||||
try {
|
||||
return generateAppletTempPage();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new CantRunException(ExecutionBundle.message("failed.to.generate.wrapper.error.message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AppletHtmlFile generateAppletTempPage() throws IOException {
|
||||
final File tempFile = FileUtil.createTempFile("AppletPage", ".html");
|
||||
@NonNls final FileWriter writer = new FileWriter(tempFile);
|
||||
try {
|
||||
writer.write("<html>\n" +
|
||||
"<head>\n" +
|
||||
"<title>" + MAIN_CLASS_NAME + "</title>\n" +
|
||||
"</head>\n" +
|
||||
"<applet codebase=\".\"\n" +
|
||||
"code=\"" + MAIN_CLASS_NAME + "\"\n" +
|
||||
"name=\"" + MAIN_CLASS_NAME + "\"\n" +
|
||||
"width=" + WIDTH + "\n" +
|
||||
"height=" + HEIGHT + "\n" +
|
||||
"align=top>\n");
|
||||
final AppletParameter[] appletParameters = getAppletParameters();
|
||||
if (appletParameters != null) {
|
||||
for (final AppletParameter parameter : appletParameters) {
|
||||
writer.write("<param name=\"" + parameter.getName() + "\" value=\"" + parameter.getValue() + "\">\n");
|
||||
}
|
||||
}
|
||||
writer.write("</applet>\n</body>\n</html>\n");
|
||||
}
|
||||
finally {
|
||||
writer.close();
|
||||
}
|
||||
final String htmlFile = tempFile.getAbsolutePath();
|
||||
return new AppletHtmlFile(htmlFile, tempFile);
|
||||
}
|
||||
|
||||
private static class AppletHtmlFile {
|
||||
private final String myHtmlFile;
|
||||
private final File myFileToDelete;
|
||||
@NonNls
|
||||
protected static final String FILE_PREFIX = "file:/";
|
||||
@NonNls
|
||||
protected static final String HTTP_PREFIX = "http:/";
|
||||
@NonNls
|
||||
protected static final String HTTPS_PREFIX = "https:/";
|
||||
|
||||
protected AppletHtmlFile(final String htmlFile, final File fileToDelete) {
|
||||
myHtmlFile = htmlFile;
|
||||
myFileToDelete = fileToDelete;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (!StringUtil.startsWithIgnoreCase(myHtmlFile, FILE_PREFIX) && !isHttp()) {
|
||||
try {
|
||||
return new File(myHtmlFile).toURL().toString();
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
}
|
||||
}
|
||||
return myHtmlFile;
|
||||
}
|
||||
|
||||
public boolean isHttp() {
|
||||
return StringUtil.startsWithIgnoreCase(myHtmlFile, HTTP_PREFIX) || StringUtil.startsWithIgnoreCase(myHtmlFile, HTTPS_PREFIX);
|
||||
}
|
||||
|
||||
public void deleteFile() {
|
||||
if (myFileToDelete != null) {
|
||||
myFileToDelete.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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.execution.applet;
|
||||
|
||||
import com.intellij.execution.*;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.junit.RefactoringListeners;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class AppletConfiguration extends ModuleBasedConfiguration<JavaRunConfigurationModule> implements SingleClassConfiguration, RefactoringListenerProvider {
|
||||
|
||||
public String MAIN_CLASS_NAME;
|
||||
public String HTML_FILE_NAME;
|
||||
public boolean HTML_USED;
|
||||
public int WIDTH;
|
||||
public int HEIGHT;
|
||||
public String POLICY_FILE;
|
||||
public String VM_PARAMETERS;
|
||||
private AppletParameter[] myAppletParameters;
|
||||
public boolean ALTERNATIVE_JRE_PATH_ENABLED;
|
||||
public String ALTERNATIVE_JRE_PATH;
|
||||
@NonNls
|
||||
protected static final String NAME_ATTR = "name";
|
||||
@NonNls
|
||||
protected static final String VALUE_ATTR = "value";
|
||||
@NonNls
|
||||
protected static final String PARAMETER_ELEMENT_NAME = "parameter";
|
||||
|
||||
public AppletConfiguration(final String name, final Project project, ConfigurationFactory factory) {
|
||||
super(name, new JavaRunConfigurationModule(project, false), factory);
|
||||
}
|
||||
|
||||
public void setMainClass(final PsiClass psiClass) {
|
||||
final Module originalModule = getConfigurationModule().getModule();
|
||||
setMainClassName(JavaExecutionUtil.getRuntimeQualifiedName(psiClass));
|
||||
setModule(JavaExecutionUtil.findModule(psiClass));
|
||||
restoreOriginalModule(originalModule);
|
||||
}
|
||||
|
||||
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
|
||||
final JavaCommandLineState state = new JavaCommandLineState(env) {
|
||||
private AppletHtmlFile myHtmlURL = null;
|
||||
|
||||
protected JavaParameters createJavaParameters() throws ExecutionException {
|
||||
final JavaParameters params = new JavaParameters();
|
||||
myHtmlURL = getHtmlURL();
|
||||
if (myHtmlURL != null) {
|
||||
final int classPathType = myHtmlURL.isHttp() ? JavaParameters.JDK_ONLY : JavaParameters.JDK_AND_CLASSES;
|
||||
final RunConfigurationModule runConfigurationModule = getConfigurationModule();
|
||||
JavaParametersUtil.configureModule(runConfigurationModule, params, classPathType, ALTERNATIVE_JRE_PATH_ENABLED ? ALTERNATIVE_JRE_PATH : null);
|
||||
final String policyFileParameter = getPolicyFileParameter();
|
||||
if (policyFileParameter != null) {
|
||||
params.getVMParametersList().add(policyFileParameter);
|
||||
}
|
||||
params.getVMParametersList().addParametersString(VM_PARAMETERS);
|
||||
params.setMainClass("sun.applet.AppletViewer");
|
||||
params.getProgramParametersList().add(myHtmlURL.getUrl());
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
protected OSProcessHandler startProcess() throws ExecutionException {
|
||||
final OSProcessHandler handler = super.startProcess();
|
||||
final AppletHtmlFile htmlUrl = myHtmlURL;
|
||||
if (htmlUrl != null) {
|
||||
handler.addProcessListener(new ProcessAdapter() {
|
||||
public void processTerminated(ProcessEvent event) {
|
||||
htmlUrl.deleteFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
};
|
||||
state.setConsoleBuilder(TextConsoleBuilderFactory.getInstance().createBuilder(getProject()));
|
||||
return state;
|
||||
}
|
||||
|
||||
public SettingsEditor<? extends RunConfiguration> getConfigurationEditor() {
|
||||
return new AppletConfigurable(getProject());
|
||||
}
|
||||
|
||||
@NonNls private String getPolicyFileParameter() {
|
||||
if (POLICY_FILE != null && POLICY_FILE.length() > 0) {
|
||||
return "-Djava.security.policy=" + getPolicyFile();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPolicyFile(final String localPath) {
|
||||
POLICY_FILE = ExternalizablePath.urlValue(localPath);
|
||||
}
|
||||
|
||||
public String getPolicyFile() {
|
||||
return ExternalizablePath.localPathValue(POLICY_FILE);
|
||||
}
|
||||
|
||||
public static class AppletParameter {
|
||||
public String myName;
|
||||
public String myValue;
|
||||
|
||||
public AppletParameter(@NonNls final String name, final String value) {
|
||||
myName = name;
|
||||
myValue = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
public void setValue(final String value) {
|
||||
myValue = value;
|
||||
}
|
||||
|
||||
public boolean equals(final Object obj) {
|
||||
if (!(obj instanceof AppletParameter)) return false;
|
||||
final AppletParameter second = (AppletParameter)obj;
|
||||
return Comparing.equal(myName, second.myName) && Comparing.equal(myValue, second.myValue);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return Comparing.hashcode(myName, myValue);
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<Module> getValidModules() {
|
||||
return JavaRunConfigurationModule.getModulesForClass(getProject(), MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void readExternal(final Element parentNode) throws InvalidDataException {
|
||||
DefaultJDOMExternalizer.readExternal(this, parentNode);
|
||||
readModule(parentNode);
|
||||
final ArrayList<AppletParameter> parameters = new ArrayList<AppletParameter>();
|
||||
for (
|
||||
Iterator iterator = parentNode.getChildren(PARAMETER_ELEMENT_NAME).iterator(); iterator.hasNext();) {
|
||||
final Element element = (Element)iterator.next();
|
||||
final String name = element.getAttributeValue(NAME_ATTR);
|
||||
final String value = element.getAttributeValue(VALUE_ATTR);
|
||||
parameters.add(new AppletParameter(name, value));
|
||||
}
|
||||
myAppletParameters = parameters.toArray(new AppletParameter[parameters.size()]);
|
||||
}
|
||||
|
||||
public void writeExternal(final Element parentNode) throws WriteExternalException {
|
||||
writeModule(parentNode);
|
||||
DefaultJDOMExternalizer.writeExternal(this, parentNode);
|
||||
if (myAppletParameters != null) {
|
||||
for (int i = 0; i < myAppletParameters.length; i++) {
|
||||
final Element element = new Element(PARAMETER_ELEMENT_NAME);
|
||||
parentNode.addContent(element);
|
||||
element.setAttribute(NAME_ATTR, myAppletParameters[i].getName());
|
||||
element.setAttribute(VALUE_ATTR, myAppletParameters[i].getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected ModuleBasedConfiguration createInstance() {
|
||||
return new AppletConfiguration(getName(), getProject(), AppletConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
}
|
||||
|
||||
public String getGeneratedName() {
|
||||
if (MAIN_CLASS_NAME == null) return null;
|
||||
return JavaExecutionUtil.getPresentableClassName(MAIN_CLASS_NAME, getConfigurationModule());
|
||||
}
|
||||
|
||||
public RefactoringElementListener getRefactoringElementListener(final PsiElement element) {
|
||||
if (HTML_USED) return null;
|
||||
return RefactoringListeners.getClassOrPackageListener(element, new RefactoringListeners.SingleClassConfigurationAccessor(this));
|
||||
}
|
||||
|
||||
public PsiClass getMainClass() {
|
||||
return getConfigurationModule().findClass(MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void setGeneratedName() {
|
||||
setName(getGeneratedName());
|
||||
}
|
||||
|
||||
public boolean isGeneratedName() {
|
||||
return Comparing.equal(getName(), getGeneratedName());
|
||||
}
|
||||
|
||||
public String suggestedName() {
|
||||
return ProgramRunnerUtil.shortenName(JavaExecutionUtil.getShortClassName(MAIN_CLASS_NAME), 0);
|
||||
}
|
||||
|
||||
public void setMainClassName(final String qualifiedName) {
|
||||
final boolean generatedName = isGeneratedName();
|
||||
MAIN_CLASS_NAME = qualifiedName;
|
||||
if (generatedName) setGeneratedName();
|
||||
}
|
||||
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {
|
||||
if (ALTERNATIVE_JRE_PATH_ENABLED){
|
||||
if (ALTERNATIVE_JRE_PATH == null ||
|
||||
ALTERNATIVE_JRE_PATH.length() == 0 ||
|
||||
!JavaSdkImpl.checkForJre(ALTERNATIVE_JRE_PATH)){
|
||||
throw new RuntimeConfigurationWarning(ExecutionBundle.message("jre.not.valid.error.message", ALTERNATIVE_JRE_PATH));
|
||||
}
|
||||
}
|
||||
getConfigurationModule().checkForWarning();
|
||||
if (HTML_USED) {
|
||||
if (HTML_FILE_NAME == null || HTML_FILE_NAME.length() == 0) {
|
||||
throw new RuntimeConfigurationWarning(ExecutionBundle.message("html.file.not.specified.error.message"));
|
||||
}
|
||||
try {
|
||||
new URL(HTML_FILE_NAME);
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
throw new RuntimeConfigurationWarning("URL " + HTML_FILE_NAME + " is not valid: " + ex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
else {
|
||||
getConfigurationModule().checkClassName(MAIN_CLASS_NAME, ExecutionBundle.message("no.applet.class.specified.error.message"));
|
||||
}
|
||||
}
|
||||
|
||||
public AppletParameter[] getAppletParameters() {
|
||||
return myAppletParameters;
|
||||
}
|
||||
|
||||
public void setAppletParameters(final AppletParameter[] appletParameters) {
|
||||
myAppletParameters = appletParameters;
|
||||
}
|
||||
|
||||
public void setAppletParameters(final List<AppletParameter> parameters) {
|
||||
setAppletParameters(parameters.toArray(new AppletParameter[parameters.size()]));
|
||||
}
|
||||
|
||||
private AppletHtmlFile getHtmlURL() throws CantRunException {
|
||||
if (HTML_USED) {
|
||||
if (HTML_FILE_NAME == null || HTML_FILE_NAME.length() == 0) {
|
||||
throw new CantRunException(ExecutionBundle.message("html.file.not.specified.error.message"));
|
||||
}
|
||||
return new AppletHtmlFile(HTML_FILE_NAME, null);
|
||||
}
|
||||
else {
|
||||
if (MAIN_CLASS_NAME == null || MAIN_CLASS_NAME.length() == 0) {
|
||||
throw new CantRunException(ExecutionBundle.message("class.not.specified.error.message"));
|
||||
}
|
||||
|
||||
// generate html
|
||||
try {
|
||||
return generateAppletTempPage();
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new CantRunException(ExecutionBundle.message("failed.to.generate.wrapper.error.message"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AppletHtmlFile generateAppletTempPage() throws IOException {
|
||||
final File tempFile = FileUtil.createTempFile("AppletPage", ".html");
|
||||
@NonNls final FileWriter writer = new FileWriter(tempFile);
|
||||
try {
|
||||
writer.write("<html>\n" +
|
||||
"<head>\n" +
|
||||
"<title>" + MAIN_CLASS_NAME + "</title>\n" +
|
||||
"</head>\n" +
|
||||
"<applet codebase=\".\"\n" +
|
||||
"code=\"" + MAIN_CLASS_NAME + "\"\n" +
|
||||
"name=\"" + MAIN_CLASS_NAME + "\"\n" +
|
||||
"width=" + WIDTH + "\n" +
|
||||
"height=" + HEIGHT + "\n" +
|
||||
"align=top>\n");
|
||||
final AppletParameter[] appletParameters = getAppletParameters();
|
||||
if (appletParameters != null) {
|
||||
for (final AppletParameter parameter : appletParameters) {
|
||||
writer.write("<param name=\"" + parameter.getName() + "\" value=\"" + parameter.getValue() + "\">\n");
|
||||
}
|
||||
}
|
||||
writer.write("</applet>\n</body>\n</html>\n");
|
||||
}
|
||||
finally {
|
||||
writer.close();
|
||||
}
|
||||
final String htmlFile = tempFile.getAbsolutePath();
|
||||
return new AppletHtmlFile(htmlFile, tempFile);
|
||||
}
|
||||
|
||||
private static class AppletHtmlFile {
|
||||
private final String myHtmlFile;
|
||||
private final File myFileToDelete;
|
||||
@NonNls
|
||||
protected static final String FILE_PREFIX = "file:/";
|
||||
@NonNls
|
||||
protected static final String HTTP_PREFIX = "http:/";
|
||||
@NonNls
|
||||
protected static final String HTTPS_PREFIX = "https:/";
|
||||
|
||||
protected AppletHtmlFile(final String htmlFile, final File fileToDelete) {
|
||||
myHtmlFile = htmlFile;
|
||||
myFileToDelete = fileToDelete;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
if (!StringUtil.startsWithIgnoreCase(myHtmlFile, FILE_PREFIX) && !isHttp()) {
|
||||
try {
|
||||
return new File(myHtmlFile).toURL().toString();
|
||||
}
|
||||
catch (MalformedURLException ex) {
|
||||
}
|
||||
}
|
||||
return myHtmlFile;
|
||||
}
|
||||
|
||||
public boolean isHttp() {
|
||||
return StringUtil.startsWithIgnoreCase(myHtmlFile, HTTP_PREFIX) || StringUtil.startsWithIgnoreCase(myHtmlFile, HTTPS_PREFIX);
|
||||
}
|
||||
|
||||
public void deleteFile() {
|
||||
if (myFileToDelete != null) {
|
||||
myFileToDelete.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,143 +1,143 @@
|
||||
/*
|
||||
* 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.execution.filters;
|
||||
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ExceptionFilter implements Filter, DumbAware {
|
||||
private final Project myProject;
|
||||
@NonNls private static final String AT = "at";
|
||||
private static final String AT_PREFIX = AT + " ";
|
||||
private static final String STANDALONE_AT = " " + AT + " ";
|
||||
private static final TextAttributes HYPERLINK_ATTRIBUTES = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES);
|
||||
private final GlobalSearchScope mySearchScope;
|
||||
|
||||
public ExceptionFilter(@NotNull final Project project) {
|
||||
myProject = project;
|
||||
mySearchScope = GlobalSearchScope.allScope(myProject);
|
||||
}
|
||||
|
||||
public ExceptionFilter(@NotNull final GlobalSearchScope scope) {
|
||||
myProject = scope.getProject();
|
||||
mySearchScope = scope;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static Trinity<String, String, TextRange> parseExceptionLine(final String line) {
|
||||
int atIndex;
|
||||
if (line.startsWith(AT_PREFIX)){
|
||||
atIndex = 0;
|
||||
}
|
||||
else{
|
||||
atIndex = line.indexOf(STANDALONE_AT);
|
||||
if (atIndex < 0) {
|
||||
atIndex = line.indexOf(AT_PREFIX);
|
||||
}
|
||||
if (atIndex < 0) return null;
|
||||
}
|
||||
|
||||
final int lparenthIndex = line.indexOf('(', atIndex);
|
||||
if (lparenthIndex < 0) return null;
|
||||
final int lastDotIndex = line.lastIndexOf('.', lparenthIndex);
|
||||
if (lastDotIndex < 0 || lastDotIndex < atIndex) return null;
|
||||
String className = line.substring(atIndex + AT.length() + 1, lastDotIndex).trim();
|
||||
|
||||
String methodName = line.substring(lastDotIndex + 1, lparenthIndex).trim();
|
||||
|
||||
final int rparenthIndex = line.indexOf(')', lparenthIndex);
|
||||
if (rparenthIndex < 0) return null;
|
||||
|
||||
return Trinity.create(className, methodName, new TextRange(lparenthIndex, rparenthIndex));
|
||||
}
|
||||
|
||||
public Result applyFilter(final String line, final int textEndOffset) {
|
||||
final Trinity<String, String, TextRange> info = parseExceptionLine(line);
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String className = info.first;
|
||||
final int dollarIndex = className.indexOf('$');
|
||||
if (dollarIndex >= 0){
|
||||
className = className.substring(0, dollarIndex);
|
||||
}
|
||||
|
||||
final int lparenthIndex = info.third.getStartOffset();
|
||||
final int rparenthIndex = info.third.getEndOffset();
|
||||
final String fileAndLine = line.substring(lparenthIndex + 1, rparenthIndex).trim();
|
||||
|
||||
final int colonIndex = fileAndLine.lastIndexOf(':');
|
||||
if (colonIndex < 0) return null;
|
||||
|
||||
final String lineString = fileAndLine.substring(colonIndex + 1);
|
||||
try{
|
||||
final int lineNumber = Integer.parseInt(lineString);
|
||||
final PsiManager manager = PsiManager.getInstance(myProject);
|
||||
PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(className, mySearchScope);
|
||||
if (aClass == null) {
|
||||
aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
if (aClass == null) return null;
|
||||
}
|
||||
final PsiFile file = (PsiFile) aClass.getContainingFile().getNavigationElement();
|
||||
if (file == null) return null;
|
||||
|
||||
/*
|
||||
IDEADEV-4976: Some scramblers put something like SourceFile mock instead of real class name.
|
||||
final String filePath = fileAndLine.substring(0, colonIndex).replace('/', File.separatorChar);
|
||||
final int slashIndex = filePath.lastIndexOf(File.separatorChar);
|
||||
final String shortFileName = slashIndex < 0 ? filePath : filePath.substring(slashIndex + 1);
|
||||
if (!file.getName().equalsIgnoreCase(shortFileName)) return null;
|
||||
*/
|
||||
|
||||
final int textStartOffset = textEndOffset - line.length();
|
||||
|
||||
final int highlightStartOffset = textStartOffset + lparenthIndex + 1;
|
||||
final int highlightEndOffset = textStartOffset + rparenthIndex;
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
final OpenFileHyperlinkInfo linkInfo = new OpenFileHyperlinkInfo(myProject, virtualFile, lineNumber - 1);
|
||||
TextAttributes attributes = HYPERLINK_ATTRIBUTES.clone();
|
||||
if (!ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(virtualFile)) {
|
||||
Color color = UIUtil.getInactiveTextColor();
|
||||
attributes.setForegroundColor(color);
|
||||
attributes.setEffectColor(color);
|
||||
}
|
||||
return new Result(highlightStartOffset, highlightEndOffset, linkInfo, attributes);
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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.execution.filters;
|
||||
|
||||
import com.intellij.openapi.editor.colors.CodeInsightColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiManager;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class ExceptionFilter implements Filter, DumbAware {
|
||||
private final Project myProject;
|
||||
@NonNls private static final String AT = "at";
|
||||
private static final String AT_PREFIX = AT + " ";
|
||||
private static final String STANDALONE_AT = " " + AT + " ";
|
||||
private static final TextAttributes HYPERLINK_ATTRIBUTES = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES);
|
||||
private final GlobalSearchScope mySearchScope;
|
||||
|
||||
public ExceptionFilter(@NotNull final Project project) {
|
||||
myProject = project;
|
||||
mySearchScope = GlobalSearchScope.allScope(myProject);
|
||||
}
|
||||
|
||||
public ExceptionFilter(@NotNull final GlobalSearchScope scope) {
|
||||
myProject = scope.getProject();
|
||||
mySearchScope = scope;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static Trinity<String, String, TextRange> parseExceptionLine(final String line) {
|
||||
int atIndex;
|
||||
if (line.startsWith(AT_PREFIX)){
|
||||
atIndex = 0;
|
||||
}
|
||||
else{
|
||||
atIndex = line.indexOf(STANDALONE_AT);
|
||||
if (atIndex < 0) {
|
||||
atIndex = line.indexOf(AT_PREFIX);
|
||||
}
|
||||
if (atIndex < 0) return null;
|
||||
}
|
||||
|
||||
final int lparenthIndex = line.indexOf('(', atIndex);
|
||||
if (lparenthIndex < 0) return null;
|
||||
final int lastDotIndex = line.lastIndexOf('.', lparenthIndex);
|
||||
if (lastDotIndex < 0 || lastDotIndex < atIndex) return null;
|
||||
String className = line.substring(atIndex + AT.length() + 1, lastDotIndex).trim();
|
||||
|
||||
String methodName = line.substring(lastDotIndex + 1, lparenthIndex).trim();
|
||||
|
||||
final int rparenthIndex = line.indexOf(')', lparenthIndex);
|
||||
if (rparenthIndex < 0) return null;
|
||||
|
||||
return Trinity.create(className, methodName, new TextRange(lparenthIndex, rparenthIndex));
|
||||
}
|
||||
|
||||
public Result applyFilter(final String line, final int textEndOffset) {
|
||||
final Trinity<String, String, TextRange> info = parseExceptionLine(line);
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String className = info.first;
|
||||
final int dollarIndex = className.indexOf('$');
|
||||
if (dollarIndex >= 0){
|
||||
className = className.substring(0, dollarIndex);
|
||||
}
|
||||
|
||||
final int lparenthIndex = info.third.getStartOffset();
|
||||
final int rparenthIndex = info.third.getEndOffset();
|
||||
final String fileAndLine = line.substring(lparenthIndex + 1, rparenthIndex).trim();
|
||||
|
||||
final int colonIndex = fileAndLine.lastIndexOf(':');
|
||||
if (colonIndex < 0) return null;
|
||||
|
||||
final String lineString = fileAndLine.substring(colonIndex + 1);
|
||||
try{
|
||||
final int lineNumber = Integer.parseInt(lineString);
|
||||
final PsiManager manager = PsiManager.getInstance(myProject);
|
||||
PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(className, mySearchScope);
|
||||
if (aClass == null) {
|
||||
aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
if (aClass == null) return null;
|
||||
}
|
||||
final PsiFile file = (PsiFile) aClass.getContainingFile().getNavigationElement();
|
||||
if (file == null) return null;
|
||||
|
||||
/*
|
||||
IDEADEV-4976: Some scramblers put something like SourceFile mock instead of real class name.
|
||||
final String filePath = fileAndLine.substring(0, colonIndex).replace('/', File.separatorChar);
|
||||
final int slashIndex = filePath.lastIndexOf(File.separatorChar);
|
||||
final String shortFileName = slashIndex < 0 ? filePath : filePath.substring(slashIndex + 1);
|
||||
if (!file.getName().equalsIgnoreCase(shortFileName)) return null;
|
||||
*/
|
||||
|
||||
final int textStartOffset = textEndOffset - line.length();
|
||||
|
||||
final int highlightStartOffset = textStartOffset + lparenthIndex + 1;
|
||||
final int highlightEndOffset = textStartOffset + rparenthIndex;
|
||||
VirtualFile virtualFile = file.getVirtualFile();
|
||||
final OpenFileHyperlinkInfo linkInfo = new OpenFileHyperlinkInfo(myProject, virtualFile, lineNumber - 1);
|
||||
TextAttributes attributes = HYPERLINK_ATTRIBUTES.clone();
|
||||
if (!ProjectRootManager.getInstance(myProject).getFileIndex().isInContent(virtualFile)) {
|
||||
Color color = UIUtil.getInactiveTextColor();
|
||||
attributes.setForegroundColor(color);
|
||||
attributes.setEffectColor(color);
|
||||
}
|
||||
return new Result(highlightStartOffset, highlightEndOffset, linkInfo, attributes);
|
||||
}
|
||||
catch(NumberFormatException e){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user