2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.ide
.browsers
.firefox
;
18 import com
.intellij
.ide
.browsers
.BrowserSpecificSettings
;
19 import com
.intellij
.openapi
.options
.Configurable
;
20 import com
.intellij
.openapi
.util
.io
.FileUtil
;
21 import com
.intellij
.util
.xmlb
.annotations
.Tag
;
22 import org
.jetbrains
.annotations
.Nullable
;
23 import org
.jetbrains
.annotations
.NotNull
;
26 import java
.util
.List
;
31 public class FirefoxSettings
extends BrowserSpecificSettings
{
32 private String myProfilesIniPath
;
33 private String myProfile
;
35 public FirefoxSettings() {
38 public FirefoxSettings(String profilesIniPath
, String profile
) {
39 myProfilesIniPath
= profilesIniPath
;
44 @Tag("profiles-ini-path")
45 public String
getProfilesIniPath() {
46 return myProfilesIniPath
;
49 public void setProfilesIniPath(String profilesIniPath
) {
50 myProfilesIniPath
= profilesIniPath
;
55 public String
getProfile() {
59 public void setProfile(String profile
) {
64 public Configurable
createConfigurable() {
65 return new FirefoxSettingsConfigurable(this);
69 public File
getProfilesIniFile() {
70 if (myProfilesIniPath
!= null) {
71 return new File(FileUtil
.toSystemDependentName(myProfilesIniPath
));
73 return FirefoxUtil
.getDefaultProfileIniPath();
78 public String
[] getAdditionalParameters() {
79 final List
<FirefoxProfile
> profiles
= FirefoxUtil
.computeProfiles(getProfilesIniFile());
80 if (profiles
.size() >= 2) {
81 final FirefoxProfile profile
= FirefoxUtil
.findProfileByNameOrDefault(myProfile
, profiles
);
82 if (profile
!= null) {
83 return new String
[] {"-P", profile
.getName()};
86 return super.getAdditionalParameters();