59 |
|
|
60 |
import org.jsampler.view.JSMainFrame; |
import org.jsampler.view.JSMainFrame; |
61 |
import org.jsampler.view.JSProgress; |
import org.jsampler.view.JSProgress; |
62 |
|
import org.jsampler.view.JSViewConfig; |
63 |
import org.jsampler.view.InstrumentsDbTreeModel; |
import org.jsampler.view.InstrumentsDbTreeModel; |
64 |
|
|
65 |
import org.linuxsampler.lscp.AudioOutputChannel; |
import org.linuxsampler.lscp.AudioOutputChannel; |
88 |
private static Handler handler; |
private static Handler handler; |
89 |
private static FileOutputStream fos; |
private static FileOutputStream fos; |
90 |
|
|
91 |
|
private static JSViewConfig viewConfig = null; |
92 |
private static JSMainFrame mainFrame = null; |
private static JSMainFrame mainFrame = null; |
93 |
private static JSProgress progress = null; |
private static JSProgress progress = null; |
94 |
|
|
140 |
} |
} |
141 |
|
|
142 |
/** |
/** |
143 |
|
* Gets the configuration of the current view. |
144 |
|
*/ |
145 |
|
public static JSViewConfig |
146 |
|
getViewConfig() { return viewConfig; } |
147 |
|
|
148 |
|
/** |
149 |
|
* Sets the configuration of the current view. |
150 |
|
*/ |
151 |
|
public static void |
152 |
|
setViewConfig(JSViewConfig viewConfig) { CC.viewConfig = viewConfig; } |
153 |
|
|
154 |
|
/** |
155 |
* Returns the main window of this application. |
* Returns the main window of this application. |
156 |
* @return The main window of this application. |
* @return The main window of this application. |
157 |
*/ |
*/ |
307 |
checkJSamplerHome() { |
checkJSamplerHome() { |
308 |
if(getJSamplerHome() != null) { |
if(getJSamplerHome() != null) { |
309 |
File f = new File(getJSamplerHome()); |
File f = new File(getJSamplerHome()); |
310 |
if(f.isDirectory()) return; |
if(f.exists() && f.isDirectory()) { |
311 |
|
return; |
312 |
|
} |
313 |
} |
} |
314 |
|
|
315 |
CC.getMainFrame().installJSamplerHome(); |
CC.getMainFrame().installJSamplerHome(); |
325 |
public static void |
public static void |
326 |
changeJSamplerHome(String path) { |
changeJSamplerHome(String path) { |
327 |
File fNew = new File(path); |
File fNew = new File(path); |
328 |
if(fNew.isFile()) { |
if(fNew.exists() && fNew.isFile()) { |
329 |
HF.showErrorMessage(i18n.getError("CC.JSamplerHomeIsNotDir!")); |
HF.showErrorMessage(i18n.getError("CC.JSamplerHomeIsNotDir!")); |
330 |
return; |
return; |
331 |
} |
} |
332 |
|
|
333 |
if(!fNew.isDirectory()) { |
if(!fNew.exists()) { |
334 |
if(!fNew.mkdir()) { |
if(!fNew.mkdir()) { |
335 |
String s = fNew.getAbsolutePath(); |
String s = fNew.getAbsolutePath(); |
336 |
HF.showErrorMessage(i18n.getError("CC.mkdirFailed", s)); |
HF.showErrorMessage(i18n.getError("CC.mkdirFailed", s)); |
338 |
} |
} |
339 |
} |
} |
340 |
|
|
341 |
if(getJSamplerHome() == null) { |
if(getJSamplerHome() == null || path.equals(getJSamplerHome())) { |
342 |
setJSamplerHome(fNew.getAbsolutePath()); |
setJSamplerHome(fNew.getAbsolutePath()); |
343 |
return; |
return; |
344 |
} |
} |
345 |
|
|
346 |
File fOld = new File(getJSamplerHome()); |
File fOld = new File(getJSamplerHome()); |
347 |
if(!fOld.isDirectory()) { |
if(!fOld.exists() || !fOld.isDirectory()) { |
348 |
setJSamplerHome(fNew.getAbsolutePath()); |
setJSamplerHome(fNew.getAbsolutePath()); |
349 |
return; |
return; |
350 |
} |
} |
565 |
|
|
566 |
model.setServerInfo(gsi.getResult()); |
model.setServerInfo(gsi.getResult()); |
567 |
|
|
568 |
if(CC.getMainFrame().getInstrumentsDbSupport()) { |
if(CC.getViewConfig().getInstrumentsDbSupport()) { |
569 |
getInstrumentsDbTreeModel(); |
getInstrumentsDbTreeModel(); |
570 |
} |
} |
571 |
} |
} |
1028 |
case TASK_DONE: |
case TASK_DONE: |
1029 |
EnhancedTask t = (EnhancedTask)e.getSource(); |
EnhancedTask t = (EnhancedTask)e.getSource(); |
1030 |
if(t.doneWithErrors() && !t.isStopped()) { |
if(t.doneWithErrors() && !t.isStopped()) { |
1031 |
if(t.getErrorDetails() == null) { |
showError(t); |
|
HF.showErrorMessage(t.getErrorMessage()); |
|
|
} else { |
|
|
getMainFrame().showDetailedErrorMessage ( |
|
|
getMainFrame(), |
|
|
t.getErrorMessage(), |
|
|
t.getErrorDetails() |
|
|
); |
|
|
} |
|
1032 |
} |
} |
1033 |
break; |
break; |
1034 |
case NOT_IDLE: |
case NOT_IDLE: |
1041 |
} |
} |
1042 |
} |
} |
1043 |
|
|
1044 |
|
private void |
1045 |
|
showError(final Task t) { |
1046 |
|
javax.swing.SwingUtilities.invokeLater(new Runnable() { |
1047 |
|
public void |
1048 |
|
run() { |
1049 |
|
if(t.getErrorDetails() == null) { |
1050 |
|
HF.showErrorMessage(t.getErrorMessage()); |
1051 |
|
} else { |
1052 |
|
getMainFrame().showDetailedErrorMessage ( |
1053 |
|
getMainFrame(), |
1054 |
|
t.getErrorMessage(), |
1055 |
|
t.getErrorDetails() |
1056 |
|
); |
1057 |
|
} |
1058 |
|
} |
1059 |
|
}); |
1060 |
|
} |
1061 |
|
|
1062 |
/** Invoked when the name of orchestra is changed. */ |
/** Invoked when the name of orchestra is changed. */ |
1063 |
public void |
public void |
1064 |
nameChanged(OrchestraEvent e) { saveOrchestras(); } |
nameChanged(OrchestraEvent e) { saveOrchestras(); } |