use of com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView in project convertigo by convertigo.
the class ConvertigoPlugin method getSourcePickerView.
/**
* Gets the source picker view.
* !!MUST BE CALLED IN A UI-THREAD!!
* @return SourcePickerView : the source picker view of Convertigo Plugin
*/
public SourcePickerView getSourcePickerView() {
SourcePickerView sourcePickerView = null;
IWorkbenchPage activePage = getActivePage();
if (activePage != null) {
IViewPart viewPart = activePage.findView("com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView");
if (viewPart != null)
sourcePickerView = (SourcePickerView) viewPart;
}
return sourcePickerView;
}
use of com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView in project convertigo by convertigo.
the class ShowStepInPickerAction method run.
public void run() {
Display display = Display.getDefault();
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
Shell shell = getParentShell();
shell.setCursor(waitCursor);
try {
ProjectExplorerView explorerView = getProjectExplorerView();
if (explorerView != null) {
TreeObject treeObject = explorerView.getFirstSelectedTreeObject();
if (treeObject != null) {
if (treeObject instanceof DatabaseObjectTreeObject) {
DatabaseObject selectedDbo = ((DatabaseObjectTreeObject) treeObject).getObject();
if (selectedDbo != null) {
StepSourceEvent event = null;
if (showSource) {
if (selectedDbo instanceof Step) {
Step step = (Step) selectedDbo;
Set<StepSource> sources = step.getSources();
if (!sources.isEmpty()) {
event = new StepSourceEvent(sources.iterator().next());
} else {
throw new Exception("No Source defined");
}
}
} else {
event = new StepSourceEvent(selectedDbo);
}
if (event != null) {
SourcePickerView spv = ConvertigoPlugin.getDefault().getSourcePickerView();
if (spv == null) {
spv = (SourcePickerView) getActivePage().showView("com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView");
}
if (spv != null) {
spv.sourceSelected(event);
}
}
}
}
}
}
} catch (Throwable e) {
ConvertigoPlugin.logException(e, "Unable to show object in Picker!");
} finally {
shell.setCursor(null);
waitCursor.dispose();
}
}
use of com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView in project convertigo by convertigo.
the class ProjectTreeObject method clearSourcePickerView.
private void clearSourcePickerView() {
try {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
IViewPart viewPart = activePage.findView("com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView");
if (viewPart != null) {
SourcePickerView spv = (SourcePickerView) viewPart;
DatabaseObject dbo = (DatabaseObject) spv.getObject();
boolean bClose = true;
try {
bClose = dbo.getProject().equals(getObject());
} catch (Exception e) {
}
if (bClose) {
spv.close();
}
}
}
} catch (Exception e) {
}
}
use of com.twinsoft.convertigo.eclipse.views.sourcepicker.SourcePickerView in project convertigo by convertigo.
the class ConvertigoPartListener method partClosed.
/* (non-Javadoc)
* @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
*/
public void partClosed(IWorkbenchPart part) {
if (part instanceof ConnectorEditor) {
// close editor properly
((ConnectorEditor) part).close();
}
if (part instanceof SequenceEditor) {
// close editor properly
((SequenceEditor) part).close();
}
if (part instanceof ProjectExplorerView) {
// close view properly
((ProjectExplorerView) part).close();
}
if (part instanceof SourcePickerView) {
// close view properly
((SourcePickerView) part).close();
}
if (part instanceof ConsoleView) {
ConvertigoPlugin convertigoPlugin = ConvertigoPlugin.getDefault();
boolean shuttingDown = convertigoPlugin.isShuttingDown();
if (shuttingDown) {
IConsole[] tabConsoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
String openedConsoles = "";
for (IConsole console : tabConsoles) {
if (console instanceof MessageConsole) {
if ((console.equals(convertigoPlugin.engineConsole)) && (openedConsoles.indexOf("engine") == -1))
openedConsoles += (openedConsoles.equals("") ? "" : ",") + "engine";
else if ((console.equals(convertigoPlugin.stdoutConsole)) && (openedConsoles.indexOf("stdout") == -1))
openedConsoles += (openedConsoles.equals("") ? "" : ",") + "stdout";
}
}
ConvertigoPlugin.setProperty(ConvertigoPlugin.PREFERENCE_OPENED_CONSOLES, openedConsoles);
}
}
if (part instanceof EditorPart) {
IEditorInput input = ((EditorPart) part).getEditorInput();
if (input instanceof com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput) {
try {
com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditorInput acei = GenericUtils.cast(input);
MobileBuilder mb = acei.getApplication().getProject().getMobileBuilder();
mb.removeMobileEventListener((com.twinsoft.convertigo.eclipse.editors.mobile.ApplicationComponentEditor) part);
mb.setAutoBuild(true);
} catch (Exception e) {
e.printStackTrace();
}
}
if (input instanceof com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput) {
try {
com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditorInput acei = GenericUtils.cast(input);
MobileBuilder mb = acei.getApplication().getProject().getMobileBuilder();
mb.removeMobileEventListener((com.twinsoft.convertigo.eclipse.editors.ngx.ApplicationComponentEditor) part);
mb.setAutoBuild(true);
} catch (Exception e) {
e.printStackTrace();
}
}
if (input instanceof JScriptEditorInput) {
try {
((JScriptEditorInput) input).getFile().getParent().delete(true, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (input instanceof com.twinsoft.convertigo.eclipse.editors.mobile.ComponentFileEditorInput) {
try {
((com.twinsoft.convertigo.eclipse.editors.mobile.ComponentFileEditorInput) input).getFile().delete(true, null);
} catch (Exception e) {
e.printStackTrace();
}
} else if (input instanceof com.twinsoft.convertigo.eclipse.editors.ngx.ComponentFileEditorInput) {
try {
((com.twinsoft.convertigo.eclipse.editors.ngx.ComponentFileEditorInput) input).getFile().delete(true, null);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
Aggregations