JBoss Tools SVN: r38255 - trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-01-27 16:25:20 -0500 (Fri, 27 Jan 2012)
New Revision: 38255
Modified:
trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF
Log:
set version range [2.3.0,3.0.0) instead of just 2.3.0 (JBIDE-10742)
Modified: trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF 2012-01-27 21:15:14 UTC (rev 38254)
+++ trunk/gwt/plugins/org.jboss.tools.gwt.core/META-INF/MANIFEST.MF 2012-01-27 21:25:20 UTC (rev 38255)
@@ -8,7 +8,7 @@
Require-Bundle:
org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
com.google.gwt.eclipse.core,
- com.google.gwt.eclipse.sdkbundle;bundle-version="2.3.0",
+ com.google.gwt.eclipse.sdkbundle;bundle-version="[2.3.0,3.0.0)",
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.0,2.0.0)",
org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)",
12 years, 12 months
JBoss Tools SVN: r38254 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-27 16:15:14 -0500 (Fri, 27 Jan 2012)
New Revision: 38254
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
Log:
JBIDE-10739
https://issues.jboss.org/browse/JBIDE-10739
Method EclipseResourceUtil.getFirstWebContentResource() should just take first existing element of array returned by getWebRootFolders; even if that fails, it should not try another logic.
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2012-01-27 21:08:52 UTC (rev 38253)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2012-01-27 21:15:14 UTC (rev 38254)
@@ -455,16 +455,12 @@
IVirtualComponent vc = ComponentCore.createComponent(project);
if (vc == null || vc.getRootFolder() == null)
return null;
- IPath path = WebUtils.getFirstWebContentPath(project);
- if(path != null) {
- IFolder f = ResourcesPlugin.getWorkspace().getRoot().getFolder(path);
- if(f.exists()) {
- return f;
+ IContainer[] cs = WebUtils.getWebRootFolders(project, true);
+ for (IContainer c: cs) {
+ if(c.exists()) {
+ return c;
}
}
- if (ModuleCoreNature.isFlexibleProject(project)) {
- return vc.getRootFolder().getUnderlyingResource();
- }
return null;
}
12 years, 12 months
JBoss Tools SVN: r38253 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-27 16:08:52 -0500 (Fri, 27 Jan 2012)
New Revision: 38253
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
Log:
JBIDE-10739
https://issues.jboss.org/browse/JBIDE-10739
Method WebUtils.getFirstWebContentPath() should just take first existing element of array returned by getWebRootFolders; even if that fails, it should not try another logic.
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java 2012-01-27 20:21:57 UTC (rev 38252)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/web/WebUtils.java 2012-01-27 21:08:52 UTC (rev 38253)
@@ -79,10 +79,6 @@
return c.getFullPath();
}
}
- if (ModuleCoreNature.isFlexibleProject(project)) {
- modulePath = vc.getRootFolder().getWorkspaceRelativePath();
- }
-
return modulePath;
}
12 years, 12 months
JBoss Tools SVN: r38252 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-27 15:21:57 -0500 (Fri, 27 Jan 2012)
New Revision: 38252
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java
Log:
JBIDE-10739
https://issues.jboss.org/browse/JBIDE-10739
Web content of project may be its root location, avoid request project.getFolder("/"), it results in illegal argument exception.
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java 2012-01-27 20:04:05 UTC (rev 38251)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ResourceUtil.java 2012-01-27 20:21:57 UTC (rev 38252)
@@ -264,9 +264,7 @@
IContainer[] folders = WebUtils.getWebRootFolders(project);
if(folders == null || folders.length == 0)
return null;
- IFolder webFolder = ResourcesPlugin.getWorkspace().getRoot()
- .getFolder(folders[0].getFullPath());
- IFolder resourcesFolder = webFolder.getFolder("resources"); //$NON-NLS-1$
+ IFolder resourcesFolder = folders[0].getFolder(new Path("resources")); //$NON-NLS-1$
NullProgressMonitor monitor = new NullProgressMonitor();
if (!resourcesFolder.exists()) {
resourcesFolder.create(true, true, monitor);
12 years, 12 months
JBoss Tools SVN: r38251 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-27 15:04:05 -0500 (Fri, 27 Jan 2012)
New Revision: 38251
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/SearchUtil.java
Log:
JBIDE-10739
https://issues.jboss.org/browse/JBIDE-10739
Web content of project may be its root location, avoid request project.getFolder("/"), it results in illegal argument exception.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2012-01-27 19:45:37 UTC (rev 38250)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2012-01-27 20:04:05 UTC (rev 38251)
@@ -159,7 +159,7 @@
IPath path = ProjectHome.getFirstWebContentPath(project);
if(path != null)
- return project.getFolder(path.removeFirstSegments(1));
+ return path.segmentCount() > 1 ? project.getFolder(path.removeFirstSegments(1)) : project;
return null;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/SearchUtil.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/SearchUtil.java 2012-01-27 19:45:37 UTC (rev 38250)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/SearchUtil.java 2012-01-27 20:04:05 UTC (rev 38251)
@@ -129,7 +129,7 @@
IPath path = ProjectHome.getFirstWebContentPath(project);
if(path != null)
- return project.getFolder(path.removeFirstSegments(1));
+ return path.segmentCount() > 1 ? project.getFolder(path.removeFirstSegments(1)) : project;
return null;
}
12 years, 12 months
JBoss Tools SVN: r38250 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-27 14:45:37 -0500 (Fri, 27 Jan 2012)
New Revision: 38250
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
Log:
[JBIDE-10724] open external browser when link in property table is clicked
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java 2012-01-27 19:36:09 UTC (rev 38249)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java 2012-01-27 19:45:37 UTC (rev 38250)
@@ -12,8 +12,12 @@
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Tree;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.TreeUtils;
/**
@@ -30,10 +34,23 @@
}
}
- private void createLink(IProperty property, final ViewerCell cell) {
+ protected void createLink(IProperty property, final ViewerCell cell) {
Link link = new Link((Tree) cell.getControl(), SWT.NONE);
- link.setText("<a>" + property.getValue() +"</a>");
+ link.setText("<a>" + property.getValue() + "</a>");
link.setBackground(cell.getBackground());
+ link.addMouseListener(onLinkClicked(property.getValue()));
+
TreeUtils.createTreeEditor(link, property.getValue(), cell);
}
+
+ protected MouseAdapter onLinkClicked(final String url) {
+ return new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ BrowserUtil.checkedCreateExternalBrowser(
+ url, OpenShiftUIActivator.PLUGIN_ID, OpenShiftUIActivator.getDefault().getLog());
+ }
+ };
+ }
}
12 years, 12 months
JBoss Tools SVN: r38249 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-27 14:36:09 -0500 (Fri, 27 Jan 2012)
New Revision: 38249
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java
Log:
JBIDE-10739
https://issues.jboss.org/browse/JBIDE-10739
Web content of project may be its root location, avoid request project.getFolder("/"), it results in illegal argument exception.
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java 2012-01-27 18:28:47 UTC (rev 38248)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java 2012-01-27 19:36:09 UTC (rev 38249)
@@ -43,7 +43,7 @@
IPath path = ProjectHome.getFirstWebContentPath(project);
if(path != null)
- return project.getFolder(path.removeFirstSegments(1));
+ return path.segmentCount() > 1 ? project.getFolder(path.removeFirstSegments(1)) : project;
return null;
}
12 years, 12 months
JBoss Tools SVN: r38248 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-27 13:28:47 -0500 (Fri, 27 Jan 2012)
New Revision: 38248
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java
Log:
fixed org.jboss.tools.seam.ui.test.jbide.JBide3989Test failure
https://issues.jboss.org/browse/JBIDE-10731
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java 2012-01-27 18:19:15 UTC (rev 38247)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/jbide/JBide3989Test.java 2012-01-27 18:28:47 UTC (rev 38248)
@@ -50,8 +50,8 @@
TestProjectProvider provider = new TestProjectProvider(
"org.jboss.tools.seam.ui.test", null, PROJECT_NAME, makeCopy);
project = provider.getProject();
-// ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
-// seamProject.setRuntimeName("UNKNOWN");
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
+ seamProject.setRuntimeName("UNKNOWN");
ValidatorManager.addProjectBuildValidationSupport(project);
// JBIDE-4832 - call SeamProjectPropertyValidator manually
project.build(IncrementalProjectBuilder.FULL_BUILD,
12 years, 12 months
JBoss Tools SVN: r38247 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-27 13:19:15 -0500 (Fri, 27 Jan 2012)
New Revision: 38247
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java
Log:
[JBIDE-10724] corrected javadoc in TreeUtils
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java 2012-01-27 18:16:53 UTC (rev 38246)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java 2012-01-27 18:19:15 UTC (rev 38247)
@@ -13,7 +13,6 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.custom.TreeEditor;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
@@ -53,14 +52,14 @@
}
/**
- * Initializes a given table editor for a given viewer cell with a given (editor-)control.
+ * Initializes a given tree editor for a given viewer cell with a given (editor-)control.
*
- * @param treeEditor the table editor
- * @param control the control
- * @param cellText the cell text
- * @param cell the cell
+ * @param treeEditor the tree editor that shall get initialized
+ * @param control the control that shall be positioned by the tree editor
+ * @param cellText the text that will get displayed in the cell (only used to make sure, the cell has the required size)
+ * @param cell the cell the table editor shall be positioned to.
*
- * @see TableEditor
+ * @see TreeEditor
* @see ViewerCell
*/
public static void initializeTreeEditor( TreeEditor treeEditor, Control control, String cellText, ViewerCell cell )
12 years, 12 months
JBoss Tools SVN: r38246 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: propertytable and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-27 13:16:53 -0500 (Fri, 27 Jan 2012)
New Revision: 38246
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyTableContentProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/ContainerElement.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/IProperty.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/LinkElement.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyNameCellLabelProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/StringElement.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsContentProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
Log:
[JBIDE-10724] extracted property table to its own packge (for later reuse). Used TreeEditor to put a link on top of the url to be able to handle clicks on the web url
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ViewerCell;
+
+/**
+ * @author Xavier Coulon
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractPropertyCellLabelProvider extends CellLabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ if (cell.getElement() instanceof IProperty) {
+ update((IProperty) cell.getElement(), cell);
+ }
+ }
+
+ abstract protected void update(IProperty property, ViewerCell cell);
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyCellLabelProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyTableContentProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyTableContentProvider.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyTableContentProvider.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,48 @@
+/**
+ *
+ */
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * @author Xavier Coulon
+ * @author Andre Dietisheim
+ *
+ */
+public abstract class AbstractPropertyTableContentProvider implements ITreeContentProvider {
+
+ @Override
+ public abstract Object[] getElements(Object inputElement);
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (!hasChildren(parentElement)) {
+ return new Object[0];
+ }
+ return ((IProperty) parentElement).getChildren();
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof IProperty) {
+ return ((IProperty) element).getParent();
+ }
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ return element instanceof IProperty
+ && ((IProperty) element).hasChildren();
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/AbstractPropertyTableContentProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/ContainerElement.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/ContainerElement.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/ContainerElement.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ContainerElement implements IProperty {
+
+ private final String property;
+ private final List<Object> children;
+ private final ContainerElement parent;
+
+ public ContainerElement(String property, ContainerElement parent) {
+ this.property = property;
+ this.children = new ArrayList<Object>();
+ this.parent = parent;
+ }
+
+ public final String getProperty() {
+ return property;
+ }
+
+ public final void add(StringElement child) {
+ children.add(child);
+ }
+
+ public final void add(ContainerElement child) {
+ children.add(child);
+ }
+
+ public final Object[] getChildren() {
+ return children.toArray();
+ }
+
+ public boolean hasChildren() {
+ return !children.isEmpty();
+ }
+
+ public final ContainerElement getParent() {
+ return parent;
+ }
+
+ public boolean isLink() {
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return property;
+ }
+
+ @Override
+ public String getValue() {
+ return null;
+ }
+ }
\ No newline at end of file
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/ContainerElement.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/IProperty.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/IProperty.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/IProperty.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+public interface IProperty {
+
+ public String getName();
+
+ public String getValue();
+
+ public ContainerElement getParent();
+
+ public boolean isLink();
+
+ public boolean hasChildren();
+
+ public Object[] getChildren();
+}
\ No newline at end of file
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/IProperty.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/LinkElement.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/LinkElement.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/LinkElement.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+class LinkElement extends StringElement {
+
+ public LinkElement(String property, String value, ContainerElement parent) {
+ super(property, value, true, parent);
+ }
+}
\ No newline at end of file
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/LinkElement.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyNameCellLabelProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyNameCellLabelProvider.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyNameCellLabelProvider.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+import org.eclipse.jface.viewers.ViewerCell;
+
+/**
+ * @author Xavier Coulon
+ * @author Andre Dietisheim
+ */
+public class PropertyNameCellLabelProvider extends AbstractPropertyCellLabelProvider {
+
+ protected void update(IProperty property, ViewerCell cell) {
+ cell.setText(property.getName());
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyNameCellLabelProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Tree;
+import org.jboss.tools.openshift.express.internal.ui.utils.TreeUtils;
+
+/**
+ * @author Xavier Coulon
+ * @author Andre Dietisheim
+ */
+public class PropertyValueCellLabelProvider extends AbstractPropertyCellLabelProvider {
+
+ protected void update(IProperty property, ViewerCell cell) {
+ if (property.isLink()) {
+ createLink(property, cell);
+ } else {
+ cell.setText(property.getValue());
+ }
+ }
+
+ private void createLink(IProperty property, final ViewerCell cell) {
+ Link link = new Link((Tree) cell.getControl(), SWT.NONE);
+ link.setText("<a>" + property.getValue() +"</a>");
+ link.setBackground(cell.getBackground());
+ TreeUtils.createTreeEditor(link, property.getValue(), cell);
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/PropertyValueCellLabelProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/StringElement.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/StringElement.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/StringElement.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.propertytable;
+
+public class StringElement extends ContainerElement {
+
+ private final String value;
+ private final boolean isLink;
+
+ public StringElement(String property, String value, ContainerElement parent) {
+ this(property, value, false, parent);
+ }
+
+ public StringElement(String property, String value, boolean isLink, ContainerElement parent) {
+ super(property, parent);
+ this.value = value;
+ this.isLink = isLink;
+ }
+
+ public final String getValue() {
+ return value;
+ }
+
+ public boolean isLink() {
+ return isLink;
+ }
+}
\ No newline at end of file
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/propertytable/StringElement.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.TableEditor;
+import org.eclipse.swt.custom.TreeEditor;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * @author André Dietisheim
+ */
+public class TreeUtils {
+
+ /**
+ * Creates a tree editor for the given cell with the given control.
+ * <p>
+ * A tree editor puts a control over a given cell in a tree. Furthermore it puts text into the cell so that the
+ * column's large enough so that the control has enough room to overlay itself over it
+ *
+ * @param cell the cell to put the control to
+ * @param control the control to put to the given cell
+ * @param cellText the text that's put into the table cell (overlayed by the editor), that only enlarges the
+ * column to have enough room for the editor
+ *
+ * @return the tree editor
+ *
+ * @see ViewerCell
+ * @see TreeEditor
+ */
+ public static TreeEditor createTreeEditor( Control control, String cellText, ViewerCell cell )
+ {
+ Assert.isTrue(cell.getControl() instanceof Tree);
+
+ Tree tree = ( Tree ) cell.getControl();
+ TreeEditor treeEditor = new TreeEditor( tree );
+ initializeTreeEditor( treeEditor, control, cellText, cell );
+ return treeEditor;
+ }
+
+ /**
+ * Initializes a given table editor for a given viewer cell with a given (editor-)control.
+ *
+ * @param treeEditor the table editor
+ * @param control the control
+ * @param cellText the cell text
+ * @param cell the cell
+ *
+ * @see TableEditor
+ * @see ViewerCell
+ */
+ public static void initializeTreeEditor( TreeEditor treeEditor, Control control, String cellText, ViewerCell cell )
+ {
+ treeEditor.grabHorizontal = true;
+ treeEditor.grabVertical = true;
+ treeEditor.horizontalAlignment = SWT.CENTER;
+ treeEditor.verticalAlignment = SWT.CENTER;
+ TreeItem treeItem = ( TreeItem ) cell.getItem();
+ treeEditor.setEditor( control, treeItem, cell.getColumnIndex() );
+ // ensure cell is as large as space needed for link
+ cell.setText( " " + cellText + " ");
+ }
+
+ /**
+ * Sets the height of the rows in a given table. The height might only be increased (compared to the standard
+ * height). Decreasing it below the default height has no effect.
+ *
+ * @param height the height in pixels
+ * @param table the table
+ */
+ public static void setRowHeight( final int height, Tree tree )
+ {
+ tree.addListener( SWT.MeasureItem, new Listener()
+ {
+ public void handleEvent( Event event )
+ {
+ event.height = height;
+ }
+ } );
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/TreeUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsContentProvider.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsContentProvider.java 2012-01-27 17:30:19 UTC (rev 38245)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsContentProvider.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -4,11 +4,10 @@
package org.jboss.tools.openshift.express.internal.ui.wizard;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
+import org.jboss.tools.openshift.express.internal.ui.propertytable.AbstractPropertyTableContentProvider;
+import org.jboss.tools.openshift.express.internal.ui.propertytable.ContainerElement;
+import org.jboss.tools.openshift.express.internal.ui.propertytable.StringElement;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import com.openshift.express.client.IApplication;
@@ -17,170 +16,44 @@
/**
* @author Xavier Coulon
+ * @author Andre Dietisheim
*
*/
-public class ApplicationDetailsContentProvider implements ITreeContentProvider {
+public class ApplicationDetailsContentProvider extends AbstractPropertyTableContentProvider {
- private IApplication application;
-
@Override
public Object[] getElements(Object inputElement) {
+ Object[] elements = null;
if (inputElement instanceof IApplication) {
try {
- final SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd 'at' HH:mm:ss");
+ IApplication application = (IApplication) inputElement;
final ContainerElement infoContainer = new ContainerElement("info", null);
- infoContainer.add(new SimpleElement("Name", application.getName(), infoContainer));
- infoContainer.add(new SimpleElement("Public URL", application.getApplicationUrl().toString(), true,
+ infoContainer.add(new StringElement("Name", application.getName(), infoContainer));
+ infoContainer.add(new StringElement("Public URL", application.getApplicationUrl().toString(), true,
infoContainer));
- infoContainer.add(new SimpleElement("Type", application.getCartridge().getName(), infoContainer));
- infoContainer.add(new SimpleElement("Created on", format.format(application.getCreationTime()),
- infoContainer));
- infoContainer.add(new SimpleElement("UUID", application.getUUID(), infoContainer));
- infoContainer.add(new SimpleElement("Git URL", application.getGitUri(), infoContainer));
- final ContainerElement cartridgesContainer = new ContainerElement("Cartridges", infoContainer);
- infoContainer.add(cartridgesContainer);
- for (IEmbeddableCartridge cartridge : application.getEmbeddedCartridges()) {
- cartridgesContainer.add(new SimpleElement(cartridge.getName(), cartridge.getUrl().toString(), true,
- cartridgesContainer));
- }
- return new Object[] { infoContainer };
- } catch (OpenShiftException e) {
+ infoContainer.add(new StringElement("Type", application.getCartridge().getName(), infoContainer));
+ final SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd 'at' HH:mm:ss");
+ infoContainer.add(
+ new StringElement("Created on", format.format(application.getCreationTime()), infoContainer));
+ infoContainer.add(new StringElement("UUID", application.getUUID(), infoContainer));
+ infoContainer.add(new StringElement("Git URL", application.getGitUri(), infoContainer));
+ infoContainer.add(createCartridges(application, infoContainer));
+ elements = new Object[] { infoContainer };
+ } catch (Exception e) {
Logger.error("Failed to display details for OpenShift application", e);
}
}
- return null;
+ return elements;
}
- @Override
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof ContainerElement) {
- return ((ContainerElement) parentElement).getChildren();
+ private ContainerElement createCartridges(IApplication application, ContainerElement infoContainer)
+ throws OpenShiftException {
+ ContainerElement cartridgesContainer = new ContainerElement("Cartridges", infoContainer);
+ for (IEmbeddableCartridge cartridge : application.getEmbeddedCartridges()) {
+ cartridgesContainer.add(
+ new StringElement(cartridge.getName(), cartridge.getUrl().toString(), true,
+ cartridgesContainer));
}
- return new Object[0];
+ return cartridgesContainer;
}
-
- @Override
- public Object getParent(Object element) {
- if (element instanceof SimpleElement) {
- return ((SimpleElement) element).getParent();
- } else if (element instanceof ContainerElement) {
- return ((ContainerElement) element).getParent();
- }
- return null;
- }
-
- @Override
- public boolean hasChildren(Object element) {
- return (element instanceof ContainerElement);
- }
-
- @Override
- public void dispose() {
-
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof IApplication) {
- this.application = (IApplication) newInput;
- } else {
- this.application = null;
- }
-
- }
-
- static class SimpleElement {
-
- private final String property;
- private final String value;
- private final ContainerElement parent;
- private final boolean isLink;
-
- public SimpleElement(String property, String value, ContainerElement parent) {
- super();
- this.property = property;
- this.value = value;
- this.parent = parent;
- this.isLink = false;
- }
-
- public SimpleElement(String property, String value, boolean isLink, ContainerElement parent) {
- super();
- this.property = property;
- this.value = value;
- this.parent = parent;
- this.isLink = isLink;
- }
-
- /**
- * @return the property
- */
- public final String getProperty() {
- return property;
- }
-
- /**
- * @return the value
- */
- public final String getValue() {
- return value;
- }
-
- /**
- * @return the parent container
- */
- public final ContainerElement getParent() {
- return parent;
- }
-
- /**
- * @return the isLink
- */
- public boolean isLink() {
- return isLink;
- }
- }
-
- static class ContainerElement {
-
- private final String property;
- private final List<Object> children;
- private final ContainerElement parent;
-
- public ContainerElement(String property, ContainerElement parent) {
- this.property = property;
- this.children = new ArrayList<Object>();
- this.parent = parent;
- }
-
- /**
- * @return the property
- */
- public final String getProperty() {
- return property;
- }
-
- public final void add(SimpleElement child) {
- children.add(child);
- }
-
- public final void add(ContainerElement child) {
- children.add(child);
- }
-
- /**
- * @return the value
- */
- public final Object[] getChildren() {
- return children.toArray();
- }
-
- /**
- * @return the parent container
- */
- public final ContainerElement getParent() {
- return parent;
- }
- }
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2012-01-27 17:30:19 UTC (rev 38245)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationDetailsDialog.java 2012-01-27 18:16:53 UTC (rev 38246)
@@ -10,9 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import java.util.concurrent.Callable;
-
-import org.eclipse.core.runtime.ILog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.layout.GridDataFactory;
@@ -20,33 +17,24 @@
import org.eclipse.jface.layout.TreeColumnLayout;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.StyledCellLabelProvider;
-import org.eclipse.jface.viewers.StyledString;
-import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
-import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.TextStyle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
-import org.jboss.tools.common.ui.BrowserUtil;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftImages;
-import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.propertytable.PropertyNameCellLabelProvider;
+import org.jboss.tools.openshift.express.internal.ui.propertytable.PropertyValueCellLabelProvider;
import com.openshift.express.client.IApplication;
/**
- * @author Andr� Dietisheim
+ * @author Andre Dietisheim
* @author Xavier Coulon
*/
public class ApplicationDetailsDialog extends TitleAreaDialog {
@@ -74,80 +62,18 @@
Composite dialogArea = new Composite(parent, SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(dialogArea);
- GridLayoutFactory.fillDefaults().margins(6, 6).applyTo(dialogArea);
+ GridLayoutFactory.fillDefaults().margins(10, 10).applyTo(dialogArea);
TreeViewer viewer = createApplicationDetailsTable(dialogArea);
fillApplicationDetailsTable(viewer);
-
+
Label buttonsSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(buttonsSeparator);
- // createDetails("Name:", application.getName(), treeTableContainer);
- // createDetails("Type:", application.getCartridge().getName(),
- // treeTableContainer);
- // createDetails("Embedded Cartridges:", new
- // ErrorMessageCallable<String>("Embedded Cartridges") {
- //
- // @Override
- // public String call() throws Exception {
- // return StringUtils.toString(application.getEmbeddedCartridges(),
- // new StringUtils.ToStringConverter<IEmbeddableCartridge>() {
- //
- // @Override
- // public String toString(IEmbeddableCartridge cartridge) {
- // return cartridge.getName();
- // }
- // });
- // }
- //
- // }.get(), treeTableContainer);
- // createDetails("Creation Time:", new
- // ErrorMessageCallable<String>("Creation Time") {
- //
- // @Override
- // public String call() throws Exception {
- // return RFC822DateUtils.getString(application.getCreationTime());
- // }
- // }.get(), treeTableContainer);
- // createDetails("UUIDxx:", new ErrorMessageCallable<String>("UUID") {
- //
- // @Override
- // public String call() throws Exception {
- // return application.getUUID();
- // }
- // }.get(), treeTableContainer);
- // createDetails("Git URL:", new ErrorMessageCallable<String>("Git URL")
- // {
- //
- // @Override
- // public String call() throws Exception {
- // return application.getGitUri();
- // }
- // }.get(), treeTableContainer);
- //
- // Label publicUrlLabel = new Label(treeTableContainer, SWT.NONE);
- // publicUrlLabel.setText("Public URL:");
- // GridDataFactory.fillDefaults().align(SWT.LEFT,
- // SWT.CENTER).applyTo(publicUrlLabel);
- // Link publicUrlLink = new Link(treeTableContainer, SWT.WRAP);
- // String applicationUrl = new
- // ErrorMessageCallable<String>("Public URL") {
- //
- // @Override
- // public String call() throws Exception {
- // return application.getApplicationUrl();
- // }
- // }.get();
- // publicUrlLink.setText("<a>" + applicationUrl + "</a>");
- // GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
- // false).applyTo(publicUrlLink);
- // publicUrlLink.addSelectionListener(onPublicUrl(applicationUrl));
-
return dialogArea;
}
private void fillApplicationDetailsTable(final TreeViewer viewer) {
- viewer.setContentProvider(new ApplicationDetailsContentProvider());
viewer.setInput(application);
viewer.expandToLevel(2);
}
@@ -156,57 +82,19 @@
Composite tableContainer = new Composite(parent, SWT.NONE);
TreeColumnLayout treeLayout = new TreeColumnLayout();
tableContainer.setLayout(treeLayout);
-
+
Tree tree = new Tree(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
tree.setLinesVisible(true);
tree.setHeaderVisible(true);
-// GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(500, tree.getItemHeight() * 10).applyTo(tableContainer);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).hint(500, 300).applyTo(tableContainer);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.FILL).grab(true, true).hint(500, 300).applyTo(tableContainer);
- TreeViewer viewer = new TreeViewer(tree);
- createTreeColumn("Property", 1, new CellLabelProvider() {
- @Override
- public void update(ViewerCell cell) {
- if (cell.getElement() instanceof ApplicationDetailsContentProvider.SimpleElement) {
- ApplicationDetailsContentProvider.SimpleElement element = (ApplicationDetailsContentProvider.SimpleElement) cell
- .getElement();
- cell.setText(element.getProperty());
- } else if (cell.getElement() instanceof ApplicationDetailsContentProvider.ContainerElement) {
- ApplicationDetailsContentProvider.ContainerElement element = (ApplicationDetailsContentProvider.ContainerElement) cell
- .getElement();
- cell.setText(element.getProperty());
- }
- }
- }, viewer, treeLayout);
+ final TreeViewer viewer = new TreeViewer(tree);
+ viewer.setContentProvider(new ApplicationDetailsContentProvider());
+ createTreeColumn("Property", 1, new PropertyNameCellLabelProvider(), viewer, treeLayout);
+ createTreeColumn("Value", 3, new PropertyValueCellLabelProvider(), viewer, treeLayout);
- createTreeColumn("Value", 3, new StyledCellLabelProvider() {
- @Override
- public void update(ViewerCell cell) {
- if (cell.getElement() instanceof ApplicationDetailsContentProvider.SimpleElement) {
- ApplicationDetailsContentProvider.SimpleElement element = (ApplicationDetailsContentProvider.SimpleElement) cell
- .getElement();
- cell.setText(element.getValue());
- if (element.isLink()) {
- Styler style = new Styler() {
- @Override
- public void applyStyles(TextStyle textStyle) {
- textStyle.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
- textStyle.underline = true;
- }
-
- };
- StyledString styledString = new StyledString(cell.getText(), style);
- cell.setStyleRanges(styledString.getStyleRanges());
- cell.setText(styledString.getString());
- // cell.setCursor(new Cursor(Display.getCurrent(),
- // SWT.CURSOR_HAND));
- }
- }
- }
- }, viewer, treeLayout);
-
return viewer;
-
}
private void createTreeColumn(String name, int weight, CellLabelProvider cellLabelProvider, TreeViewer treeViewer,
@@ -230,47 +118,4 @@
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}
-
- private SelectionAdapter onPublicUrl(final String applicationUrl) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- ILog log = OpenShiftUIActivator.getDefault().getLog();
- BrowserUtil.checkedCreateExternalBrowser(applicationUrl, OpenShiftUIActivator.PLUGIN_ID, log);
- }
- };
- }
-
- private void createDetails(String name, String value, Composite container) {
- Label label = new Label(container, SWT.None);
- label.setText(name);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(label);
- Text text = new Text(container, SWT.NONE);
- text.setEditable(false);
- text.setBackground(container.getBackground());
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(text);
- text.setText(value);
- }
-
- private abstract class ErrorMessageCallable<T> implements Callable<T> {
-
- private String fieldName;
-
- public ErrorMessageCallable(String fieldName) {
- this.fieldName = fieldName;
- }
-
- public T get() {
- try {
- return call();
- } catch (Exception e) {
- setErrorMessage(NLS.bind("Could not get {0}: {1}", fieldName, e.getMessage()));
- return null;
- }
- }
-
- @Override
- public abstract T call() throws Exception;
- }
}
12 years, 12 months