Search in sources :

Example 46 with QueryEditorPart

use of com.cubrid.common.ui.query.editor.QueryEditorPart in project cubrid-manager by CUBRID.

the class SqlFormatAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    IEditorPart editor = window.getActivePage().getActiveEditor();
    if (editor instanceof QueryEditorPart) {
        QueryEditorPart queryEditor = (QueryEditorPart) editor;
        queryEditor.format();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) IEditorPart(org.eclipse.ui.IEditorPart)

Example 47 with QueryEditorPart

use of com.cubrid.common.ui.query.editor.QueryEditorPart in project cubrid-manager by CUBRID.

the class AssignEditorNameAction method menuAboutToShow.

/**
	 * When menu show, update the action's status.
	 * 
	 * @param manager IMenuManager
	 */
public void menuAboutToShow(IMenuManager manager) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        manager.remove(ID);
        return;
    }
    IEditorPart editor = window.getActivePage().getActiveEditor();
    if (editor instanceof QueryEditorPart) {
        if (manager.find(ID) == null) {
            manager.add(this);
        }
    } else {
        manager.remove(ID);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) IEditorPart(org.eclipse.ui.IEditorPart)

Example 48 with QueryEditorPart

use of com.cubrid.common.ui.query.editor.QueryEditorPart in project cubrid-manager by CUBRID.

the class AssignEditorNameAction method run.

public void run() {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        return;
    }
    IEditorPart editor = window.getActivePage().getActiveEditor();
    if (editor != null && editor instanceof QueryEditorPart) {
        QueryEditorPart queryEditorPart = (QueryEditorPart) editor;
        AssignEditorNameDialog dialog = new AssignEditorNameDialog(Display.getCurrent().getActiveShell(), queryEditorPart);
        dialog.open();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) AssignEditorNameDialog(com.cubrid.common.ui.common.dialog.AssignEditorNameDialog) IEditorPart(org.eclipse.ui.IEditorPart)

Example 49 with QueryEditorPart

use of com.cubrid.common.ui.query.editor.QueryEditorPart in project cubrid-manager by CUBRID.

the class CopyQueryEditorAction method menuAboutToShow.

/**
	 * When menu show, update the action's status.
	 * 
	 * @param manager IMenuManager
	 */
public void menuAboutToShow(IMenuManager manager) {
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        manager.remove(ID);
        return;
    }
    IEditorPart editor = window.getActivePage().getActiveEditor();
    if (editor instanceof QueryEditorPart) {
        if (manager.find(ID) == null) {
            manager.add(this);
        }
    } else {
        manager.remove(ID);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) IEditorPart(org.eclipse.ui.IEditorPart)

Example 50 with QueryEditorPart

use of com.cubrid.common.ui.query.editor.QueryEditorPart in project cubrid-manager by CUBRID.

the class ParseSqlmapQueryAction method run.

/**
	 * @see org.eclipse.jface.action.Action#run()
	 */
public void run() {
    Control control = getFocusProvider();
    if (!(control instanceof StyledText)) {
        showNoSelectionQueryError();
        return;
    }
    StyledText stext = (StyledText) control;
    String data = stext.getSelectionText();
    if (StringUtil.isEmpty(data)) {
        showNoSelectionQueryError();
        return;
    }
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window == null) {
        showNoSelectionQueryError();
        return;
    }
    IEditorPart editor = window.getActivePage().getActiveEditor();
    if (editor == null || !(editor instanceof QueryEditorPart)) {
        showNoSelectionQueryError();
        return;
    }
    ((QueryEditorPart) editor).parseSqlmapQuery();
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Control(org.eclipse.swt.widgets.Control) QueryEditorPart(com.cubrid.common.ui.query.editor.QueryEditorPart) StyledText(org.eclipse.swt.custom.StyledText) IEditorPart(org.eclipse.ui.IEditorPart)

Aggregations

QueryEditorPart (com.cubrid.common.ui.query.editor.QueryEditorPart)51 IEditorPart (org.eclipse.ui.IEditorPart)41 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)39 QueryUnit (com.cubrid.common.ui.query.editor.QueryUnit)21 PartInitException (org.eclipse.ui.PartInitException)19 CubridDatabase (com.cubrid.common.ui.spi.model.CubridDatabase)13 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)8 ArrayList (java.util.ArrayList)7 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)6 ISchemaNode (com.cubrid.common.ui.spi.model.ISchemaNode)5 List (java.util.List)5 StyledText (org.eclipse.swt.custom.StyledText)5 ShardIdSelectionDialog (com.cubrid.common.ui.common.dialog.ShardIdSelectionDialog)4 CombinedQueryEditorComposite (com.cubrid.common.ui.query.control.CombinedQueryEditorComposite)4 IOException (java.io.IOException)4 IEditorReference (org.eclipse.ui.IEditorReference)4 CubridServer (com.cubrid.common.ui.spi.model.CubridServer)3 DefaultSchemaNode (com.cubrid.common.ui.spi.model.DefaultSchemaNode)3 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)3 Control (org.eclipse.swt.widgets.Control)3