Revision: 14416 http://unicore.svn.sourceforge.net/unicore/?rev=14416&view=rev Author: bdemuth Date: 2012-09-27 08:50:34 +0000 (Thu, 27 Sep 2012) Log Message: ----------- Adopted to small changes in gridbean-api and removed e.printStackTrace() occurrences Modified Paths: -------------- eclipseclient/trunk/plugins/de.fzj.unicore.rcp.gpe4eclipse/src/main/java/de/fzj/unicore/rcp/gpe4eclipse/ui/JobEditor.java Modified: eclipseclient/trunk/plugins/de.fzj.unicore.rcp.gpe4eclipse/src/main/java/de/fzj/unicore/rcp/gpe4eclipse/ui/JobEditor.java =================================================================== --- eclipseclient/trunk/plugins/de.fzj.unicore.rcp.gpe4eclipse/src/main/java/de/fzj/unicore/rcp/gpe4eclipse/ui/JobEditor.java 2012-09-27 08:38:30 UTC (rev 14415) +++ eclipseclient/trunk/plugins/de.fzj.unicore.rcp.gpe4eclipse/src/main/java/de/fzj/unicore/rcp/gpe4eclipse/ui/JobEditor.java 2012-09-27 08:50:34 UTC (rev 14416) @@ -34,11 +34,11 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.File; +import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -91,6 +91,7 @@ import org.eclipse.ui.IPathEditorInput; import org.eclipse.ui.ISaveablesLifecycleListener; import org.eclipse.ui.ISaveablesSource; +import org.eclipse.ui.IURIEditorInput; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PartInitException; @@ -170,7 +171,6 @@ import de.fzj.unicore.rcp.servicebrowser.nodes.Node; import de.fzj.unicore.rcp.servicebrowser.nodes.NodeFactory; import de.fzj.unicore.rcp.servicebrowser.nodes.NodePath; -import de.fzj.unicore.rcp.servicebrowser.ui.DefaultFilterSet; import de.fzj.unicore.rcp.servicebrowser.ui.ServiceSelectionPanel; import de.fzj.unicore.rcp.wfeditor.model.states.ExecutionStateConstants; @@ -776,8 +776,8 @@ */ @Override public void createPartControl(Composite parent) { - - if (getEditorInput().wasInvalidWhilePersisting()) { + JobEditorInput input = getEditorInput(); + if (input == null || input.wasInvalidWhilePersisting()) { return; } @@ -841,12 +841,11 @@ GridBeanClient<?> gridBeanClient = getGridBeanClient(); if (gridBeanClient != null && gridBeanClient.getGridBeanJob() != null) { - gridBeanClient.getGridBeanJob().getModel() + getGridBeanModel() .removePropertyChangeListener(this); } } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + GPEActivator.log(Status.ERROR, "Error while disposing job editor: "+e.getMessage(), e); } try { @@ -884,10 +883,14 @@ // gridBeanPanels gridBeanClient.setGridBeanInputPanel(null); } + + + // the next line is necessary to remove the plugin as a + // PropertyChangeListener from the GridBean.. + gridBeanClient.getGridBeanPlugin().setGridBeanModel(null); gridBeanClient.getGridBeanJobWrapper().setGridBeanPlugin(null); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + GPEActivator.log("An error occurred while disposing the job editor: "+e.getMessage(), e); } if (resourceSelectionPanel != null) { @@ -1066,7 +1069,7 @@ Display d = getSite().getShell().getDisplay(); GridBeanUtils.saveJobAndWait(getGridBeanClient(), file, d); } catch (Exception e) { - e.printStackTrace(); + GPEActivator.log(Status.ERROR, "Error while serializing job to file: "+e.getMessage(), e); } } @@ -1120,6 +1123,8 @@ } } + + /** * Returns the editor's input file or null if the input file is somehow * invalid. @@ -1221,6 +1226,8 @@ return toolTip; } + + public boolean hasBeenPositioned() { return hasBeenPositioned; @@ -1457,7 +1464,12 @@ public void observableUpdate(Object theObserved, Object changeCode) { + try { + if(changeCode instanceof Exception) + { + throw (Exception) changeCode; + } ((SWTGridBeanInputPanel) getGridBeanClient() .getGridBeanInputPanel()) .setComponent(JobEditor.this); @@ -1465,8 +1477,7 @@ checkGenericTabsEnabled(); listeningToGridBeanModel = true; } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + GPEActivator.log(Status.ERROR, "Error while opening application GUI: "+e.getMessage(), e); } finally { loading = false; } @@ -1804,18 +1815,20 @@ public void setExecutionState(int executionState) { int oldExecutionState = this.executionState; + IGridBean gb = getGridBeanModel(); if (oldExecutionState == executionState) { return; } this.executionState = executionState; - if (getGridBeanModel() != null) { + + if (gb != null) { GridBeanContext context; context = getGridBeanContext().clone(); listeningToGridBeanModel = false; context.setJobExecutionState(executionState); boolean editable = executionState == ExecutionStateConstants.STATE_UNSUBMITTED; context.setEditable(editable); - getGridBeanModel().set(GPE4EclipseConstants.CONTEXT, context); + gb.set(GPE4EclipseConstants.CONTEXT, context); boolean oldEditable = oldExecutionState == ExecutionStateConstants.STATE_UNSUBMITTED; if (editable != oldEditable) { getGridBeanClient().reloadInputPanel(null); @@ -1858,8 +1871,7 @@ getGridBeanClient().getGridBeanJob().getModel() .addPropertyChangeListener(this); } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); + GPEActivator.log(Status.ERROR, "Error while subscribing to application GUI model changes: "+e.getMessage(), e); } } @@ -1872,10 +1884,22 @@ // replace the input with a JobEditorInput in order to use the // correct // equals implementation + IPath jobPath = null; IFile f = (IFile) input.getAdapter(IFile.class); + if(f == null && input instanceof IURIEditorInput) + { + IURIEditorInput uriInput = (IURIEditorInput) input; + URI uri = uriInput.getURI(); + IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(uri); + if(files != null && files.length == 1) f = files[0]; + } if(f != null) { - IPath jobPath = f.getLocation(); + jobPath = f.getLocation(); + } + + + if(jobPath != null) { String activityName = null; IPath workflowPath = GPEPathUtils .extractWorkflowPathFromJobPath(jobPath); @@ -1887,6 +1911,10 @@ input = newInput; } + else + { + return; + } } super.setInput(input); if (getEditorInput().wasInvalidWhilePersisting()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |