Skip to content

Commit

Permalink
[JBIDE-21359] Add build tab to explorer deployment view
Browse files Browse the repository at this point in the history
  • Loading branch information
jcantrill committed Dec 23, 2015
1 parent e891dab commit ae9daa0
Show file tree
Hide file tree
Showing 29 changed files with 1,457 additions and 269 deletions.
2 changes: 1 addition & 1 deletion plugins/org.jboss.tools.openshift.client/.classpath
Expand Up @@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry exported="true" kind="lib" path="lib/openshift-restclient-java-3.1.0-SNAPSHOT.jar"/>
<classpathentry exported="true" kind="lib" path="lib/openshift-restclient-java-3.1.0-SNAPSHOT.jar" sourcepath="/openshift-restclient-java/src/main/java"/>
<classpathentry exported="true" kind="lib" path="lib/commons-compress-1.8.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jboss-dmr-1.3.0.Final.jar"/>
<classpathentry exported="true" kind="lib" path="lib/log4j-1.2.17.jar"/>
Expand Down
6 changes: 0 additions & 6 deletions plugins/org.jboss.tools.openshift.client/.project
Expand Up @@ -20,14 +20,8 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Expand Down
Expand Up @@ -27,6 +27,10 @@ public class StringUtils {
private static final String LINE_SEPARATOR_KEY = "line.separator";
private static final String SHORTENING_MARKER = "...";

public static String pluralize(String value) {
return value + "s";
}

public static String null2emptyString(String value) {
if (value != null) {
return value;
Expand Down
1 change: 0 additions & 1 deletion plugins/org.jboss.tools.openshift.common.ui/.classpath
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
Expand Down
3 changes: 0 additions & 3 deletions plugins/org.jboss.tools.openshift.common.ui/plugin.xml
Expand Up @@ -348,15 +348,12 @@
</command>
</menuContribution>
</extension>

<!-- Core UI Integration: credentials prompt -->
<extension
point="org.jboss.tools.openshift.core.credentialsPrompterUI">
<credentialsPrompterUI
class="org.jboss.tools.openshift.common.ui.connection.CredentialsPrompter" />
</extension>


<extension point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.jboss.tools.openshift.internal.common.ui.explorer.OpenShiftExplorerView"
Expand Down
@@ -0,0 +1,70 @@
/*******************************************************************************
* Copyright (c) 2015 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.internal.common.ui.utils;


import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

import org.apache.commons.lang.time.DurationFormatUtils;

public class DateTimeUtils {

private static long NANOSECONDS_PER_SEC = 1000000;

private DateTimeUtils () {
}

public static String formatDuration(long nanoseconds) {
String[] parts = DurationFormatUtils.formatDuration(nanoseconds / NANOSECONDS_PER_SEC, "H:m:s:S").split(":");
StringBuilder builder = new StringBuilder();
if(Integer.valueOf(parts[0]) > 0){
builder.append(parts[0]).append(" hrs.");
}
if(Integer.valueOf(parts[1]) > 0){
builder.append(" ").append(parts[1]).append(" min.");
}
if(Integer.valueOf(parts[2]) > 0){
builder.append(" ").append(parts[2]).append(" sec.");
}
if(builder.length() == 0) {
builder.append("Less than 0 sec.");
}
return builder.toString().trim();
}

public static String formatSince(String value) {
return formatSince(value, null);
}
public static String formatSince(String value, TimeZone timezone) {
try {
Date date = parse(value);
DateFormat formatter = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.FULL);
if(timezone != null) {
formatter.setTimeZone(timezone);
}
return formatter.format(date);
} catch (ParseException e) {
System.out.println(e);
}
return value;
}
public static Date parse(String value) throws ParseException {
//ref: http://www.java2s.com/Code/Java/Data-Type/ISO8601dateparsingutility.htm
//assume date is like: '2015-11-11T20:32:37Z'
String modValue = value.substring(0, value.length()-1) + "GMT-00:00";
SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
return parser.parse(modValue);
}
}
Expand Up @@ -18,5 +18,14 @@
*/
public interface OpenShiftAPIAnnotations {

static final String BUILD_NAME = "openshift.io/build.name";
static final String BUILD_NUMBER = "openshift.io/build.number";

static final String BUILD_CONFIG_NAME = "openshift.io/build-config.name";

static final String DEPLOYMENT_CONFIG_LATEST_VERSION = "openshift.io/deployment-config.latest-version";
static final String DEPLOYMENT_CONFIG_NAME = "openshift.io/deployment-config.name";
static final String DEPLOYMENT_NAME = "openshift.io/deployment.name";

static final String GENERATED_BY = "openshift.io/generated-by";
}
6 changes: 0 additions & 6 deletions plugins/org.jboss.tools.openshift.express.client/.project
Expand Up @@ -20,14 +20,8 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Expand Down
1 change: 1 addition & 0 deletions plugins/org.jboss.tools.openshift.ui/META-INF/MANIFEST.MF
Expand Up @@ -36,6 +36,7 @@ Require-Bundle: org.jboss.tools.openshift.common.ui;bundle-version="[3.0.0,4.0.0
org.eclipse.jdt.launching;bundle-version="3.8.0",
org.eclipse.linuxtools.docker.core;bundle-version="1.2.0",
org.eclipse.linuxtools.docker.ui;bundle-version="1.2.0",
org.eclipse.ui.views.properties.tabbed,
org.eclipse.ui.ide,
org.eclipse.core.variables,
org.apache.commons.io;bundle-version="2.0.1",
Expand Down
3 changes: 3 additions & 0 deletions plugins/org.jboss.tools.openshift.ui/plugin.properties
Expand Up @@ -16,3 +16,6 @@ openshift.command.project.manage = Manage Projects...
openshift.command.project.delete = Delete Project
openshift.command.editresource=Edit...
openshift.preferences.page.title = OpenShift 3

#Labels for Explorer view tabbed properties
openshift.explorer.properties.tab.builds=Builds
91 changes: 89 additions & 2 deletions plugins/org.jboss.tools.openshift.ui/plugin.xml
Expand Up @@ -503,6 +503,33 @@
</visibleWhen>
</command>
</menuContribution>
<menuContribution
allPopups="false"
locationURI="popup:org.jboss.tools.openshift.ui.properties.tab.BuildsTab">
<command
commandId="org.jboss.tools.openshift.ui.command.buildlogs"
id="org.jboss.tools.openshift.ui.explorer.command.buildlogs"
tooltip="The openshift binary must be set in user preferences in order to retrieve build logs">
</command>
<command
commandId="org.jboss.tools.openshift.ui.command.clonebuild"
style="push">
</command>
<command
commandId="org.jboss.tools.openshift.ui.command.resource.delete"
style="push">
</command>
<!--
<command
commandId="org.jboss.tools.openshift.ui.command.startbuild"
style="push">
<parameter
name="org.jboss.tools.openshift.ui.command.startbuild.source"
value="BuildConfig">
</parameter>
</command>
-->
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.handlers">
Expand Down Expand Up @@ -586,11 +613,28 @@
</adapter>
</factory>
<factory
adaptableType="org.jboss.tools.openshift.internal.ui.explorer.Deployment"
adaptableType="org.jboss.tools.openshift.internal.ui.models.Deployment"
class="org.jboss.tools.openshift.internal.ui.property.OpenShiftPropertySourceAdapterFactory">
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
</factory>
<factory
adaptableType="org.jboss.tools.openshift.internal.common.ui.explorer.OpenShiftExplorerView"
class="org.jboss.tools.openshift.internal.ui.property.tabbed.ExplorerViewTabbedPropertyAdapterFactory">
<adapter
type="org.eclipse.ui.views.properties.IPropertySheetPage">
</adapter>
</factory>
<factory
adaptableType="org.jboss.tools.openshift.internal.ui.models.IResourceUIModel"
class="org.jboss.tools.openshift.internal.ui.property.OpenShiftPropertySourceAdapterFactory">
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
<adapter
type="org.eclipse.ui.views.properties.IPropertySource">
</adapter>
</factory>
</extension>

Expand Down Expand Up @@ -755,7 +799,7 @@
point="org.eclipse.ui.menus">
<!-- openshift explorer: open in browser -->
<menuContribution
locationURI="popup:org.jboss.tools.openshift.express.ui.explorer.expressConsoleViewPopup.showIn">
locationURI="popup:org.eclipse.ui.views.PropertySheet">
<command
commandId="org.jboss.tools.openshift.ui.command.openInBrowser"
icon="icons/open-browser.gif"
Expand Down Expand Up @@ -868,4 +912,47 @@
id="org.jboss.tools.openshift.ui.text.OpenShiftResourceDocumentProvider">
</provider>
</extension>

<extension point="org.eclipse.ui.editors.documentProviders">
<provider
inputTypes="org.jboss.tools.openshift.internal.ui.property.OpenShiftResourceInput"
class="org.jboss.tools.openshift.internal.ui.property.OpenShiftResourceDocumentProvider"
id="org.jboss.tools.openshift.ui.text.OpenShiftResourceDocumentProvider">
</provider>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
<propertyTabs
contributorId="org.jboss.tools.openshift.express.ui.explorer.expressConsoleView">
<propertyTab
category="org.jboss.tools.openshift.ui.explorer.expressConsoleView.Deployments"
id="org.jboss.tools.openshift.ui.properties.tab.BuildsTab"
label="%openshift.explorer.properties.tab.builds">
</propertyTab>
</propertyTabs>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertySections">
<propertySections
contributorId="org.jboss.tools.openshift.express.ui.explorer.expressConsoleView">
<propertySection
class="org.jboss.tools.openshift.internal.ui.property.tabbed.BuildsPropertySection"
enablesFor="1"
id="org.jboss.tools.openshift.ui.properties.tab.builds"
tab="org.jboss.tools.openshift.ui.properties.tab.BuildsTab">
<input
type="org.jboss.tools.openshift.internal.ui.models.Deployment">
</input>
</propertySection>
</propertySections>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
<propertyContributor
contributorId="org.jboss.tools.openshift.express.ui.explorer.expressConsoleView">
<propertyCategory
category="org.jboss.tools.openshift.ui.explorer.expressConsoleView.Deployments">
</propertyCategory>
</propertyContributor>
</extension>
</plugin>

This file was deleted.

0 comments on commit ae9daa0

Please sign in to comment.