Revision: 14724
http://gate.svn.sourceforge.net/gate/?rev=14724&view=rev
Author: markagreenwood
Date: 2011-12-10 17:24:30 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
if you make changes to the creole configuration but don't apply them you will
now get a reminder when you try and close the dialog
Modified Paths:
--------------
gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java
gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
Modified: gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java
2011-12-10 14:42:43 UTC (rev 14723)
+++ gate/trunk/src/gate/gui/creole/manager/AvailablePlugins.java
2011-12-10 17:24:30 UTC (rev 14724)
@@ -51,6 +51,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -174,7 +175,7 @@
.setCellRenderer(cbCellRenderer);
mainTable.getColumnModel().getColumn(LOAD_NOW_COLUMN)
.setCellRenderer(cbCellRenderer);
-
+
resourcesListModel = new ResourcesListModel();
resourcesList = new JList(resourcesListModel);
resourcesList.setCellRenderer(new ResourcesListCellRenderer());
@@ -466,7 +467,7 @@
Gate.DirectoryInfo dInfo =
Gate.getDirectoryInfo(visibleRows.get(rowIndex));
if(dInfo == null) { return; }
-
+
switch(columnIndex){
case LOAD_NOW_COLUMN:
loadNowByURL.put(dInfo.getUrl(), valueBoolean);
@@ -545,15 +546,43 @@
}
}
+ protected boolean unsavedChanges() {
+
+ @SuppressWarnings("unchecked")
+ Set<URL> creoleDirectories = Gate.getCreoleRegister().getDirectories();
+
+ Iterator<URL> pluginIter = loadNowByURL.keySet().iterator();
+ while(pluginIter.hasNext()) {
+ URL aPluginURL = pluginIter.next();
+ boolean load = loadNowByURL.get(aPluginURL);
+ boolean loaded = creoleDirectories.contains(aPluginURL);
+ if(load && !loaded) { return true; }
+ if(!load && loaded) { return true; }
+ }
+
+ pluginIter = loadAlwaysByURL.keySet().iterator();
+ while(pluginIter.hasNext()) {
+ URL aPluginURL = pluginIter.next();
+ boolean load = loadAlwaysByURL.get(aPluginURL);
+ boolean loaded = Gate.getAutoloadPlugins().contains(aPluginURL);
+ if(load && !loaded) { return true; }
+ if(!load && loaded) { return true; }
+ }
+
+ return false;
+ }
+
protected void updateAvailablePlugins() {
+ @SuppressWarnings("unchecked")
+ Set<URL> creoleDirectories = Gate.getCreoleRegister().getDirectories();
+
// update the data structures to reflect the user's choices
Iterator<URL> pluginIter = loadNowByURL.keySet().iterator();
while(pluginIter.hasNext()) {
URL aPluginURL = pluginIter.next();
boolean load = loadNowByURL.get(aPluginURL);
- boolean loaded =
- Gate.getCreoleRegister().getDirectories().contains(aPluginURL);
+ boolean loaded = creoleDirectories.contains(aPluginURL);
if(load && !loaded) {
// load the directory
try {
Modified: gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
===================================================================
--- gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
2011-12-10 14:42:43 UTC (rev 14723)
+++ gate/trunk/src/gate/gui/creole/manager/PluginUpdateManager.java
2011-12-10 17:24:30 UTC (rev 14724)
@@ -494,6 +494,36 @@
Action cancelAction = new AbstractAction("Close") {
@Override
public void actionPerformed(ActionEvent e) {
+
+ boolean changes = false;
+
+ for(CreolePlugin p : availableModel.data) {
+ changes = changes || p.install;
+ if(changes) break;
+ }
+
+ if(!changes) {
+ for(CreolePlugin p : updatesModel.data) {
+ changes = changes || p.install;
+ if(changes) break;
+ }
+ }
+
+ if (!changes) changes = installed.unsavedChanges();
+
+ if(changes
+ && JOptionPane
+ .showConfirmDialog(
+ PluginUpdateManager.this,
+ "<html><body style='width: 350px;'><b>Changes
Have Not Yet Been Applied!</b><br><br>"
+ + "You have changed the CREOLE
configuration but have not applied the changes. "
+ + "Would you like to apply your
changes now?</body></html>",
+ "CREOLE Plugin Manager",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE) ==
JOptionPane.OK_OPTION) {
+ applyChanges();
+ }
+
PluginUpdateManager.this.setVisible(false);
}
};
@@ -1045,17 +1075,16 @@
site.enabled = (Boolean)value;
saveConfig();
- if (site.enabled) {
- //TODO can we do this without a complete reload?
+ if(site.enabled) {
+ // TODO can we do this without a complete reload?
showProgressPanel(true);
loadData();
- }
- else {
+ } else {
availableModel.data.removeAll(site.getCreolePlugins());
updatesModel.data.removeAll(site.getCreolePlugins());
availableModel.dataChanged();
updatesModel.dataChanged();
- tabs.setEnabledAt(1, updatesModel.getRowCount()>0);
+ tabs.setEnabledAt(1, updatesModel.getRowCount() > 0);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs