Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
* Used a null shell for the open page dialog
* Added connected/disconnected event firing
* Wrapped disconnect into a safe runner
  • Loading branch information
Fabio Mancinelli committed Oct 3, 2011
1 parent f0374a4 commit ddcd810
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
6 changes: 6 additions & 0 deletions features/org.xwiki.eclipse.feature/.project
Expand Up @@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>
Expand Up @@ -251,6 +251,8 @@ public void connect() throws CoreException, XWikiEclipseStorageException
/* When connected synchronize all the pages and objects */
synchronizePages(new HashSet<String>(pageToStatusMap.keySet()));
synchronizeObjects(new HashSet<String>(objectToStatusMap.keySet()));

NotificationManager.getDefault().fireCoreEvent(CoreEvent.Type.DATA_MANAGER_CONNECTED, this, null);
}

private void synchronizeObjects(Set<String> objectIds) throws XWikiEclipseStorageException
Expand Down Expand Up @@ -294,6 +296,8 @@ public void disconnect()
supportedFunctionalities.clear();
supportedFunctionalities.add(Functionality.OBJECTS);
supportedFunctionalities.add(Functionality.RENAME);

NotificationManager.getDefault().fireCoreEvent(CoreEvent.Type.DATA_MANAGER_DISCONNECTED, this, null);
}

/**
Expand Down
Expand Up @@ -27,11 +27,13 @@
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.handlers.HandlerUtil;
import org.xwiki.eclipse.storage.DataManager;
import org.xwiki.eclipse.ui.utils.UIUtils;
import org.xwiki.eclipse.ui.utils.XWikiEclipseSafeRunnable;

/**
* @version $Id$
Expand All @@ -55,7 +57,14 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException,
{
monitor.beginTask(String.format("Connecting %s", dataManager.getName()),
IProgressMonitor.UNKNOWN);
dataManager.disconnect();
SafeRunner.run(new XWikiEclipseSafeRunnable()
{
public void run() throws Exception
{
dataManager.disconnect();
}
});

monitor.done();
}

Expand Down
Expand Up @@ -67,7 +67,7 @@ public ModelObject execute(ExecutionEvent event) throws ExecutionException
}
}

OpenPageDialog dialog = new OpenPageDialog(HandlerUtil.getActiveShell(event), dataManager);
OpenPageDialog dialog = new OpenPageDialog(null, dataManager);
dialog.open();

if (dialog.getResult() != null) {
Expand Down

0 comments on commit ddcd810

Please sign in to comment.