Lines 76-81
Link Here
|
76 |
import org.netbeans.api.java.project.JavaProjectConstants; |
76 |
import org.netbeans.api.java.project.JavaProjectConstants; |
77 |
import org.netbeans.api.progress.ProgressHandle; |
77 |
import org.netbeans.api.progress.ProgressHandle; |
78 |
import org.netbeans.api.progress.ProgressHandleFactory; |
78 |
import org.netbeans.api.progress.ProgressHandleFactory; |
|
|
79 |
import org.netbeans.api.progress.ProgressRunnable; |
80 |
import org.netbeans.api.progress.ProgressUtils; |
79 |
import org.netbeans.api.project.FileOwnerQuery; |
81 |
import org.netbeans.api.project.FileOwnerQuery; |
80 |
import org.netbeans.api.project.Project; |
82 |
import org.netbeans.api.project.Project; |
81 |
import org.netbeans.api.project.ProjectInformation; |
83 |
import org.netbeans.api.project.ProjectInformation; |
Lines 98-104
Link Here
|
98 |
import org.netbeans.modules.javacard.project.deps.ResolvedDependencies; |
100 |
import org.netbeans.modules.javacard.project.deps.ResolvedDependencies; |
99 |
import org.netbeans.modules.javacard.project.deps.ResolvedDependency; |
101 |
import org.netbeans.modules.javacard.project.deps.ResolvedDependency; |
100 |
import org.netbeans.modules.javacard.api.BadPlatformOrDevicePanel; |
102 |
import org.netbeans.modules.javacard.api.BadPlatformOrDevicePanel; |
101 |
import org.netbeans.modules.javacard.common.GuiUtils; |
|
|
102 |
import org.netbeans.modules.javacard.project.ui.UnsupportedEncodingDialog; |
103 |
import org.netbeans.modules.javacard.project.ui.UnsupportedEncodingDialog; |
103 |
import org.netbeans.modules.javacard.spi.Card; |
104 |
import org.netbeans.modules.javacard.spi.Card; |
104 |
import org.netbeans.modules.javacard.spi.Cards; |
105 |
import org.netbeans.modules.javacard.spi.Cards; |
Lines 1017-1070
Link Here
|
1017 |
if (platform.equals(newPlatform) && device.equals(newDevice)) { |
1018 |
if (platform.equals(newPlatform) && device.equals(newDevice)) { |
1018 |
return; |
1019 |
return; |
1019 |
} |
1020 |
} |
1020 |
final ProgressHandle progress = ProgressHandleFactory.createHandle(NbBundle.getMessage( |
1021 |
class PlatformSaver implements ProgressRunnable<Void>, Mutex.ExceptionAction<Void> { |
1021 |
JCProject.class, "MSG_SAVING_PROPERTIES")); //NOI18N |
1022 |
private ProgressHandle handle; |
1022 |
Runnable r = new Runnable() { |
1023 |
@Override |
|
|
1024 |
public Void run(ProgressHandle handle) { |
1025 |
handle.switchToDeterminate(6); |
1026 |
this.handle = handle; |
1027 |
handle.progress(1); |
1028 |
try { |
1029 |
ProjectManager.mutex().writeAccess(this); |
1030 |
} catch (MutexException ex) { |
1031 |
Exceptions.printStackTrace(ex); |
1032 |
} |
1033 |
return null; |
1034 |
} |
1023 |
|
1035 |
|
1024 |
boolean first = true; |
1036 |
@Override |
1025 |
|
1037 |
public Void run() throws Exception { |
1026 |
public void run() { |
1038 |
handle.progress(2); |
1027 |
if (!EventQueue.isDispatchThread()) { |
1039 |
EditableProperties props = antHelper.getProperties( |
1028 |
if (first) { |
1040 |
AntProjectHelper.PROJECT_PROPERTIES_PATH); |
1029 |
progress.start(6); |
1041 |
handle.progress(3); |
1030 |
first = false; |
1042 |
props.setProperty( |
1031 |
progress.progress(1); |
1043 |
ProjectPropertyNames.PROJECT_PROP_ACTIVE_PLATFORM, |
1032 |
ProjectManager.mutex().writeAccess(this); |
1044 |
newPlatform); |
1033 |
} else { |
1045 |
props.setProperty( |
1034 |
progress.progress(2); |
1046 |
ProjectPropertyNames.PROJECT_PROP_ACTIVE_DEVICE, |
1035 |
EditableProperties props = antHelper.getProperties( |
1047 |
newDevice); |
1036 |
AntProjectHelper.PROJECT_PROPERTIES_PATH); |
1048 |
handle.progress(4); |
1037 |
progress.progress(3); |
1049 |
antHelper.putProperties( |
1038 |
props.setProperty( |
1050 |
AntProjectHelper.PROJECT_PROPERTIES_PATH, |
1039 |
ProjectPropertyNames.PROJECT_PROP_ACTIVE_PLATFORM, |
1051 |
props); |
1040 |
newPlatform); |
1052 |
handle.progress(5); |
1041 |
props.setProperty( |
1053 |
return null; |
1042 |
ProjectPropertyNames.PROJECT_PROP_ACTIVE_DEVICE, |
|
|
1043 |
newDevice); |
1044 |
progress.progress(4); |
1045 |
antHelper.putProperties( |
1046 |
AntProjectHelper.PROJECT_PROPERTIES_PATH, |
1047 |
props); |
1048 |
progress.progress(5); |
1049 |
try { |
1050 |
ProjectManager.getDefault().saveProject(JCProject.this); |
1051 |
} catch (IOException ex) { |
1052 |
Exceptions.printStackTrace(ex); |
1053 |
} catch (IllegalArgumentException ex) { |
1054 |
Exceptions.printStackTrace(ex); |
1055 |
} finally { |
1056 |
EventQueue.invokeLater(this); |
1057 |
} |
1058 |
} |
1059 |
} else { |
1060 |
synchronized (JCProject.this) { |
1061 |
cachedBadProjectOrCard = null; |
1062 |
} |
1063 |
supp.fireChange(); |
1064 |
} |
1065 |
} |
1054 |
} |
1066 |
}; |
1055 |
} |
1067 |
GuiUtils.showProgressDialogAndRun(progress, r, false); |
1056 |
ProgressUtils.showProgressDialogAndRun(new PlatformSaver(), NbBundle.getMessage( |
|
|
1057 |
JCProject.class, "MSG_SAVING_PROPERTIES"), true); |
1058 |
synchronized (JCProject.this) { |
1059 |
cachedBadProjectOrCard = null; |
1060 |
} |
1068 |
} |
1061 |
} |
1069 |
} |
1062 |
} |
1070 |
|
1063 |
|