-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEIIDDES-1611 Added Quick Fixes for extracting models in VDBs that ar…
…e missing in workspace
- Loading branch information
Showing
13 changed files
with
584 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...r.vdb.ui/src/org/teiid/designer/vdb/ui/build/VdbExtractModelsSyncVdbMarkerResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.vdb.ui.build; | ||
|
||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.core.resources.IMarker; | ||
import org.eclipse.core.resources.IResource; | ||
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.util.VdbUiUtil; | ||
|
||
/** | ||
* | ||
*/ | ||
public class VdbExtractModelsSyncVdbMarkerResolution implements IMarkerResolution { | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @see org.eclipse.ui.IMarkerResolution#getLabel() | ||
*/ | ||
@Override | ||
public String getLabel() { | ||
return Messages.extractMissingModelsAndSyncLabel; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @see org.eclipse.ui.IMarkerResolution#run(org.eclipse.core.resources.IMarker) | ||
*/ | ||
@Override | ||
public void run(IMarker marker) { | ||
IResource resource = marker.getResource(); | ||
|
||
// Fix the Marked Model Resource | ||
if (isVdbFile(resource)) { | ||
final IFile theVdbFile = (IFile) resource; | ||
|
||
// Add the selected Med | ||
UiBusyIndicator.showWhile(Display.getDefault(), new Runnable() { | ||
@Override | ||
public void run() { | ||
fixVdb(theVdbFile); | ||
} | ||
}); | ||
|
||
} | ||
} | ||
|
||
void fixVdb(IFile theVdb) { | ||
VdbUiUtil.synchronizeVdb(theVdb, true); | ||
} | ||
|
||
/** | ||
* @param resource | ||
* the resource being checked (never <code>null</code>) | ||
* @return <code>true</code> if resource is a VDB file | ||
*/ | ||
private boolean isVdbFile(IResource resource) { | ||
return ((resource.getType() == IResource.FILE) | ||
&& VdbConstants.VDB_FILE_EXTENSION.equals(resource | ||
.getFileExtension()) && resource.exists()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...gner.vdb.ui/src/org/teiid/designer/vdb/ui/build/VdbModelNotInProjectMarkerResolution.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.vdb.ui.build; | ||
|
||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.core.resources.IMarker; | ||
import org.eclipse.core.resources.IResource; | ||
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.util.VdbUiUtil; | ||
|
||
/** | ||
* | ||
*/ | ||
public class VdbModelNotInProjectMarkerResolution implements IMarkerResolution { | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @see org.eclipse.ui.IMarkerResolution#getLabel() | ||
*/ | ||
@Override | ||
public String getLabel() { | ||
return Messages.extractMissingModelsLabel; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @see org.eclipse.ui.IMarkerResolution#run(org.eclipse.core.resources.IMarker) | ||
*/ | ||
@Override | ||
public void run(IMarker marker) { | ||
IResource resource = marker.getResource(); | ||
|
||
// Fix the Marked Model Resource | ||
if(isVdbFile(resource)) { | ||
final IFile theVdbFile = (IFile)resource; | ||
|
||
// Add the selected Med | ||
UiBusyIndicator.showWhile(Display.getDefault(), new Runnable() { | ||
@Override | ||
public void run() { | ||
fixVdb(theVdbFile); | ||
} | ||
}); | ||
|
||
} | ||
} | ||
|
||
void fixVdb( IFile theVdb ) { | ||
VdbUiUtil.synchronizeWorkspace(theVdb); | ||
} | ||
|
||
/** | ||
* @param resource the resource being checked (never <code>null</code>) | ||
* @return <code>true</code> if resource is a VDB file | ||
*/ | ||
private boolean isVdbFile( IResource resource ) { | ||
return ((resource.getType() == IResource.FILE) && VdbConstants.VDB_FILE_EXTENSION.equals(resource.getFileExtension()) && resource.exists()); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
...ui/src/org/teiid/designer/vdb/ui/build/VdbModelNotInProjectMarkerResolutionGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source. | ||
* | ||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing. | ||
* | ||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors. | ||
*/ | ||
package org.teiid.designer.vdb.ui.build; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
|
||
import org.eclipse.core.resources.IMarker; | ||
import org.eclipse.ui.IMarkerResolution; | ||
import org.eclipse.ui.IMarkerResolutionGenerator; | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
public class VdbModelNotInProjectMarkerResolutionGenerator implements IMarkerResolutionGenerator { | ||
/** | ||
* {@inheritDoc} | ||
* | ||
* @see org.eclipse.ui.IMarkerResolutionGenerator#getResolutions(org.eclipse.core.resources.IMarker) | ||
*/ | ||
@Override | ||
public IMarkerResolution[] getResolutions(IMarker marker) { | ||
Collection<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); | ||
|
||
if( marker.getAttribute(VdbBuilder.MISSING_MODEL, false) ) { | ||
resolutions.add(new VdbExtractModelsSyncVdbMarkerResolution()); | ||
resolutions.add(new VdbModelNotInProjectMarkerResolution()); | ||
|
||
} | ||
return resolutions.toArray(new IMarkerResolution[resolutions.size()]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.