[jbosstools-commits] JBoss Tools SVN: r43634 - in trunk/runtime/plugins: org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui and 1 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Thu Sep 13 01:32:16 EDT 2012
Author: rob.stryker at jboss.com
Date: 2012-09-13 01:32:15 -0400 (Thu, 13 Sep 2012)
New Revision: 43634
Added:
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimeFilter.java
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java
Log:
JBIDE-12602 to trunk
Added: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimeFilter.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimeFilter.java (rev 0)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimeFilter.java 2012-09-13 05:32:15 UTC (rev 43634)
@@ -0,0 +1,6 @@
+package org.jboss.tools.runtime.core.model;
+
+public interface IDownloadRuntimeFilter {
+ public boolean accepts(DownloadRuntime runtime);
+ public DownloadRuntime[] filter(DownloadRuntime[] runtime);
+}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java 2012-09-13 01:20:47 UTC (rev 43633)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.core/src/org/jboss/tools/runtime/core/model/IDownloadRuntimes.java 2012-09-13 05:32:15 UTC (rev 43634)
@@ -3,6 +3,16 @@
import java.util.HashMap;
public interface IDownloadRuntimes {
+ /**
+ * Should be a ui Shell object
+ */
+ public static final String SHELL = "download.runtimes.shell";
+
+ /**
+ * May be used to limit the number of items showing up in the
+ * download runtime dialog.
+ */
+ public static final String RUNTIME_FILTER = "download.runtimes.filter";
void execute(HashMap<String, Object> data);
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java 2012-09-13 01:20:47 UTC (rev 43633)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/RuntimeUIActivator.java 2012-09-13 05:32:15 UTC (rev 43634)
@@ -190,22 +190,32 @@
return prefs;
}
+ public RuntimeSharedImages getSharedImages() {
+ return RuntimeSharedImages.getDefault();
+ }
+
+ /* These are all deprecated and shouldn't be used */
+ @Deprecated
public List<RuntimeDefinition> getServerDefinitions() {
return RuntimeModelUtil.getRuntimeDefinitions(getModel().getRuntimePaths());
}
+ @Deprecated
public Set<IRuntimeDetector> getRuntimeDetectors() {
return RuntimeCoreActivator.getDefault().getRuntimeDetectors();
}
+ @Deprecated
public static void setTimestamp(RuntimePath[] runtimePaths2) {
RuntimeModelUtil.updateTimestamps(runtimePaths2);
}
+ @Deprecated
public static boolean runtimeCreated(RuntimeDefinition runtimeDefinition) {
return RuntimeModelUtil.verifyRuntimeDefinitionCreated(runtimeDefinition);
}
+ @Deprecated
public static RuntimePath[] getRuntimePaths() {
return getDefault().getModel().getRuntimePaths();
}
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java 2012-09-13 01:20:47 UTC (rev 43633)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimeViewerDialog.java 2012-09-13 05:32:15 UTC (rev 43634)
@@ -12,6 +12,8 @@
import java.util.Arrays;
import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -46,6 +48,7 @@
import org.eclipse.wst.server.ui.wizard.WizardFragment;
import org.jboss.tools.runtime.core.RuntimeCoreActivator;
import org.jboss.tools.runtime.core.model.DownloadRuntime;
+import org.jboss.tools.runtime.core.model.IDownloadRuntimeFilter;
import org.jboss.tools.runtime.ui.dialogs.AutoResizeTableLayout;
/**
@@ -58,12 +61,31 @@
private Map<String, DownloadRuntime> downloadRuntimes;
public DownloadRuntimeViewerDialog(Shell parentShell) {
+ this(parentShell, null);
+ }
+
+ public DownloadRuntimeViewerDialog(Shell parentShell, IDownloadRuntimeFilter filter) {
super(parentShell);
setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER
| SWT.RESIZE | getDefaultOrientation());
- downloadRuntimes = RuntimeCoreActivator.getDefault().getDownloadRuntimes();
+ Map<String, DownloadRuntime> allDownloads = RuntimeCoreActivator.getDefault().getDownloadRuntimes();
+ if( filter == null )
+ downloadRuntimes = RuntimeCoreActivator.getDefault().getDownloadRuntimes();
+ else {
+ Map<String, DownloadRuntime> filtered = new HashMap<String, DownloadRuntime>();
+ Iterator<String> it = allDownloads.keySet().iterator();
+ while(it.hasNext()) {
+ String k = it.next();
+ DownloadRuntime rt = allDownloads.get(k);
+ if( filter.accepts(rt)) {
+ filtered.put(k, rt);
+ }
+ }
+ downloadRuntimes = filtered;
+ }
}
+
@Override
protected Control createDialogArea(Composite parent) {
getShell().setText("Runtimes");
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java 2012-09-13 01:20:47 UTC (rev 43633)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/download/DownloadRuntimes.java 2012-09-13 05:32:15 UTC (rev 43634)
@@ -4,10 +4,11 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.runtime.core.model.IDownloadRuntimeFilter;
import org.jboss.tools.runtime.core.model.IDownloadRuntimes;
public class DownloadRuntimes implements IDownloadRuntimes {
- public static final String SHELL = "download.runtimes.shell";
+ public static final String SHELL = IDownloadRuntimes.SHELL;
public DownloadRuntimes() {
@@ -15,12 +16,13 @@
public void execute(HashMap<String, Object> map) {
Object shell = map.get(SHELL);
Shell shell2 = shell == null ? Display.getDefault().getActiveShell() : ((Shell)shell);
+ Object filter = map.get(IDownloadRuntimes.RUNTIME_FILTER);
// If this has not been accessed before, this may freeze the UI during
// a fetch to the remote path. The call to get the downloadable runtimes
// also fetches from a remote repository location.
// THis should also be done via a display.asynchexec
- DownloadRuntimeViewerDialog dialog = new DownloadRuntimeViewerDialog(shell2);
+ DownloadRuntimeViewerDialog dialog = new DownloadRuntimeViewerDialog(shell2, (IDownloadRuntimeFilter)filter);
dialog.open();
}
More information about the jbosstools-commits
mailing list