Eclipseplugins
GitGrepSearchSettings.java
1 package com.proalpha.pds.gitutils.search;
2 
3 import org.eclipse.jface.dialogs.IDialogSettings;
4 
5 public class GitGrepSearchSettings {
6 
7  private static final String PHRASE = "phrase";
8  private static final String MATCHES = "matches";
9  private static final String CASE = "case";
10  private static final String FINDS = "finds";
11  private static final String REPOSITORY = "repository";
12  private static final String FILESCOPE = "filescope";
13 
14  private String textPhrase = "";
15  private String repositoryPath = "";
16  private String branchName = "";
17  private String fileNamePhrase = "**/*.*";
18  private String fileType = "ALL";
19  private int maxFinds = 100;
20  private boolean isCaseSensitive = false;
21 
22  public String getTextPhrase() {
23  return textPhrase;
24  }
25 
26  public void setTextPhrase(String textPhrase) {
27  this.textPhrase = textPhrase;
28  }
29 
30  public String getRepositoryPath() {
31  return repositoryPath;
32  }
33 
34  public void setRepositoryPath(String repositoryPath) {
35  this.repositoryPath = repositoryPath;
36  }
37 
38  public String getBranchName() {
39  return branchName;
40  }
41 
42  public void setBranchName(String branchName) {
43  this.branchName = branchName;
44  }
45 
46  public String getFileNamePhrase() {
47  return fileNamePhrase;
48  }
49 
50  public void setFileNamePhrase(String fileNamePhrase) {
51  this.fileNamePhrase = fileNamePhrase;
52  }
53 
54  public String getFileType() {
55  return fileType;
56  }
57 
58  public void setFileType(String fileType) {
59  this.fileType = fileType;
60  }
61 
62  public int getMaxFinds() {
63  return maxFinds;
64  }
65 
66  public void setMaxFinds(int maxFinds) {
67  this.maxFinds = maxFinds;
68  }
69 
70  public boolean isCaseSensitive() {
71  return isCaseSensitive;
72  }
73 
74  public void setCaseSensitive(boolean isCaseSensitive) {
75  this.isCaseSensitive = isCaseSensitive;
76  }
77 
78 
83  public void save(IDialogSettings settings) {
84 
85  IDialogSettings section = settings.getSection("searchSection");
86  if (section == null)
87  section = settings.addNewSection("searchSection");
88 
89  section.put(PHRASE, textPhrase);
90  section.put(MATCHES, fileNamePhrase);
91  section.put(CASE, !isCaseSensitive);
92  section.put(FINDS, maxFinds);
93  section.put(FILESCOPE, fileType);
94  section.put(REPOSITORY, repositoryPath);
95 
96  }
97 
103  public static GitGrepSearchSettings load(IDialogSettings settings) {
104  IDialogSettings section = settings.getSection("searchSection");
105  GitGrepSearchSettings searchSettings = new GitGrepSearchSettings();
106  if (section != null) {
107  searchSettings.setTextPhrase(section.get(PHRASE));
108  searchSettings.setFileNamePhrase(section.get(MATCHES));
109  searchSettings.setCaseSensitive(!section.getBoolean(CASE));
110  searchSettings.setMaxFinds(section.getInt(FINDS));
111  searchSettings.setFileType(section.get(FILESCOPE));
112  searchSettings.setRepositoryPath(section.get(REPOSITORY));
113  }
114  return searchSettings;
115  }
116 
117  public static GitGrepSearchSettings init() {
118  return new GitGrepSearchSettings();
119  }
120 }
static GitGrepSearchSettings load(IDialogSettings settings)