File tree Expand file tree Collapse file tree 8 files changed +70
-7
lines changed
com.ibm.microclimate.core/src/com/ibm/microclimate/core/internal
com.ibm.microclimate.ui/src/com/ibm/microclimate/ui/internal Expand file tree Collapse file tree 8 files changed +70
-7
lines changed Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2018 IBM Corporation and others.
2+ * Copyright (c) 2018, 2019 IBM Corporation and others.
33 * All rights reserved. This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
@@ -290,5 +290,27 @@ public boolean supportsDebug() {
290290 }
291291 return false ;
292292 }
293+
294+ @ Override
295+ public void buildComplete () {
296+ IProject project = ResourcesPlugin .getWorkspace ().getRoot ().getProject (name );
297+ if (project != null && project .isAccessible ()) {
298+ Job job = new Job (NLS .bind (Messages .RefreshResourceJobLabel , project .getName ())) {
299+ @ Override
300+ protected IStatus run (IProgressMonitor monitor ) {
301+ try {
302+ project .refreshLocal (IResource .DEPTH_INFINITE , monitor );
303+ return Status .OK_STATUS ;
304+ } catch (Exception e ) {
305+ MCLogger .logError ("An error occurred while refreshing the resource: " + project .getLocation ()); //$NON-NLS-1$
306+ return new Status (IStatus .ERROR , MicroclimateCorePlugin .PLUGIN_ID ,
307+ NLS .bind (Messages .RefreshResourceError , project .getLocation ()), e );
308+ }
309+ }
310+ };
311+ job .setPriority (Job .LONG );
312+ job .schedule ();
313+ }
314+ }
293315
294316}
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2018 IBM Corporation and others.
2+ * Copyright (c) 2018, 2019 IBM Corporation and others.
33 * All rights reserved. This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
@@ -96,12 +96,17 @@ public synchronized void setAppStatus(String appStatus) {
9696
9797 public synchronized void setBuildStatus (String buildStatus , String buildDetails ) {
9898 if (buildStatus != null ) {
99- this .buildStatus = BuildStatus .get (buildStatus );
99+ BuildStatus newStatus = BuildStatus .get (buildStatus );
100+ boolean hasChanged = newStatus != this .buildStatus ;
101+ this .buildStatus = newStatus ;
100102 if (buildDetails != null && buildDetails .trim ().isEmpty ()) {
101103 this .buildDetails = null ;
102104 } else {
103105 this .buildDetails = buildDetails ;
104106 }
107+ if (hasChanged && newStatus .isComplete ()) {
108+ buildComplete ();
109+ }
105110 }
106111 }
107112
@@ -272,6 +277,10 @@ public boolean supportsDebug() {
272277 // Override as needed
273278 return false ;
274279 }
280+
281+ public void buildComplete () {
282+ // Override to perform actions when a build has completed
283+ }
275284
276285 @ Override
277286 public String toString () {
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2018 IBM Corporation and others.
2+ * Copyright (c) 2018, 2019 IBM Corporation and others.
33 * All rights reserved. This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
@@ -48,6 +48,10 @@ public static BuildStatus get(String buildStatus) {
4848 return BuildStatus .UNKOWN ;
4949 }
5050
51+ public boolean isComplete () {
52+ return this == SUCCESS || this == FAILED ;
53+ }
54+
5155 public String getDisplayString () {
5256 return displayString ;
5357 }
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2018, 2019 IBM Corporation and others.
3+ * All rights reserved. This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License v2.0
5+ * which accompanies this distribution, and is available at
6+ * http://www.eclipse.org/legal/epl-v20.html
7+ *
8+ * Contributors:
9+ * IBM Corporation - initial API and implementation
10+ *******************************************************************************/
11+
112package com .ibm .microclimate .core .internal .messages ;
213
314import org .eclipse .osgi .util .NLS ;
@@ -47,6 +58,9 @@ public class Messages extends NLS {
4758
4859 public static String DebugLaunchError ;
4960 public static String ReconnectDebugJob ;
61+
62+ public static String RefreshResourceJobLabel ;
63+ public static String RefreshResourceError ;
5064
5165 static {
5266 // initialize resource bundle
Original file line number Diff line number Diff line change @@ -51,3 +51,6 @@ BuildStateUnknown=No build status information
5151
5252DebugLaunchError =An error occurred trying to launch the debugger for the {0} project.
5353ReconnectDebugJob =Reconnect debugger
54+
55+ RefreshResourceJobLabel =Refreshing resource: {0}
56+ RefreshResourceError =An error occurred while trying to refresh the {0} resource.
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2018 IBM Corporation and others.
2+ * Copyright (c) 2018, 2019 IBM Corporation and others.
33 * All rights reserved. This program and the accompanying materials
44 * are made available under the terms of the Eclipse Public License v2.0
55 * which accompanies this distribution, and is available at
@@ -50,7 +50,7 @@ public void run(IMarker marker) {
5050 app .mcConnection .requestValidateGenerate (app );
5151 IResource resource = marker .getResource ();
5252 if (resource != null ) {
53- Job job = new Job (Messages .refreshResourceJobLabel ) {
53+ Job job = new Job (NLS . bind ( Messages .refreshResourceJobLabel , resource . getName ()) ) {
5454 @ Override
5555 protected IStatus run (IProgressMonitor monitor ) {
5656 try {
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2018 IBM Corporation and others.
3+ * All rights reserved. This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License v2.0
5+ * which accompanies this distribution, and is available at
6+ * http://www.eclipse.org/legal/epl-v20.html
7+ *
8+ * Contributors:
9+ * IBM Corporation - initial API and implementation
10+ *******************************************************************************/
11+
112package com .ibm .microclimate .ui .internal .messages ;
213
314import org .eclipse .osgi .util .NLS ;
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ ActionNewConnection=&New Microclimate Connection
6262
6363ValidateLabel =Validate
6464AttachDebuggerLabel =A&ttach Debugger
65- refreshResourceJobLabel =Refresh resource
65+ refreshResourceJobLabel =Refreshing resource: {0}
6666RefreshResourceError =An error occurred while trying to refresh the {0} resource.
6767
6868ImportProjectError =An error occurred while importing the {0} project.
You can’t perform that action at this time.
0 commit comments