1 |
/* |
/* |
2 |
* JSampler - a java front-end for LinuxSampler |
* JSampler - a java front-end for LinuxSampler |
3 |
* |
* |
4 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
* Copyright (C) 2005-2008 Grigor Iliev <grigor@grigoriliev.com> |
5 |
* |
* |
6 |
* This file is part of JSampler. |
* This file is part of JSampler. |
7 |
* |
* |
52 |
/** The entry point of the task. */ |
/** The entry point of the task. */ |
53 |
public void |
public void |
54 |
run() { |
run() { |
55 |
try { |
try { |
56 |
SamplerModel sm = CC.getSamplerModel(); |
SamplerModel sm = CC.getSamplerModel(); |
57 |
Integer[] chnIDs = CC.getClient().getSamplerChannelIDs(); |
Integer[] chnIDs = CC.getClient().getSamplerChannelIDs(); |
58 |
|
|
91 |
|
|
92 |
if(v.size() > 0) sm.addChannel(v.elementAt(v.size() - 1)); |
if(v.size() > 0) sm.addChannel(v.elementAt(v.size() - 1)); |
93 |
else if(!CC.getSamplerModel().getChannelListIsAdjusting()) { |
else if(!CC.getSamplerModel().getChannelListIsAdjusting()) { |
94 |
if(oldValue) sm.addChannel(null); |
// FIXME: no change after |
95 |
|
// CC.getSamplerModel().setChannelListIsAdjusting(false); |
96 |
} |
} |
97 |
} catch(Exception x) { |
} catch(Exception x) { |
98 |
setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x)); |
setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x)); |
108 |
for(Task t : tasks) if(t.equals(this)) return; |
for(Task t : tasks) if(t.equals(this)) return; |
109 |
} |
} |
110 |
|
|
111 |
javax.swing.SwingUtilities.invokeLater(new Runnable() { |
try { |
112 |
public void |
javax.swing.SwingUtilities.invokeAndWait(new Runnable() { |
113 |
run() { |
public void |
114 |
CC.getSamplerModel().setChannelListIsAdjusting(false); |
run() { |
115 |
CC.getMainFrame().setAutoUpdateChannelListUI(true); |
CC.getSamplerModel().setChannelListIsAdjusting(false); |
116 |
CC.getMainFrame().updateChannelListUI(); |
CC.getMainFrame().setAutoUpdateChannelListUI(true); |
117 |
} |
CC.getMainFrame().updateChannelListUI(); |
118 |
}); |
} |
119 |
|
}); |
120 |
|
} catch(Exception x) { |
121 |
|
x.printStackTrace(); |
122 |
|
} |
123 |
} |
} |
124 |
|
|
125 |
/** |
/** |
127 |
* equal to this are removed if added using {@link org.jsampler.CC#scheduleTask}. |
* equal to this are removed if added using {@link org.jsampler.CC#scheduleTask}. |
128 |
* @see org.jsampler.CC#addTask |
* @see org.jsampler.CC#addTask |
129 |
*/ |
*/ |
130 |
|
@Override |
131 |
public boolean |
public boolean |
132 |
equals(Object obj) { |
equals(Object obj) { |
133 |
if(obj == null) return false; |
if(obj == null) return false; |