Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Gheorghe2006-06-01 20:08:17 +0000
committerBogdan Gheorghe2006-06-01 20:08:17 +0000
commite5ce7be952e65c13a7da5c5a1f6bed2e37b20fdf (patch)
treed0b1a2b8a5f51a30abeaa904ad20ea5569e27136 /examples
parentba8f714616270275dcbee36172ee5e3716f7f114 (diff)
downloadeclipse.platform.team-e5ce7be952e65c13a7da5c5a1f6bed2e37b20fdf.tar.gz
eclipse.platform.team-e5ce7be952e65c13a7da5c5a1f6bed2e37b20fdf.tar.xz
eclipse.platform.team-e5ce7be952e65c13a7da5c5a1f6bed2e37b20fdf.zip
Team FileSystem example updateI200606011710
Diffstat (limited to 'examples')
-rw-r--r--examples/org.eclipse.team.examples.filesystem/plugin.xml2
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java19
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemHistory.java2
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java3
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java8
-rw-r--r--examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java27
6 files changed, 32 insertions, 29 deletions
diff --git a/examples/org.eclipse.team.examples.filesystem/plugin.xml b/examples/org.eclipse.team.examples.filesystem/plugin.xml
index 5175365b5..b55f43c83 100644
--- a/examples/org.eclipse.team.examples.filesystem/plugin.xml
+++ b/examples/org.eclipse.team.examples.filesystem/plugin.xml
@@ -217,7 +217,7 @@
<action
class="org.eclipse.team.examples.filesystem.ui.ShowHistoryAction"
id="org.eclipse.team.examples.filesystem.showHistory"
- label="Show History Dude"
+ label="Show History"
menubarPath="team.main/group4">
</action>
</objectContribution>
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java
index 8f4b2526c..829410b12 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/FileSystemPlugin.java
@@ -12,7 +12,11 @@ package org.eclipse.team.examples.filesystem;
import java.io.IOException;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPluginDescriptor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.TeamException;
import org.eclipse.team.examples.pessimistic.PessimisticFilesystemProviderPlugin;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -96,5 +100,18 @@ public class FileSystemPlugin extends AbstractUIPlugin {
public static void log(IStatus status) {
plugin.getLog().log(status);
}
+
+ /**
+ * Returns the standard display to be used. The method first checks, if
+ * the thread calling this method has an associated display. If so, this
+ * display is returned. Otherwise the method returns the default display.
+ */
+ public static Display getStandardDisplay() {
+ Display display= Display.getCurrent();
+ if (display == null) {
+ display= Display.getDefault();
+ }
+ return display;
+ }
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemHistory.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemHistory.java
index 918b9602e..466116647 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemHistory.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/history/FileSystemHistory.java
@@ -52,6 +52,8 @@ public class FileSystemHistory extends FileHistory {
revisions = new IFileRevision[states.length + 1];
int i = 0;
for (; i < states.length; i++) {
+ //Note: LocalFileRevision will most likely be made
+ //public API post 3.2
revisions[i] = new LocalFileRevision(states[i]);
}
revisions[i] = new FileSystemFileRevision(javaFile);
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
index 9cf2e8323..738aabc71 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/FileSystemHistoryPage.java
@@ -68,6 +68,8 @@ public class FileSystemHistoryPage extends HistoryPage {
if (fileHistory != null && !shutdown) {
fileHistory.refresh(monitor);
+ //Internal code used for convenience - you can use
+ //your own here
Utils.asyncExec(new Runnable() {
public void run() {
tableViewer.setInput(fileHistory);
@@ -223,6 +225,7 @@ public class FileSystemHistoryPage extends HistoryPage {
}
refreshFileHistoryJob.setFileHistory(fileSystemHistory);
IHistoryPageSite parentSite = getHistoryPageSite();
+ //Internal code used for convenience - you can use your own here
Utils.schedule(refreshFileHistoryJob, getWorkbenchSite(parentSite));
}
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
index c16e665fa..6752e9e4b 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/OpenFileSystemRevisionAction.java
@@ -15,8 +15,6 @@ import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.examples.filesystem.FileSystemPlugin;
-import org.eclipse.team.internal.ui.history.AbstractHistoryCategory;
-import org.eclipse.team.internal.ui.history.FileRevisionEditorInput;
import org.eclipse.team.ui.history.HistoryPage;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorPart;
@@ -124,10 +122,6 @@ public class OpenFileSystemRevisionAction extends BaseSelectionListenerAction {
return false;
for (int i = 0; i < objArray.length; i++) {
- //Don't bother showing if this a category
- if (objArray[i] instanceof AbstractHistoryCategory)
- return false;
-
IFileRevision revision = (IFileRevision) objArray[i];
//check to see if any of the selected revisions are deleted revisions
if (revision != null && !revision.exists())
@@ -141,7 +135,7 @@ public class OpenFileSystemRevisionAction extends BaseSelectionListenerAction {
IEditorReference[] editorRefs = page.getSite().getPage().getEditorReferences();
for (int i = 0; i < editorRefs.length; i++) {
IEditorPart part = editorRefs[i].getEditor(false);
- if (part != null && part.getEditorInput() instanceof FileRevisionEditorInput) {
+ if (part != null && part.getEditorInput() instanceof FileSystemRevisionEditorInput) {
IFileRevision inputRevision = (IFileRevision) input.getAdapter(IFileRevision.class);
IFileRevision editorRevision = (IFileRevision) part.getEditorInput().getAdapter(IFileRevision.class);
diff --git a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java
index 87045f20b..15dff96a5 100644
--- a/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java
+++ b/examples/org.eclipse.team.examples.filesystem/src/org/eclipse/team/examples/filesystem/ui/ShowHistoryAction.java
@@ -4,29 +4,23 @@ import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.team.internal.ui.TeamUIMessages;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.history.GenericHistoryView;
+import org.eclipse.team.examples.filesystem.FileSystemPlugin;
+import org.eclipse.team.ui.TeamUI;
+import org.eclipse.team.ui.history.IHistoryView;
import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.ActionDelegate;
public class ShowHistoryAction extends ActionDelegate implements IObjectActionDelegate {
private IStructuredSelection fSelection;
- private IWorkbenchPart targetPart;
public void run(IAction action) {
final Shell shell = Display.getDefault().getActiveShell();
@@ -36,22 +30,15 @@ public class ShowHistoryAction extends ActionDelegate implements IObjectActionDe
final IResource resource = (IResource) fSelection.getFirstElement();
Runnable r = new Runnable() {
public void run() {
- try {
- IViewPart view = targetPart.getSite().getPage().showView("org.eclipse.team.ui.GenericHistoryView"); //$NON-NLS-1$
- if (view instanceof GenericHistoryView) {
- GenericHistoryView historyView = (GenericHistoryView) view;
- historyView.itemDropped(resource, true);
- }
- } catch (PartInitException e) {
- }
+ IHistoryView view = TeamUI.getHistoryView();
+ view.showHistoryFor(resource);
}
};
- TeamUIPlugin.getStandardDisplay().asyncExec(r);
+ FileSystemPlugin.getStandardDisplay().asyncExec(r);
}
});
} catch (InvocationTargetException exception) {
- ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException()));
} catch (InterruptedException exception) {
}
}
@@ -63,6 +50,6 @@ public class ShowHistoryAction extends ActionDelegate implements IObjectActionDe
}
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.targetPart = targetPart;
+
}
}

Back to the top