Lines 52-57
Link Here
|
52 |
import javax.swing.JList; |
52 |
import javax.swing.JList; |
53 |
import javax.swing.JTextField; |
53 |
import javax.swing.JTextField; |
54 |
import javax.swing.ListSelectionModel; |
54 |
import javax.swing.ListSelectionModel; |
|
|
55 |
import javax.swing.SwingUtilities; |
55 |
import javax.swing.event.ListSelectionEvent; |
56 |
import javax.swing.event.ListSelectionEvent; |
56 |
import javax.swing.event.ListSelectionListener; |
57 |
import javax.swing.event.ListSelectionListener; |
57 |
import org.netbeans.api.options.OptionsDisplayer; |
58 |
import org.netbeans.api.options.OptionsDisplayer; |
Lines 474-479
Link Here
|
474 |
}//GEN-LAST:event_reloadNewButtonActionPerformed |
475 |
}//GEN-LAST:event_reloadNewButtonActionPerformed |
475 |
|
476 |
|
476 |
private void addUrlButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUrlButtonActionPerformed |
477 |
private void addUrlButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addUrlButtonActionPerformed |
|
|
478 |
assert SwingUtilities.isEventDispatchThread(); |
479 |
|
477 |
NewUrlPanel panel = new NewUrlPanel(); |
480 |
NewUrlPanel panel = new NewUrlPanel(); |
478 |
|
481 |
|
479 |
DialogDescriptor descriptor = new DialogDescriptor(panel, NbBundle.getMessage(PluginPanel.class, |
482 |
DialogDescriptor descriptor = new DialogDescriptor(panel, NbBundle.getMessage(PluginPanel.class, |
Lines 503-508
Link Here
|
503 |
}//GEN-LAST:event_proxyButtonActionPerformed |
506 |
}//GEN-LAST:event_proxyButtonActionPerformed |
504 |
|
507 |
|
505 |
private void discoverButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_discoverButtonActionPerformed |
508 |
private void discoverButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_discoverButtonActionPerformed |
|
|
509 |
assert SwingUtilities.isEventDispatchThread(); |
510 |
|
506 |
// Bring up a selection list |
511 |
// Bring up a selection list |
507 |
String wait = getWaitMsg(); |
512 |
String wait = getWaitMsg(); |
508 |
RepositorySelectionPanel panel = new RepositorySelectionPanel(); |
513 |
RepositorySelectionPanel panel = new RepositorySelectionPanel(); |
Lines 557-562
Link Here
|
557 |
}//GEN-LAST:event_reloadReposButtonActionPerformed |
562 |
}//GEN-LAST:event_reloadReposButtonActionPerformed |
558 |
|
563 |
|
559 |
private void unregisterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unregisterButtonActionPerformed |
564 |
private void unregisterButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unregisterButtonActionPerformed |
|
|
565 |
assert SwingUtilities.isEventDispatchThread(); |
566 |
|
560 |
int[] indices = repositoryList.getSelectedIndices(); |
567 |
int[] indices = repositoryList.getSelectedIndices(); |
561 |
List<String> repositories = new ArrayList<String>(); |
568 |
List<String> repositories = new ArrayList<String>(); |
562 |
if (indices != null) { |
569 |
if (indices != null) { |
Lines 580-585
Link Here
|
580 |
}//GEN-LAST:event_unregisterButtonActionPerformed |
587 |
}//GEN-LAST:event_unregisterButtonActionPerformed |
581 |
|
588 |
|
582 |
private void repositoryPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_repositoryPanelComponentShown |
589 |
private void repositoryPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_repositoryPanelComponentShown |
|
|
590 |
assert SwingUtilities.isEventDispatchThread(); |
591 |
|
583 |
// Make sure the list is shown |
592 |
// Make sure the list is shown |
584 |
if (!repositoriesInitialized) { |
593 |
if (!repositoriesInitialized) { |
585 |
repositoriesInitialized = true; |
594 |
repositoriesInitialized = true; |
Lines 603-608
Link Here
|
603 |
}//GEN-LAST:event_repositoryPanelComponentShown |
612 |
}//GEN-LAST:event_repositoryPanelComponentShown |
604 |
|
613 |
|
605 |
private void newPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_newPanelComponentShown |
614 |
private void newPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_newPanelComponentShown |
|
|
615 |
assert SwingUtilities.isEventDispatchThread(); |
616 |
|
606 |
// Make sure the list is shown |
617 |
// Make sure the list is shown |
607 |
if (!newInitialized) { |
618 |
if (!newInitialized) { |
608 |
newInitialized = true; |
619 |
newInitialized = true; |
Lines 617-622
Link Here
|
617 |
}//GEN-LAST:event_newPanelComponentShown |
628 |
}//GEN-LAST:event_newPanelComponentShown |
618 |
|
629 |
|
619 |
private void installButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_installButtonActionPerformed |
630 |
private void installButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_installButtonActionPerformed |
|
|
631 |
assert SwingUtilities.isEventDispatchThread(); |
632 |
|
620 |
int[] indices = newList.getSelectedIndices(); |
633 |
int[] indices = newList.getSelectedIndices(); |
621 |
List<Plugin> plugins = new ArrayList<Plugin>(); |
634 |
List<Plugin> plugins = new ArrayList<Plugin>(); |
622 |
for (int index : indices) { |
635 |
for (int index : indices) { |
Lines 639-645
Link Here
|
639 |
if (result.equals(NotifyDescriptor.OK_OPTION)) { |
652 |
if (result.equals(NotifyDescriptor.OK_OPTION)) { |
640 |
Plugin plugin = new Plugin(panel.getPluginName(), null); |
653 |
Plugin plugin = new Plugin(panel.getPluginName(), null); |
641 |
// XXX Do I really need to refresh it right way? |
654 |
// XXX Do I really need to refresh it right way? |
642 |
PluginListRefresher completionTask = new PluginListRefresher(newList, true); |
655 |
PluginListRefresher completionTask = new PluginListRefresher(newList, false); |
643 |
boolean changed = pluginManager.install(new Plugin[] { plugin }, this, null, panel.isSvnExternals(), panel.isSvnCheckout(), panel.getRevision(), |
656 |
boolean changed = pluginManager.install(new Plugin[] { plugin }, this, null, panel.isSvnExternals(), panel.isSvnCheckout(), panel.getRevision(), |
644 |
true, completionTask); |
657 |
true, completionTask); |
645 |
installedModified = installedModified || changed; |
658 |
installedModified = installedModified || changed; |
Lines 660-665
Link Here
|
660 |
}//GEN-LAST:event_updateAllButtonActionPerformed |
673 |
}//GEN-LAST:event_updateAllButtonActionPerformed |
661 |
|
674 |
|
662 |
private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed |
675 |
private void updateButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updateButtonActionPerformed |
|
|
676 |
assert SwingUtilities.isEventDispatchThread(); |
677 |
|
663 |
int[] indices = installedList.getSelectedIndices(); |
678 |
int[] indices = installedList.getSelectedIndices(); |
664 |
List<Plugin> plugins = new ArrayList<Plugin>(); |
679 |
List<Plugin> plugins = new ArrayList<Plugin>(); |
665 |
if (indices != null) { |
680 |
if (indices != null) { |
Lines 680-685
Link Here
|
680 |
}//GEN-LAST:event_updateButtonActionPerformed |
695 |
}//GEN-LAST:event_updateButtonActionPerformed |
681 |
|
696 |
|
682 |
private void uninstallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uninstallButtonActionPerformed |
697 |
private void uninstallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uninstallButtonActionPerformed |
|
|
698 |
assert SwingUtilities.isEventDispatchThread(); |
699 |
|
683 |
int[] indices = installedList.getSelectedIndices(); |
700 |
int[] indices = installedList.getSelectedIndices(); |
684 |
List<Plugin> plugins = new ArrayList<Plugin>(); |
701 |
List<Plugin> plugins = new ArrayList<Plugin>(); |
685 |
if (indices != null) { |
702 |
if (indices != null) { |
Lines 704-709
Link Here
|
704 |
}//GEN-LAST:event_reloadInstalledButtonActionPerformed |
721 |
}//GEN-LAST:event_reloadInstalledButtonActionPerformed |
705 |
|
722 |
|
706 |
private void installedPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_installedPanelComponentShown |
723 |
private void installedPanelComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_installedPanelComponentShown |
|
|
724 |
assert SwingUtilities.isEventDispatchThread(); |
725 |
|
707 |
// Make sure the list is shown |
726 |
// Make sure the list is shown |
708 |
if (!installedInitialized) { |
727 |
if (!installedInitialized) { |
709 |
installedInitialized = true; |
728 |
installedInitialized = true; |
Lines 724-729
Link Here
|
724 |
|
743 |
|
725 |
/** Refresh the list of displayed plugins. If refresh is true, refresh the list from the plugin manager, otherwise just refilter list */ |
744 |
/** Refresh the list of displayed plugins. If refresh is true, refresh the list from the plugin manager, otherwise just refilter list */ |
726 |
private void refreshPluginList(final String filter, final boolean refresh, final JList list, final boolean local) { |
745 |
private void refreshPluginList(final String filter, final boolean refresh, final JList list, final boolean local) { |
|
|
746 |
assert SwingUtilities.isEventDispatchThread(); |
747 |
|
727 |
boolean showRefreshMessage = true; |
748 |
boolean showRefreshMessage = true; |
728 |
// if (!pluginManager.hasUptodateAvailableList()) { |
749 |
// if (!pluginManager.hasUptodateAvailableList()) { |
729 |
// // No need to ask for cached version if the full version will be displayed shortly |
750 |
// // No need to ask for cached version if the full version will be displayed shortly |
Lines 744-750
Link Here
|
744 |
Runnable runner = new Runnable() { |
765 |
Runnable runner = new Runnable() { |
745 |
public void run() { |
766 |
public void run() { |
746 |
synchronized(this) { |
767 |
synchronized(this) { |
747 |
DefaultListModel model = new DefaultListModel(); |
768 |
final DefaultListModel model = new DefaultListModel(); |
748 |
List<String> lines = new ArrayList<String>(500); |
769 |
List<String> lines = new ArrayList<String>(500); |
749 |
List<Plugin> plugins; |
770 |
List<Plugin> plugins; |
750 |
if (local) { |
771 |
if (local) { |
Lines 800-824
Link Here
|
800 |
model.addElement("<html><span color=\"red\">" + line + "</span></html>"); // NOI18N |
821 |
model.addElement("<html><span color=\"red\">" + line + "</span></html>"); // NOI18N |
801 |
} |
822 |
} |
802 |
} |
823 |
} |
803 |
list.clearSelection(); |
824 |
|
804 |
list.setModel(model); |
825 |
final int pluginsCount = plugins.size(); |
805 |
list.invalidate(); |
|
|
806 |
list.repaint(); |
807 |
if (plugins.size() > 0) { |
808 |
list.setSelectedIndex(0); |
809 |
} |
810 |
|
826 |
|
811 |
int tabIndex = local ? 0 : 1; |
827 |
SwingUtilities.invokeLater(new Runnable() { |
812 |
String tabTitle = pluginsTab.getTitleAt(tabIndex); |
828 |
public void run() { |
813 |
String originalTabTitle = tabTitle; |
829 |
list.clearSelection(); |
814 |
int index = tabTitle.lastIndexOf('('); |
830 |
list.setModel(model); |
815 |
if (index != -1) { |
831 |
list.invalidate(); |
816 |
tabTitle = tabTitle.substring(0, index); |
832 |
list.repaint(); |
817 |
} |
833 |
if (pluginsCount > 0) { |
818 |
tabTitle = tabTitle + "(" + plugins.size() + ")"; |
834 |
list.setSelectedIndex(0); |
819 |
if (!tabTitle.equals(originalTabTitle)) { |
835 |
} |
820 |
pluginsTab.setTitleAt(tabIndex, tabTitle); |
836 |
|
821 |
} |
837 |
int tabIndex = local ? 0 : 1; |
|
|
838 |
String tabTitle = pluginsTab.getTitleAt(tabIndex); |
839 |
String originalTabTitle = tabTitle; |
840 |
int index = tabTitle.lastIndexOf('('); |
841 |
if (index != -1) { |
842 |
tabTitle = tabTitle.substring(0, index); |
843 |
} |
844 |
tabTitle = tabTitle + "(" + pluginsCount + ")"; |
845 |
if (!tabTitle.equals(originalTabTitle)) { |
846 |
pluginsTab.setTitleAt(tabIndex, tabTitle); |
847 |
} |
848 |
} |
849 |
}); |
822 |
} |
850 |
} |
823 |
} |
851 |
} |
824 |
}; |
852 |
}; |
Lines 838-847
Link Here
|
838 |
|
866 |
|
839 |
/** Refresh the list of displayed plugins. If refresh is true, refresh the list from the plugin manager, otherwise just refilter list */ |
867 |
/** Refresh the list of displayed plugins. If refresh is true, refresh the list from the plugin manager, otherwise just refilter list */ |
840 |
private void refreshRepositoryList(final String filter, final boolean refresh, final JList list, final boolean local) { |
868 |
private void refreshRepositoryList(final String filter, final boolean refresh, final JList list, final boolean local) { |
|
|
869 |
assert SwingUtilities.isEventDispatchThread(); |
870 |
|
841 |
Runnable runner = new Runnable() { |
871 |
Runnable runner = new Runnable() { |
842 |
public void run() { |
872 |
public void run() { |
843 |
synchronized(this) { |
873 |
synchronized(this) { |
844 |
DefaultListModel model = new DefaultListModel(); |
874 |
final DefaultListModel model = new DefaultListModel(); |
845 |
List<String> lines = new ArrayList<String>(500); |
875 |
List<String> lines = new ArrayList<String>(500); |
846 |
List<String> repositories; |
876 |
List<String> repositories; |
847 |
if (local) { |
877 |
if (local) { |
Lines 888-900
Link Here
|
888 |
model.addElement("<html><span color=\"red\">" + line + "</span></html>"); // NOI18N |
918 |
model.addElement("<html><span color=\"red\">" + line + "</span></html>"); // NOI18N |
889 |
} |
919 |
} |
890 |
} |
920 |
} |
891 |
list.clearSelection(); |
921 |
final int repositoryCount = repositories.size(); |
892 |
list.setModel(model); |
922 |
|
893 |
list.invalidate(); |
923 |
SwingUtilities.invokeLater(new Runnable() { |
894 |
list.repaint(); |
924 |
public void run() { |
895 |
if (repositories.size() > 0) { |
925 |
list.clearSelection(); |
896 |
list.setSelectedIndex(0); |
926 |
list.setModel(model); |
897 |
} |
927 |
list.invalidate(); |
|
|
928 |
list.repaint(); |
929 |
if (repositoryCount > 0) { |
930 |
list.setSelectedIndex(0); |
931 |
} |
932 |
} |
933 |
}); |
898 |
} |
934 |
} |
899 |
} |
935 |
} |
900 |
}; |
936 |
}; |
Lines 910-917
Link Here
|
910 |
} |
946 |
} |
911 |
} |
947 |
} |
912 |
|
948 |
|
913 |
|
|
|
914 |
private String getRepositoryFilter(boolean local) { |
949 |
private String getRepositoryFilter(boolean local) { |
|
|
950 |
assert SwingUtilities.isEventDispatchThread(); |
951 |
|
915 |
String filter = null; |
952 |
String filter = null; |
916 |
if (local) { |
953 |
if (local) { |
917 |
filter = searchReposText.getText().trim(); |
954 |
filter = searchReposText.getText().trim(); |
Lines 924-929
Link Here
|
924 |
} |
961 |
} |
925 |
|
962 |
|
926 |
private String getPluginFilter(boolean local) { |
963 |
private String getPluginFilter(boolean local) { |
|
|
964 |
assert SwingUtilities.isEventDispatchThread(); |
965 |
|
927 |
String filter = null; |
966 |
String filter = null; |
928 |
JTextField tf = local ? instSearchText : searchNewText; |
967 |
JTextField tf = local ? instSearchText : searchNewText; |
929 |
filter = tf.getText().trim(); |
968 |
filter = tf.getText().trim(); |
Lines 944-949
Link Here
|
944 |
} |
983 |
} |
945 |
|
984 |
|
946 |
public void run() { |
985 |
public void run() { |
|
|
986 |
if (!SwingUtilities.isEventDispatchThread()) { |
987 |
SwingUtilities.invokeLater(this); |
988 |
return; |
989 |
} |
947 |
refreshPluginList(getPluginFilter(local), true, list, local); |
990 |
refreshPluginList(getPluginFilter(local), true, list, local); |
948 |
if (list == newList) { |
991 |
if (list == newList) { |
949 |
newModified = false; |
992 |
newModified = false; |
Lines 964-969
Link Here
|
964 |
} |
1007 |
} |
965 |
|
1008 |
|
966 |
public void run() { |
1009 |
public void run() { |
|
|
1010 |
if (!SwingUtilities.isEventDispatchThread()) { |
1011 |
SwingUtilities.invokeLater(this); |
1012 |
return; |
1013 |
} |
967 |
refreshRepositoryList(getRepositoryFilter(local), true, list, local); |
1014 |
refreshRepositoryList(getRepositoryFilter(local), true, list, local); |
968 |
if (list == repositoryList) { |
1015 |
if (list == repositoryList) { |
969 |
repositoriesModified = false; |
1016 |
repositoriesModified = false; |