diff --git a/plugins/ru.runa.gpd/plugin.properties b/plugins/ru.runa.gpd/plugin.properties index c2c4f2900..81bbea861 100644 --- a/plugins/ru.runa.gpd/plugin.properties +++ b/plugins/ru.runa.gpd/plugin.properties @@ -274,7 +274,8 @@ pref.language.bpmn.expandContextButtonPad = Expand context button pad ApplicationWorkbenchWindowAdvisor.window.title=RunaWFE Developer Studio button.choose=Choose -button.ConnectionSettings = Connection settings +button.add.connection.server = Add +button.ConnectionSettings = Configure button.test.connection = Test connection button.add.connection = Add connection button.delete.connection = Delete connection diff --git a/plugins/ru.runa.gpd/plugin_ru.properties b/plugins/ru.runa.gpd/plugin_ru.properties index de37e9fa2..7abcb4297 100644 --- a/plugins/ru.runa.gpd/plugin_ru.properties +++ b/plugins/ru.runa.gpd/plugin_ru.properties @@ -273,7 +273,8 @@ pref.language.bpmn.override = \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u pref.language.bpmn.expandContextButtonPad = \u041f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u044e \u043d\u0430 \u0433\u0440\u0430\u0444\u0435 button.choose=\u0412\u044b\u0431\u0440\u0430\u0442\u044c -button.ConnectionSettings = \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f +button.add.connection.server=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c +button.ConnectionSettings = \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c button.test.connection = \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 button.add.connection = \u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043D\u043E\u0432\u043E\u0435 \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 button.delete.connection = \u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0441\u043E\u0435\u0434\u0438\u043D\u0435\u043D\u0438\u0435 diff --git a/plugins/ru.runa.gpd/src/ru/runa/gpd/sync/WfeServerConnectorComposite.java b/plugins/ru.runa.gpd/src/ru/runa/gpd/sync/WfeServerConnectorComposite.java index c71b44e03..90170e874 100644 --- a/plugins/ru.runa.gpd/src/ru/runa/gpd/sync/WfeServerConnectorComposite.java +++ b/plugins/ru.runa.gpd/src/ru/runa/gpd/sync/WfeServerConnectorComposite.java @@ -13,11 +13,13 @@ import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.ui.forms.events.HyperlinkEvent; import org.eclipse.ui.forms.widgets.Hyperlink; import ru.runa.gpd.Activator; import ru.runa.gpd.Localization; import ru.runa.gpd.settings.PrefConstants; +import ru.runa.gpd.settings.WfeServerConnectorPreferenceNode; import ru.runa.gpd.settings.WfeServerConnectorPreferencePage; import ru.runa.gpd.settings.WfeServerConnectorsPreferenceNode; import ru.runa.gpd.ui.custom.LoggingHyperlinkAdapter; @@ -28,6 +30,7 @@ public class WfeServerConnectorComposite extends Composite { private final WfeServerConnectorDataImporter importer; private final WfeServerConnectorSynchronizationCallback callback; private Combo combo; + private Hyperlink addConnectionLink; private Hyperlink settingsLink; private Hyperlink synchronizeLink; @@ -35,8 +38,10 @@ public WfeServerConnectorComposite(Composite parent, WfeServerConnectorDataImpor super(parent, SWT.NONE); this.importer = importer; this.callback = callback; - setLayout(new GridLayout(3, true)); + setLayout(new GridLayout(4, false)); + createCombo(); + createAddConnectionLink(); createConnectionSettingsLink(); createSynchronizeLink(); } @@ -45,6 +50,7 @@ public WfeServerConnectorComposite(Composite parent, WfeServerConnectorDataImpor public void setEnabled(boolean enabled) { super.setEnabled(enabled); combo.setEnabled(enabled); + addConnectionLink.setEnabled(enabled); settingsLink.setEnabled(enabled); synchronizeLink.setEnabled(enabled && WfeServerConnector.getInstance().isConfigured()); } @@ -79,6 +85,33 @@ protected void onSelection(SelectionEvent e) throws Exception { }); } + private void createAddConnectionLink() { + addConnectionLink = SwtUtils.createLink(this, Localization.getString("button.add.connection.server"), new LoggingHyperlinkAdapter() { + + @Override + protected void onLinkActivated(HyperlinkEvent e) { + getShell().dispose(); + openAddConnectionDialog(); + } + + }); + } + + private void openAddConnectionDialog() { + WfeServerConnectorsPreferenceNode wfeServerConnectorsNode = WfeServerConnectorsPreferenceNode.getInstance(); + IPreferenceNode[] children = wfeServerConnectorsNode.getSubNodes(); + WfeServerConnectorPreferenceNode lastNode = (WfeServerConnectorPreferenceNode) children[children.length - 1]; + WfeServerConnectorPreferenceNode node = new WfeServerConnectorPreferenceNode(lastNode.getIndex() + 1); + wfeServerConnectorsNode.add(node); + wfeServerConnectorsNode.saveIndices(); + WfeServerConnectorSettings connectorSettings = WfeServerConnectorSettings.createDefault(node.getIndex()); + connectorSettings.saveToStore(); + children = wfeServerConnectorsNode.getSubNodes(); + lastNode = (WfeServerConnectorPreferenceNode) children[children.length - 1]; + PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, "gpd.pref.connector.wfe." + lastNode.getIndex(), null, null); + dialog.open(); + } + private void createConnectionSettingsLink() { settingsLink = SwtUtils.createLink(this, Localization.getString("button.ConnectionSettings"), new LoggingHyperlinkAdapter() {