use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class OpenTargetAction method openTriggersDetailInfoEditor.
/**
* open trigger detail info part
* @param database
*/
public void openTriggersDetailInfoEditor(CubridDatabase database) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
if (database == null) {
return;
}
/*Check it open same editor*/
IEditorPart editorPart = getOpenedEditorPart(database, TriggerDashboardEditorPart.ID);
if (editorPart == null) {
OpenTriggerDetailInfoPartProgress progress = new OpenTriggerDetailInfoPartProgress(database);
progress.loadTriggerInfoList();
if (progress.isSuccess()) {
TriggerDashboardInput input = new TriggerDashboardInput(database, progress.getTriggerList());
try {
window.getActivePage().openEditor(input, TriggerDashboardEditorPart.ID);
} catch (PartInitException e) {
LOGGER.error("Can not initialize the trigger view list UI.", e);
}
}
} else {
TriggerDashboardEditorPart triggerDetailInfoPart = (TriggerDashboardEditorPart) editorPart;
window.getActivePage().activate(triggerDetailInfoPart);
triggerDetailInfoPart.refresh();
}
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class SearchContributionComposite method processSearch.
public void processSearch() {
if (text.getText().length() == 0) {
return;
}
String key = StringUtil.urlencode(text.getText(), "UTF-8");
if (key == null) {
LOGGER.error("Encode key word error");
return;
}
String url = getUrl(key);
BrowserEditorPart browserViewPart = null;
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IEditorReference[] editorReferences = window.getActivePage().getEditorReferences();
for (IEditorReference reference : editorReferences) {
if (reference.getId().equals(BrowserEditorPart.ID)) {
browserViewPart = (BrowserEditorPart) reference.getEditor(true);
}
}
if (browserViewPart == null) {
try {
browserViewPart = (BrowserEditorPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new BrowserEditorPartInput(), BrowserEditorPart.ID);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
if (browserViewPart != null) {
browserViewPart.go(url);
// For bug TOOLS-1014
window.getActivePage().activate(browserViewPart);
}
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method showLogView.
/**
* show sql log view at broker table
*
* @param type sql type
*/
public void showLogView(String type) {
try {
int i = brokerInfoTable.getSelectionIndex();
if (i < 0) {
return;
}
final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window == null) {
return;
}
String brokerName = brokerInfoTable.getItem(i).getText(0);
String serverId = brokerInfoTable.getItem(i).getText(1);
//get all log infor
BrokerLogInfos brokerLogInfos = new BrokerLogInfos();
final CommonQueryTask<BrokerLogInfos> task = new CommonQueryTask<BrokerLogInfos>(database.getDatabaseInfo().getServerInfo(), CommonSendMsg.getGetBrokerLogFileInfoMSGItems(), brokerLogInfos);
task.setBroker(brokerName);
task.execute();
brokerLogInfos = task.getResultModel();
String logFileName = brokerName + "_" + serverId + "." + type + ".log";
sqlLogViewPartName = logFileName + "@" + database.getServer().getLabel() + ":" + database.getServer().getMonPort();
List<LogInfo> logInfoList = brokerLogInfos == null ? null : brokerLogInfos.getBrokerLogInfoList().getLogFileInfoList();
task.finish();
//get the current log
LogInfo logInfo = null;
if (logInfoList != null && !logInfoList.isEmpty()) {
for (LogInfo logInfoInlist : logInfoList) {
if (logFileName.equals(logInfoInlist.getName())) {
logInfo = logInfoInlist;
break;
}
}
}
if (logInfo == null) {
String msg = Messages.bind(com.cubrid.cubridmanager.ui.logs.Messages.errLogFileNoExist, logFileName);
LOGGER.error(msg);
//CommonUITool.openErrorBox(msg);
return;
}
final String filePath = logInfo.getPath();
TaskJobExecutor taskJobExecutor = new TaskJobExecutor() {
public IStatus exec(IProgressMonitor monitor) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
for (ITask task : taskList) {
task.execute();
final String msg = task.getErrorMsg();
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (msg != null && msg.length() > 0 && !monitor.isCanceled()) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, msg);
}
if (task instanceof CheckFileTask) {
CheckFileTask checkFileTask = (CheckFileTask) task;
final String[] files = checkFileTask.getExistFiles();
if (files == null || files.length == 0) {
return new Status(IStatus.ERROR, CubridManagerUIPlugin.PLUGIN_ID, Messages.bind(com.cubrid.cubridmanager.ui.logs.Messages.errLogFileNoExist, filePath));
}
} else if (task instanceof GetLogListTask) {
GetLogListTask getLogListTask = (GetLogListTask) task;
final LogContentInfo logContentInfo = (LogContentInfo) getLogListTask.getLogContent();
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
ICubridNode logInfoNode = new DefaultCubridNode("", "", "");
IEditorPart editor = window.getActivePage().openEditor(logInfoNode, LogEditorPart.ID);
((LogEditorPart) editor).setTableInfo(logContentInfo, true);
((LogEditorPart) editor).setShowLogPartName(sqlLogViewPartName);
} catch (PartInitException e) {
LOGGER.error(e.getMessage(), e);
}
}
});
}
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
task.finish();
}
return Status.OK_STATUS;
}
};
CheckFileTask checkFileTask = new CheckFileTask(cubridNode.getServer().getServerInfo());
checkFileTask.setFile(new String[] { filePath });
taskJobExecutor.addTask(checkFileTask);
GetLogListTask getLogListTask = new GetLogListTask(cubridNode.getServer().getServerInfo());
getLogListTask.setPath(filePath);
getLogListTask.setStart("1");
getLogListTask.setEnd("100");
taskJobExecutor.addTask(getLogListTask);
String jobName = com.cubrid.cubridmanager.ui.logs.Messages.viewLogJobName + " - " + cubridNode.getName() + "@" + cubridNode.getServer().getName();
taskJobExecutor.schedule(jobName, null, false, Job.SHORT);
} catch (Exception e) {
LOGGER.error(Messages.exportDashboardOpenSQLLogErrMsg, e);
// CommonUITool.openErrorBox(Messages.exportDashboardOpenSQLLogErrMsg);
}
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class OpenJobAutomationInfoAction method openJobsDetailInfoEditor.
/**
* open job detail info part
* @param database
*/
public void openJobsDetailInfoEditor(CubridDatabase database) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == window) {
return;
}
if (database == null) {
return;
}
/*Check it open same editor*/
IEditorPart editorPart = getOpenedEditorPart(database, JobAutoDashboardEditorPart.ID);
if (editorPart == null) {
OpenJobAutomationInfoPartProgress progress = new OpenJobAutomationInfoPartProgress(database);
progress.loadJobAutomationInfoList();
if (progress.isSuccess()) {
JobAutoDashboardInput input = new JobAutoDashboardInput(database, progress.getBackupPlanInfoList(), progress.getQueryPlanInfoList());
try {
window.getActivePage().openEditor(input, JobAutoDashboardEditorPart.ID);
} catch (PartInitException e) {
LOGGER.error("Can not initialize the trigger view list UI.", e);
}
}
} else {
JobAutoDashboardEditorPart jobAutoDetailInfoPart = (JobAutoDashboardEditorPart) editorPart;
window.getActivePage().activate(jobAutoDetailInfoPart);
jobAutoDetailInfoPart.refreshAll();
}
}
use of org.eclipse.ui.PartInitException in project cubrid-manager by CUBRID.
the class EditConfigEditor method createPropEditor.
/**
*
* Create the property editor
*
* @param parent the Composite
*/
private void createPropEditor(Composite parent) {
final Composite editorComp = new Composite(parent, SWT.NONE);
{
editorComp.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayout gridLayout = new GridLayout();
gridLayout.marginHeight = 0;
gridLayout.horizontalSpacing = 0;
gridLayout.marginWidth = 0;
editorComp.setLayout(gridLayout);
}
propEditor = new PropEditor();
try {
propEditor.init(this.getEditorSite(), this.getEditorInput());
} catch (PartInitException ex) {
LOGGER.error(ex.getMessage());
}
propEditor.createPartControl(editorComp);
}
Aggregations