Author: fmancinelli
Date: 2007-10-30 18:08:17 +0100 (Tue, 30 Oct 2007)
New Revision: 5573
Added:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/icons/connection-settings-banner.png
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/handlers/RemoveConnectionHandler.java
Removed:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/icons/connection-settings-banner.gif
Modified:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/plugin.xml
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/XWikiEclipseConstants.java
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/views/XWikiExplorerView.java
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/ConnectionSettingsPage.java
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/NewConnectionWizard.java
Log:
XECLIPSE-30
* Added connection removal.
* XWikiConnections are directly connected when created
Deleted:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/icons/connection-settings-banner.gif
===================================================================
(Binary files differ)
Added:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/icons/connection-settings-banner.png
===================================================================
(Binary files differ)
Property changes on:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/icons/connection-settings-banner.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/plugin.xml
===================================================================
--- xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/plugin.xml
2007-10-30 16:03:52 UTC (rev 5572)
+++ xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/plugin.xml
2007-10-30 17:08:17 UTC (rev 5573)
@@ -85,6 +85,10 @@
id="org.xwiki.xeclipse.command.NewConnection"
name="New connection">
</command>
+ <command
+ id="org.xwiki.xeclipse.command.RemoveConnection"
+ name="Remove connection">
+ </command>
</extension>
<extension
name="NEW ADAPTERS"
Modified:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/XWikiEclipseConstants.java
===================================================================
---
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/XWikiEclipseConstants.java
2007-10-30 16:03:52 UTC (rev 5572)
+++
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/XWikiEclipseConstants.java
2007-10-30 17:08:17 UTC (rev 5573)
@@ -5,8 +5,10 @@
public static final Object[] NO_OBJECTS = new Object[0];
public static final String CONNECT_COMMAND =
"org.xwiki.xeclipse.command.Connect";
public static final String DISCONNECT_COMMAND =
"org.xwiki.xeclipse.command.Disconnect";
+ public static final String REMOVE_CONNECTION_COMMAND =
"org.xwiki.xeclipse.command.RemoveConnection";
public static final String NEW_CONNECTION_COMMAND =
"org.xwiki.xeclipse.command.NewConnection";
public static final String CONNECTION_SETTINGS_BANNER =
"icons/connection-settings-banner.png";
- public static final String XWIKI_ICON = "icons/xwiki.png";
+ public static final String XWIKI_ICON = "icons/xwiki.png";
+
}
Added:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/handlers/RemoveConnectionHandler.java
===================================================================
---
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/handlers/RemoveConnectionHandler.java
(rev 0)
+++
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/handlers/RemoveConnectionHandler.java
2007-10-30 17:08:17 UTC (rev 5573)
@@ -0,0 +1,60 @@
+/*
+ * See the NOTICE file distributed with this work for additional
+ * information regarding copyright ownership.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ *
+ */
+package org.xwiki.xeclipse.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.xwiki.xeclipse.XWikiConnectionManager;
+import org.xwiki.xeclipse.model.IXWikiConnection;
+import org.xwiki.xeclipse.model.XWikiConnectionException;
+import org.xwiki.xeclipse.utils.XWikiEclipseUtil;
+
+public class RemoveConnectionHandler extends AbstractHandler
+{
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException
+ {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+ Object selectedObject =
+
XWikiEclipseUtil.getSingleSelectedObjectInStructuredSelection(selection);
+
+ if (selectedObject instanceof IXWikiConnection) {
+ IXWikiConnection xwikiConnection = (IXWikiConnection)
selectedObject;
+
+ try {
+ if (xwikiConnection.isConnected()) {
+ xwikiConnection.disconnect();
+ }
+ } catch (XWikiConnectionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+
XWikiConnectionManager.getDefault().removeConnection(xwikiConnection);
+ }
+
+ return null;
+ }
+}
Modified:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/views/XWikiExplorerView.java
===================================================================
---
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/views/XWikiExplorerView.java
2007-10-30 16:03:52 UTC (rev 5572)
+++
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/views/XWikiExplorerView.java
2007-10-30 17:08:17 UTC (rev 5573)
@@ -44,6 +44,7 @@
import org.xwiki.xeclipse.XWikiEclipseConstants;
import org.xwiki.xeclipse.handlers.ConnectHandler;
import org.xwiki.xeclipse.handlers.DisconnectHandler;
+import org.xwiki.xeclipse.handlers.RemoveConnectionHandler;
import org.xwiki.xeclipse.model.IXWikiConnection;
import org.xwiki.xeclipse.model.IXWikiConnectionListener;
import org.xwiki.xeclipse.utils.XWikiEclipseUtil;
@@ -71,7 +72,7 @@
private void hookContextMenu()
{
MenuManager menuManager = new MenuManager("#Popup");
-
+
menuManager.add(new CommandContributionItem(getSite(),
null,
XWikiEclipseConstants.CONNECT_COMMAND,
@@ -83,7 +84,7 @@
null,
null,
SWT.NONE));
-
+
menuManager.add(new CommandContributionItem(getSite(),
null,
XWikiEclipseConstants.DISCONNECT_COMMAND,
@@ -95,11 +96,25 @@
null,
null,
SWT.NONE));
-
+
menuManager.add(new Separator());
menuManager.add(new CommandContributionItem(getSite(),
null,
+ XWikiEclipseConstants.REMOVE_CONNECTION_COMMAND,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ SWT.NONE));
+
+ menuManager.add(new Separator());
+
+ menuManager.add(new CommandContributionItem(getSite(),
+ null,
XWikiEclipseConstants.NEW_CONNECTION_COMMAND,
null,
null,
@@ -109,7 +124,7 @@
null,
null,
SWT.NONE));
-
+
Menu menu = menuManager.createContextMenu(treeViewer.getControl());
treeViewer.getControl().setMenu(menu);
}
@@ -147,7 +162,7 @@
}
XWikiConnectionManager.getDefault().removeConnectionManagerListener(this);
-
+
super.dispose();
}
@@ -212,6 +227,31 @@
return EvaluationResult.FALSE;
}
});
+
+
handlerService.activateHandler(XWikiEclipseConstants.REMOVE_CONNECTION_COMMAND,
+ new RemoveConnectionHandler(), new Expression()
+ {
+ @Override
+ public void collectExpressionInfo(ExpressionInfo info)
+ {
+
info.addVariableNameAccess(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ }
+
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context)
throws CoreException
+ {
+ Object selection =
+
context.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
+ Object selectedObject =
+
XWikiEclipseUtil.getSingleSelectedObjectInStructuredSelection(selection);
+
+ if (selectedObject instanceof IXWikiConnection) {
+ return EvaluationResult.TRUE;
+ }
+
+ return EvaluationResult.FALSE;
+ }
+ });
}
public void connectionAdded(IXWikiConnection xwikiConnection)
Modified:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/ConnectionSettingsPage.java
===================================================================
---
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/ConnectionSettingsPage.java
2007-10-30 16:03:52 UTC (rev 5572)
+++
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/ConnectionSettingsPage.java
2007-10-30 17:08:17 UTC (rev 5573)
@@ -74,7 +74,7 @@
Label label = new Label(group, SWT.NONE);
label.setText("Server URL:");
- final Text serverUrlText = new Text(group, SWT.BORDER);
+ final Text serverUrlText = new Text(group, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true,
false).applyTo(serverUrlText);
serverUrlText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e)
@@ -83,6 +83,7 @@
getContainer().updateButtons();
}
});
+ serverUrlText.setText("http://localhost:8080/xwiki/xmlrpc/confluence");
/* Username */
label = new Label(group, SWT.NONE);
Modified:
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/NewConnectionWizard.java
===================================================================
---
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/NewConnectionWizard.java
2007-10-30 16:03:52 UTC (rev 5572)
+++
xwiki-extensions/xwiki-eclipse/trunk/plugins/org.xwiki.eclipse/src/main/java/org/xwiki/xeclipse/wizards/NewConnectionWizard.java
2007-10-30 17:08:17 UTC (rev 5573)
@@ -33,7 +33,6 @@
import org.xwiki.plugins.eclipse.XWikiEclipsePlugin;
import org.xwiki.xeclipse.XWikiConnectionManager;
import org.xwiki.xeclipse.model.IXWikiConnection;
-import org.xwiki.xeclipse.model.XWikiConnectionException;
import org.xwiki.xeclipse.model.XWikiConnectionFactory;
public class NewConnectionWizard extends Wizard implements INewWizard
@@ -73,7 +72,7 @@
} catch (Exception e) {
WizardPage currentPage = (WizardPage)
getContainer().getCurrentPage();
currentPage
- .setErrorMessage("Error connecting to remote XWiki. Please
check out your settings.");
+ .setErrorMessage("Error connecting to remote XWiki. Please
check your settings.");
return false;
}
@@ -81,6 +80,7 @@
try {
IXWikiConnection connection =
XWikiConnectionFactory.createCachedConnection(newConnectionWizardState.getServerUrl(),
newConnectionWizardState.getUserName(), new
File(XWikiEclipsePlugin.getDefault().getStateLocation().toFile(), "cache"));
XWikiConnectionManager.getDefault().addConnection(connection,
newConnectionWizardState.getPassword());
+ connection.connect(newConnectionWizardState.getPassword());
} catch (Exception e) {
e.printStackTrace();
return false;
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications