-
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.
Created alternative action/dialog to generate a VDB XML file with one…
… page dialog and allow custom editing of XML
- Loading branch information
Showing
25 changed files
with
1,534 additions
and
93 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
101 changes: 101 additions & 0 deletions
101
.../org.teiid.designer.dqp.ui/src/org/teiid/designer/runtime/ui/actions/DeployJarAction.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,101 @@ | ||
package org.teiid.designer.runtime.ui.actions; | ||
|
||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.jface.dialogs.MessageDialog; | ||
import org.eclipse.jface.viewers.ISelection; | ||
import org.eclipse.jface.wizard.WizardDialog; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.widgets.Shell; | ||
import org.eclipse.ui.IWorkbenchWindow; | ||
import org.eclipse.ui.PlatformUI; | ||
import org.teiid.designer.runtime.ui.DqpUiConstants; | ||
import org.teiid.designer.runtime.ui.DqpUiPlugin; | ||
import org.teiid.designer.runtime.ui.Messages; | ||
import org.teiid.designer.runtime.ui.DqpUiConstants.Images; | ||
import org.teiid.designer.runtime.ui.wizards.vdbs.GenerateArchiveVdbWizard; | ||
import org.teiid.designer.ui.actions.SortableSelectionAction; | ||
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities; | ||
import org.teiid.designer.vdb.VdbUtil; | ||
import org.teiid.designer.vdb.ui.VdbUiPlugin; | ||
|
||
public class DeployJarAction extends SortableSelectionAction implements DqpUiConstants { | ||
private static final String label = "Deploy Jar"; //$NON-NLS-1$ | ||
/** | ||
* @since 5.0 | ||
*/ | ||
public DeployJarAction() { | ||
super(label, SWT.DEFAULT); | ||
setImageDescriptor(DqpUiPlugin.getDefault().getImageDescriptor(Images.CREATE_WAR)); | ||
} | ||
|
||
/** | ||
* @see org.teiid.designer.ui.actions.SortableSelectionAction#isValidSelection(org.eclipse.jface.viewers.ISelection) | ||
* @since 5.0 | ||
*/ | ||
@Override | ||
public boolean isValidSelection( ISelection selection ) { | ||
// Enable for single/multiple Virtual Tables | ||
return jarFileSelected(selection); | ||
} | ||
|
||
/** | ||
* @see org.eclipse.jface.action.IAction#run() | ||
* @since 5.0 | ||
*/ | ||
@Override | ||
public void run() { | ||
final IWorkbenchWindow iww = VdbUiPlugin.singleton.getCurrentWorkbenchWindow(); | ||
|
||
Object obj = SelectionUtilities.getSelectedObject(getSelection()); | ||
IFile theFile = (IFile)obj; | ||
|
||
// Check server to see if it's running | ||
// if it's not warn the user | ||
|
||
// If it's running, then get the server and call: | ||
|
||
// server.deployDriver(jarOrRarFile); | ||
|
||
} | ||
|
||
|
||
|
||
/** | ||
* @see org.teiid.designer.ui.actions.ISelectionAction#isApplicable(org.eclipse.jface.viewers.ISelection) | ||
* @since 5.0 | ||
*/ | ||
@Override | ||
public boolean isApplicable( ISelection selection ) { | ||
return jarFileSelected(selection); | ||
} | ||
|
||
private boolean jarFileSelected( ISelection theSelection ) { | ||
boolean result = false; | ||
List<Object> allObjs = SelectionUtilities.getSelectedObjects(theSelection); | ||
if (!allObjs.isEmpty() && allObjs.size() == 1) { | ||
Iterator<Object> iter = allObjs.iterator(); | ||
result = true; | ||
Object nextObj = null; | ||
while (iter.hasNext() && result) { | ||
nextObj = iter.next(); | ||
|
||
if (nextObj instanceof IFile) { | ||
IFile theFile = (IFile)nextObj; | ||
|
||
result = theFile.getFileExtension().equalsIgnoreCase("JAR"); | ||
} else { | ||
result = false; | ||
} | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
private Shell getShell() { | ||
return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); | ||
} | ||
} |
110 changes: 110 additions & 0 deletions
110
....designer.dqp.ui/src/org/teiid/designer/runtime/ui/actions/GenerateDynamicVdbAction2.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,110 @@ | ||
package org.teiid.designer.runtime.ui.actions; | ||
|
||
import java.util.Iterator; | ||
import java.util.List; | ||
|
||
import org.eclipse.core.resources.IFile; | ||
import org.eclipse.jface.dialogs.IDialogConstants; | ||
import org.eclipse.jface.dialogs.MessageDialog; | ||
import org.eclipse.jface.viewers.ISelection; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.widgets.Display; | ||
import org.eclipse.swt.widgets.Shell; | ||
import org.teiid.designer.runtime.ui.DqpUiConstants; | ||
import org.teiid.designer.runtime.ui.DqpUiPlugin; | ||
import org.teiid.designer.runtime.ui.Messages; | ||
import org.teiid.designer.runtime.ui.wizards.vdbs.GenerateDynamicVdbDialog; | ||
import org.teiid.designer.runtime.ui.wizards.vdbs.GenerateDynamicVdbManager; | ||
import org.teiid.designer.ui.actions.SortableSelectionAction; | ||
import org.teiid.designer.ui.common.actions.ModelActionConstants; | ||
import org.teiid.designer.ui.common.eventsupport.SelectionUtilities; | ||
import org.teiid.designer.ui.viewsupport.ModelUtilities; | ||
|
||
public class GenerateDynamicVdbAction2 extends SortableSelectionAction implements DqpUiConstants { | ||
private static final String label = DqpUiConstants.UTIL.getString("label"); //$NON-NLS-1$ | ||
/** | ||
* @since 5.0 | ||
*/ | ||
public GenerateDynamicVdbAction2() { | ||
super(label, SWT.DEFAULT); | ||
setImageDescriptor(DqpUiPlugin.getDefault().getImageDescriptor(Images.DYNAMIC_VDB)); | ||
setId(ModelActionConstants.Resource.GENERATE_VDB_XML); | ||
} | ||
|
||
/** | ||
* @see org.teiid.designer.ui.actions.SortableSelectionAction#isValidSelection(org.eclipse.jface.viewers.ISelection) | ||
* @since 5.0 | ||
*/ | ||
@Override | ||
public boolean isValidSelection( ISelection selection ) { | ||
// Enable for single/multiple Virtual Tables | ||
return vdbSelected(selection); | ||
} | ||
|
||
/** | ||
* @see org.eclipse.jface.action.IAction#run() | ||
* @since 5.0 | ||
*/ | ||
@Override | ||
public void run() { | ||
|
||
Object obj = SelectionUtilities.getSelectedObject(getSelection()); | ||
if (obj instanceof IFile) { | ||
IFile vdbXmlFile = (IFile)obj; | ||
|
||
try { | ||
GenerateDynamicVdbManager vdbManager = new GenerateDynamicVdbManager(vdbXmlFile); | ||
|
||
GenerateDynamicVdbDialog dialog = new GenerateDynamicVdbDialog(getShell(), vdbManager); | ||
|
||
if( dialog.open() == IDialogConstants.OK_ID) { | ||
vdbManager.write(); | ||
} | ||
return; | ||
} catch (Exception ex) { | ||
MessageDialog.openError(getShell(), | ||
Messages.GenerateDynamicVdbAction_exceptionTitle, | ||
ex.getLocalizedMessage()); | ||
} | ||
} | ||
|
||
MessageDialog.openInformation(getShell(), | ||
Messages.GenerateDynamicVdbAction_nothingExportedTitle, | ||
Messages.GenerateDynamicVdbAction_nothingExportedMessage); | ||
|
||
} | ||
|
||
/** | ||
* @see org.teiid.designer.ui.actions.ISelectionAction#isApplicable(org.eclipse.jface.viewers.ISelection) | ||
* @since 5.0 | ||
*/ | ||
@Override | ||
public boolean isApplicable( ISelection selection ) { | ||
return vdbSelected(selection); | ||
} | ||
|
||
private boolean vdbSelected( ISelection theSelection ) { | ||
boolean result = false; | ||
List<Object> allObjs = SelectionUtilities.getSelectedObjects(theSelection); | ||
if (!allObjs.isEmpty() && allObjs.size() == 1) { | ||
Iterator<Object> iter = allObjs.iterator(); | ||
result = true; | ||
Object nextObj = null; | ||
while (iter.hasNext() && result) { | ||
nextObj = iter.next(); | ||
|
||
if (nextObj instanceof IFile) { | ||
result = ModelUtilities.isVdbFile((IFile)nextObj); | ||
} else { | ||
result = false; | ||
} | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
|
||
private Shell getShell() { | ||
return Display.getCurrent().getActiveShell(); | ||
} | ||
} |
Oops, something went wrong.