Skip to content

Commit

Permalink
TEIIDDES-505 Closing VDB editor if user chooses to extract VDB files …
Browse files Browse the repository at this point in the history
…and synchronize VDB
  • Loading branch information
blafond committed Mar 6, 2013
1 parent a922638 commit bea4bf7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IMarkerResolution;
import org.teiid.designer.ui.common.viewsupport.UiBusyIndicator;
import org.teiid.designer.vdb.VdbConstants;
import org.teiid.designer.vdb.ui.Messages;
import org.teiid.designer.vdb.ui.editor.VdbEditor;
import org.teiid.designer.vdb.ui.util.VdbUiRefactorHandler;
import org.teiid.designer.vdb.ui.util.VdbUiUtil;

/**
Expand Down Expand Up @@ -45,6 +49,15 @@ public void run(IMarker marker) {
if (isVdbFile(resource)) {
final IFile theVdbFile = (IFile) resource;

// Close editor if open
VdbEditor editor = VdbUiRefactorHandler.getVdbEditorForFile(theVdbFile);
if( editor != null ) {
String message = NLS.bind(Messages.fixVdbPath_OpenEditorMessage, theVdbFile.getName());
boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), Messages.fixVdbPath_OpenEditorTitle, message);
if( !result ) return;
VdbUiRefactorHandler.closeVdbEditor(editor);
}

// Add the selected Med
UiBusyIndicator.showWhile(Display.getDefault(), new Runnable() {
@Override
Expand Down

0 comments on commit bea4bf7

Please sign in to comment.