use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class SqlmapNavigatorView method pasteSqlToQueryEditor.
private void pasteSqlToQueryEditor(String sql) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null || window.getActivePage() == null) {
return;
}
IEditorPart editor = window.getActivePage().getActiveEditor();
try {
if (editor == null || !(editor instanceof QueryEditorPart)) {
editor = window.getActivePage().openEditor(new QueryUnit(), QueryEditorPart.ID);
}
} catch (PartInitException e) {
editor = null;
}
if (editor == null) {
return;
}
QueryEditorPart queryEditor = (QueryEditorPart) editor;
if (!StringUtil.isEmpty(queryEditor.getCurrentQuery())) {
queryEditor.addEditorTab();
}
queryEditor.setQuery(sql, false, false, false);
queryEditor.setFocus();
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class BrokerEnvStatusView method createTable.
/**
* This method initializes table
*
*/
private void createTable() {
tableViewer = new TableViewer(composite, SWT.FULL_SELECTION);
tableViewer.getTable().setHeaderVisible(true);
tableViewer.getTable().setLinesVisible(true);
BrokerTblColumnSetHelp bcsh = BrokerTblColumnSetHelp.getInstance();
bcsh.loadSetting(BrokerTblColumnSetHelp.StatusColumn.BrokerEnvStatusColumn, BrokerEnvStatusColumn.values());
TableLayout tlayout = new TableLayout();
for (BrokerEnvStatusColumn column : BrokerEnvStatusColumn.values()) {
if (column.getValue() == -1) {
tlayout.addColumnData(new ColumnWeightData(0, 0, false));
} else {
tlayout.addColumnData(new ColumnWeightData(10, 40, true));
}
}
tableViewer.getTable().setLayout(tlayout);
tableViewer.getTable().addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent event) {
int index = -1;
if ((index = tableViewer.getTable().getSelectionIndex()) >= 0) {
TableItem tableItem = tableViewer.getTable().getItem(index);
String brokename = tableItem.getText(0).trim();
ICubridNode input = null;
for (ICubridNode node : cubridNode.getChildren()) {
if (node.getLabel().equalsIgnoreCase(brokename)) {
input = node;
break;
}
}
LayoutManager.getInstance().setCurrentSelectedNode(input);
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
IWorkbenchPage activePage = window.getActivePage();
IViewPart viewPart = window.getActivePage().findView(BrokerStatusView.ID);
if (null != viewPart) {
activePage.hideView(viewPart);
}
try {
activePage.showView(BrokerStatusView.ID);
} catch (PartInitException e1) {
LOGGER.error(e1.getMessage(), e1);
}
}
}
});
makeTableColumn();
tableViewer.setContentProvider(new BrokersStatusContentProvider());
ServerInfo serverInfo = cubridNode.getServer().getServerInfo();
BrokersStatusLabelProvider brokersStatusLabelProvider = new BrokersStatusLabelProvider();
brokersStatusLabelProvider.setServerInfo(serverInfo);
tableViewer.setLabelProvider(brokersStatusLabelProvider);
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class QueryNewCustomAction method run.
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
Object[] selected = getSelectedObj();
LoginQueryEditDialog dialog = new LoginQueryEditDialog(getShell());
if (selected != null && selected.length == 1 && selected[0] instanceof ISchemaNode) {
dialog.setSelServerName(((ISchemaNode) selected[0]).getServer().getServerName());
dialog.setSelDatabaseName(((ISchemaNode) selected[0]).getDatabase().getName());
} else if (selected != null && selected.length == 1 && selected[0] instanceof CubridServer) {
dialog.setSelServerName(((CubridServer) selected[0]).getName());
} else {
dialog.setSelServerName(DatabaseNavigatorMenu.SELF_DATABASE_SELECTED_LABEL);
}
if (dialog.open() == IDialogConstants.OK_ID) {
try {
IEditorInput input = new QueryUnit();
IEditorPart editor = window.getActivePage().openEditor(input, QueryEditorPart.ID);
((QueryEditorPart) editor).connect(DatabaseNavigatorMenu.SELF_DATABASE);
} catch (PartInitException e) {
LOGGER.error(e.getMessage());
}
}
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class BrokerConfigEditComposite method createCubridBrokerConfPropEditor.
/**
* Create property editor
*
* @param cubridBrokerConfTabFolder
*/
public void createCubridBrokerConfPropEditor(CTabFolder cubridBrokerConfTabFolder) {
final Composite comp = new Composite(cubridBrokerConfTabFolder, SWT.NONE);
comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
comp.setLayout(new GridLayout(1, false));
sourceCTabItem = new CTabItem(cubridBrokerConfTabFolder, SWT.NONE);
sourceCTabItem.setText(Messages.cubridBrokerConfEditorCTabItemSource);
final Composite editorComp = new Composite(comp, SWT.BORDER);
editorComp.setLayoutData(new GridData(GridData.FILL_BOTH));
final GridLayout gridLayout = createGridLayout(1, 0, 0);
gridLayout.horizontalSpacing = 0;
editorComp.setLayout(gridLayout);
propEditor = new PropEditor();
try {
propEditor.init(editorPart.getEditorSite(), editorPart.getEditorInput());
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
propEditor.createPartControl(editorComp);
propEditor.getDocument().addDocumentListener(new DocumentAdpater());
sourceCTabItem.setControl(comp);
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class CubridProjectSiteAction method run.
public void run() {
String url = CommonUITool.urlEncodeForSpaces(Messages.msgCubridProjectSiteUrl);
try {
IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = support.getExternalBrowser();
browser.openURL(new URL(url));
} catch (PartInitException e) {
LOGGER.error("Can not initialize web browser on the application.", e);
} catch (MalformedURLException e) {
LOGGER.error("The url {} is invalid.", url, e);
}
}
Aggregations