Parent: [r14] (diff)

Download this file

core.java    132 lines (101 with data), 3.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
* SPDXVersion: SPDX-1.1
* Creator: Person: Nuno Brito (nuno.brito@triplecheck.de)
* Creator: Organization: TripleCheck (contact@triplecheck.de)
* Created: 2013-09-01T00:00:00Z
* LicenseName: NOASSERTION
* FileName: core.java
* FileType: SOURCE
* FileCopyrightText: <text> Copyright 2013 Nuno Brito, TripleCheck </text>
* FileComment: <text> A static class used as Singleton to keep a single
* instance of specific services such as log messages working synchronized
* </text>
*/
package main;
import FileExtension.ExtensionControl;
import GUI.StudioUI2;
import GUI.StudioUI4;
import definitions.Messages;
import definitions.is;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import script.License;
import script.RunningTask;
import script.log;
import spdxlib.SPDXfile;
import utils.Settings;
public class core {
public static String version = "0.4";
public static
Script script = new Script();
public static
Settings settings = new Settings(new File("settings.xml"), "");
public static ArrayList<SPDXfile>
//components,
products;
// where we keep our shared objects
public static HashMap
temp = new HashMap<String, Object>();
public static StudioUI2 studio2 = null;
public static StudioUI4 studio = null;
public static utils.KeyStroke key =
new utils.KeyStroke(Messages.SearchBoxPressedKey);
public static File thisFile;
static public boolean
searchBoxActive = false,
textWasModified; // relates to the main text box
// a placeholder to launch searches and share the keywords securely
public static String searchTerm = "";
public static ArrayList<License>
licenses = new ArrayList();
public static ExtensionControl
extensions = new ExtensionControl();
public static ArrayList<RunningTask>
runningTasks = new ArrayList();
/**
* Gets the folder where we are running
* @return The folder from where the main application is running
*/
public static File getWorkFolder(){
return new File(".").getAbsoluteFile().getParentFile();
}
/**
* Gets an Icon file from the icon archive
* @param filename The icon name inside our archive
* @return A file pointer to the icon
*/
public static File getIcon(String filename){
File iconFolder = new File(getWorkFolder(), is.iconFolder);
return new File(iconFolder, filename);
}
/**
* where the plugins are located
* @return
*/
public static File getPluginsFolder(){
return new File(getWorkFolder(), "plugins");
}
public static File getLibraryFolder(){
return new File(getWorkFolder(), "library");
}
public static File getProductsFolder(){
return new File(getWorkFolder(), "products");
}
public static File getExtensionsFolder(){
return new File(getWorkFolder(), "extensions");
}
public static File getExtensionsUnknown(){
return new File(getExtensionsFolder(), "unknown");
}
/**
* Send out a warning that our SPDX's have been modified somehow
*/
public static void refreshSPDX(){
// find all SPDX files inside our archive
File baseFolder = new File(".");
core.products = actions.findSPDX(new File(baseFolder, is.products));
// send a message to the world, warning that things changed
log.write(is.INFO, Messages.RefreshSPDX);
}
}