Skip to content

Commit 451667f

Browse files
authored
Merge pull request #5286 from hansva/5280
NPE and some other dispose errors, fixes #5280
2 parents ea5ed40 + 1a66559 commit 451667f

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

ui/src/main/java/org/apache/hop/ui/hopgui/file/pipeline/HopGuiPipelineGraph.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3915,6 +3915,9 @@ public void checkEmptyExtraView() {
39153915
}
39163916

39173917
private void disposeExtraView() {
3918+
if (extraViewTabFolder == null) {
3919+
return;
3920+
}
39183921

39193922
extraViewTabFolder.dispose();
39203923
sashForm.layout();

ui/src/main/java/org/apache/hop/ui/hopgui/file/workflow/HopGuiWorkflowGraph.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,12 @@ public static HopGuiWorkflowGraph getInstance() {
471471
return HopGui.getActiveWorkflowGraph();
472472
}
473473

474+
@Override
475+
public void dispose() {
476+
disposeExtraView();
477+
super.dispose();
478+
}
479+
474480
protected void hideToolTips() {
475481
toolTip.setVisible(false);
476482
}
@@ -3468,6 +3474,10 @@ private void rotateExtraView() {
34683474
}
34693475

34703476
private void disposeExtraView() {
3477+
if (extraViewTabFolder == null) {
3478+
return;
3479+
}
3480+
34713481
extraViewTabFolder.dispose();
34723482
sashForm.layout();
34733483
sashForm.setWeights(100);

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/dataorch/HopDataOrchestrationPerspective.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -711,19 +711,15 @@ public void closeTab(CTabFolderEvent event, CTabItem tabItem) {
711711

712712
// Switch to the previous tab
713713
//
714-
if (tabIndex >= 0) {
714+
if (tabIndex >= 0 && tabFolder.getItemCount() >= 1) {
715715
// If last
716716
if (tabIndex == tabFolder.getItemCount()) {
717717
tabIndex--;
718718
}
719719

720720
tabItem = tabFolder.getItem(tabIndex);
721-
if (tabIndex < 0) {
722-
tabIndex = tabFolder.getItemCount() - 1;
723-
}
724721

725722
TabItemHandler activeItem = (TabItemHandler) tabItem.getData();
726-
// tabFolder.setSelection(activeIndex);
727723
activeItem.getTypeHandler().updateGui();
728724
}
729725

ui/src/main/java/org/apache/hop/ui/hopgui/perspective/metadata/MetadataPerspective.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,13 @@ public void onRenameMetadata() {
605605
switch (event.keyCode) {
606606
case SWT.CR, SWT.KEYPAD_CR:
607607
// If name changed
608-
if (!item.getText().equals(text.getText())) {
608+
if (!objectName.equals(text.getText())) {
609609
try {
610610
MetadataManager<IHopMetadata> manager = getMetadataManager(objectKey);
611611
if (manager.rename(objectName, text.getText())) {
612-
item.setText(text.getText());
613612
text.dispose();
614613
}
614+
hopGui.getEventsHandler().fire(HopGuiEvents.MetadataChanged.name());
615615
} catch (Exception e) {
616616
new ErrorDialog(
617617
getShell(),
@@ -633,12 +633,6 @@ public void onRenameMetadata() {
633633
text.selectAll();
634634
text.setFocus();
635635
treeEditor.setEditor(text, item);
636-
637-
try {
638-
hopGui.getEventsHandler().fire(HopGuiEvents.MetadataChanged.name());
639-
} catch (HopException e) {
640-
throw new RuntimeException("Error fire metadata changed event", e);
641-
}
642636
}
643637
}
644638

0 commit comments

Comments
 (0)