use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class SummaryTableManager method createSummaryTable.
/**
* Create new loyalty program
*/
private void createSummaryTable(boolean isTableSource) {
// $NON-NLS-1$ //$NON-NLS-2$
DciSummaryTable t = new DciSummaryTable("", "", isTableSource);
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, t);
if (dlg != null) {
dlg.getShell().setText(Messages.get().SummaryTableManager_TitleCreate);
dlg.open();
if (t.getId() != 0) {
// was saved to server
DciSummaryTableDescriptor d = new DciSummaryTableDescriptor(t);
descriptors.put(d.getId(), d);
viewer.setInput(descriptors.values().toArray());
viewer.setSelection(new StructuredSelection(d));
}
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class ObjectToolsEditor method createTool.
/**
* Create new tool
*/
private void createTool() {
final CreateNewToolDialog dlg = new CreateNewToolDialog(getSite().getShell());
if (dlg.open() == Window.OK) {
new ConsoleJob(Messages.get().ObjectToolsEditor_JobNewId, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final long toolId = session.generateObjectToolId();
final ObjectToolDetails details = new ObjectToolDetails(toolId, dlg.getType(), dlg.getName());
session.modifyObjectTool(details);
runInUIThread(new Runnable() {
@Override
public void run() {
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, details);
dlg.open();
if (details.isModified())
saveObjectTool(details);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get(getDisplay()).ObjectToolsEditor_JobNewIdError;
}
}.start();
}
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project netxms by netxms.
the class HistoricalGraphView method createActions.
/**
* Create actions
*/
private void createActions() {
actionRefresh = new RefreshAction(this) {
@Override
public void run() {
updateChart();
}
};
actionProperties = new Action(Messages.get().HistoricalGraphView_Properties) {
@Override
public void run() {
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, settings);
if (dlg != null) {
dlg.open();
configureGraphFromSettings();
refreshMenuSelection();
}
}
};
actionAutoRefresh = new Action(Messages.get().HistoricalGraphView_Autorefresh) {
@Override
public void run() {
settings.setAutoRefresh(!settings.isAutoRefresh());
setChecked(settings.isAutoRefresh());
refreshController.setInterval(settings.isAutoRefresh() ? settings.getRefreshRate() : -1);
}
};
actionAutoRefresh.setChecked(settings.isAutoRefresh());
actionLogScale = new Action(Messages.get().HistoricalGraphView_LogScale) {
@Override
public void run() {
try {
chart.setLogScaleEnabled(!settings.isLogScale());
settings.setLogScale(!settings.isLogScale());
} catch (IllegalStateException e) {
MessageDialogHelper.openError(getSite().getShell(), Messages.get().HistoricalGraphView_Error, String.format(Messages.get().HistoricalGraphView_LogScaleSwitchError, e.getLocalizedMessage()));
// $NON-NLS-1$
Activator.logError("Cannot change log scale mode", e);
}
setChecked(settings.isLogScale());
}
};
actionLogScale.setChecked(settings.isLogScale());
actionZoomIn = new Action(Messages.get().HistoricalGraphView_ZoomIn) {
@Override
public void run() {
chart.zoomIn();
}
};
actionZoomIn.setImageDescriptor(SharedIcons.ZOOM_IN);
actionZoomOut = new Action(Messages.get().HistoricalGraphView_ZoomOut) {
@Override
public void run() {
chart.zoomOut();
}
};
actionZoomOut.setImageDescriptor(SharedIcons.ZOOM_OUT);
actionAdjustX = createAction(ActionType.ADJUST_X, chart);
actionAdjustY = createAction(ActionType.ADJUST_Y, chart);
actionAdjustBoth = createAction(ActionType.ADJUST_BOTH, chart);
actionShowLegend = new Action(Messages.get().HistoricalGraphView_ShowLegend) {
@Override
public void run() {
settings.setShowLegend(actionShowLegend.isChecked());
chart.setLegendVisible(settings.isShowLegend());
}
};
actionShowLegend.setChecked(settings.isShowLegend());
actionExtendedLegend = new Action(Messages.get().HistoricalGraphView_ExtendedLegend) {
@Override
public void run() {
settings.setExtendedLegend(actionExtendedLegend.isChecked());
chart.setExtendedLegend(settings.isExtendedLegend());
}
};
actionExtendedLegend.setChecked(settings.isExtendedLegend());
actionLegendLeft = new Action(Messages.get().HistoricalGraphView_PlaceOnLeft, Action.AS_RADIO_BUTTON) {
@Override
public void run() {
settings.setLegendPosition(GraphSettings.POSITION_LEFT);
chart.setLegendPosition(settings.getLegendPosition());
}
};
actionLegendLeft.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_LEFT);
actionLegendRight = new Action(Messages.get().HistoricalGraphView_PlaceOnRight, Action.AS_RADIO_BUTTON) {
@Override
public void run() {
settings.setLegendPosition(GraphSettings.POSITION_RIGHT);
chart.setLegendPosition(settings.getLegendPosition());
}
};
actionLegendRight.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_RIGHT);
actionLegendTop = new Action(Messages.get().HistoricalGraphView_PlaceOnTop, Action.AS_RADIO_BUTTON) {
@Override
public void run() {
settings.setLegendPosition(GraphSettings.POSITION_TOP);
chart.setLegendPosition(settings.getLegendPosition());
}
};
actionLegendTop.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_TOP);
actionLegendBottom = new Action(Messages.get().HistoricalGraphView_PlaceOnBottom, Action.AS_RADIO_BUTTON) {
@Override
public void run() {
settings.setLegendPosition(GraphSettings.POSITION_BOTTOM);
chart.setLegendPosition(settings.getLegendPosition());
}
};
actionLegendBottom.setChecked(settings.getLegendPosition() == GraphSettings.POSITION_BOTTOM);
actionSave = new Action(Messages.get().HistoricalGraphView_Save, SharedIcons.SAVE) {
@Override
public void run() {
String initalName = settings.getName().compareTo("noname") == 0 ? settings.getTitle() : settings.getName();
saveGraph(initalName, null, false, false);
}
};
// TODO: add check that graph uses only one node as source
actionSaveAsTemplate = new Action("Save as template", SharedIcons.SAVE_AS) {
@Override
public void run() {
String initalName = settings.getName().compareTo("noname") == 0 ? settings.getTitle() : settings.getName();
saveGraph(initalName, null, false, true);
}
};
actionStacked = new Action(Messages.get().HistoricalGraphView_Stacked, Action.AS_CHECK_BOX) {
@Override
public void run() {
settings.setStacked(actionStacked.isChecked());
configureGraphFromSettings();
}
};
actionStacked.setChecked(settings.isStacked());
actionTranslucent = new Action(Messages.get().HistoricalGraphView_Translucent, Action.AS_CHECK_BOX) {
@Override
public void run() {
settings.setTranslucent(actionTranslucent.isChecked());
configureGraphFromSettings();
}
};
actionTranslucent.setChecked(settings.isTranslucent());
actionAreaChart = new Action("Area chart", Action.AS_CHECK_BOX) {
@Override
public void run() {
settings.setArea(actionAreaChart.isChecked());
configureGraphFromSettings();
}
};
actionAreaChart.setChecked(settings.isArea());
presetActions = createPresetActions(new PresetHandler() {
@Override
public void onPresetSelected(int units, int range) {
settings.setTimeUnits(units);
settings.setTimeRange(range);
updateChart();
}
});
actionSaveAsImage = new Action("Save as image", SharedIcons.SAVE_AS_IMAGE) {
@Override
public void run() {
chart.saveAsImage();
}
};
}
use of org.eclipse.ui.internal.dialogs.PropertyDialog in project mdw-designer by CenturyLinkCloud.
the class ProjectSection method setSelection.
@Override
public void setSelection(WorkflowElement selection) {
if (project != null)
project.removeElementChangeListener(this);
project = (WorkflowProject) selection;
project.addElementChangeListener(this);
// dispose controls to render dynamically
if (sourceProjectEditor != null)
sourceProjectEditor.dispose();
if (jdbcUrlEditor != null)
jdbcUrlEditor.dispose();
if (hostEditor != null)
hostEditor.dispose();
if (portEditor != null)
portEditor.dispose();
if (webContextRootEditor != null)
webContextRootEditor.dispose();
if (updateServerCacheEditor != null)
updateServerCacheEditor.dispose();
if (localProjectEditor != null)
localProjectEditor.dispose();
if (localProjectInfoEditor != null)
localProjectInfoEditor.dispose();
if (mdwVersionEditor != null)
mdwVersionEditor.dispose();
if (appVersionEditor != null)
appVersionEditor.dispose();
// source project text field
sourceProjectEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
sourceProjectEditor.setLabel("Source Project");
sourceProjectEditor.setWidth(200);
sourceProjectEditor.render(composite);
sourceProjectEditor.setValue(project.getSourceProjectName());
sourceProjectEditor.setEditable(false);
if (!project.checkRequiredVersion(6, 0)) {
// jdbc url text field
jdbcUrlEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
jdbcUrlEditor.setLabel("JDBC URL");
jdbcUrlEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getMdwDataSource().setJdbcUrlWithCredentials(((String) newValue).trim());
project.getMdwDataSource().setEntrySource("projectSection");
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getMdwDataSource());
}
});
jdbcUrlEditor.render(composite);
jdbcUrlEditor.setValue(project.getMdwDataSource().getJdbcUrlWithMaskedCredentials());
jdbcUrlEditor.setEditable(!project.isReadOnly());
}
// host text field
hostEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
hostEditor.setLabel("Server Host");
hostEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getServerSettings().setHost((String) newValue);
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getServerSettings());
}
});
hostEditor.render(composite);
hostEditor.setValue(project.getServerSettings().getHost());
hostEditor.setEditable(!project.isReadOnly());
// port text field
portEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
portEditor.setLabel("Server Port");
portEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.getServerSettings().setPort(Integer.parseInt(((String) newValue).trim()));
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getServerSettings());
}
});
portEditor.render(composite);
portEditor.setValue(project.getServerSettings().getPort());
portEditor.setEditable(!project.isReadOnly());
// web context root text field
webContextRootEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
webContextRootEditor.setLabel("Web Context Root");
webContextRootEditor.setWidth(200);
if (project.isRemote()) {
webContextRootEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.setWebContextRoot(((String) newValue).trim());
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.getServerSettings());
}
});
}
webContextRootEditor.render(composite);
webContextRootEditor.setValue(project.getWebContextRoot());
webContextRootEditor.setEditable(!project.isReadOnly() && project.isRemote());
// refresh server cache checkbox
updateServerCacheEditor = new PropertyEditor(project, PropertyEditor.TYPE_CHECKBOX);
updateServerCacheEditor.setLabel("Update Server Cache");
updateServerCacheEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
project.setUpdateServerCache(Boolean.parseBoolean(newValue.toString()));
WorkflowProjectManager.updateProject(project);
project.fireElementChangeEvent(ChangeType.SETTINGS_CHANGE, project.isUpdateServerCache());
}
});
updateServerCacheEditor.render(composite);
updateServerCacheEditor.setValue(project.isUpdateServerCache());
updateServerCacheEditor.setEditable(!project.isReadOnly());
// mdw version combo
if (project.isRemote()) {
mdwVersionEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
} else {
mdwVersionEditor = new PropertyEditor(project, PropertyEditor.TYPE_COMBO);
String releaseUrl = mdwSettings.getMdwReleasesUrl();
if (project.getMdwMajorVersion() < 6)
mdwSettings.setMdwReleasesUrl(mdwSettings.getInternalRepositoryUrl());
List<String> versionOptions = mdwSettings.getMdwVersions();
mdwSettings.setMdwReleasesUrl(releaseUrl);
if (!versionOptions.contains(project.getMdwVersion()))
versionOptions.add(project.getMdwVersion());
mdwVersionEditor.setValueOptions(versionOptions);
mdwVersionEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
if (!project.isRemote() && !newValue.equals("")) {
project.setMdwVersion((String) newValue);
WorkflowProjectManager.updateProject(project);
if (MessageDialog.openQuestion(getShell(), "Update Framework Libraries", "Download updated framework libraries to match MDW Version selection?")) {
ProjectUpdater updater = new ProjectUpdater(getProject(), MdwPlugin.getSettings());
try {
updater.updateFrameworkJars(null);
ExtensionModulesUpdater modulesUpdater = new ExtensionModulesUpdater(getProject());
modulesUpdater.doUpdate(getShell());
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Update Framework Libraries", getProject());
}
}
if (getProject().isOsgi())
MessageDialog.openInformation(getShell(), "MDW Version Changed", "The MDW version has been updated in the plug-in settings file. Please update any MDW dependencies in your pom.xml build file.");
}
}
});
}
mdwVersionEditor.setLabel("MDW Version");
mdwVersionEditor.setWidth(100);
mdwVersionEditor.render(composite);
mdwVersionEditor.setValue(project.getMdwVersion());
mdwVersionEditor.setEditable(!project.isReadOnly() && !project.isRemote());
// app version
if (!project.isCloudProject() && !"Unknown".equals(project.getAppVersion())) {
appVersionEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
appVersionEditor.setLabel("App Version");
appVersionEditor.setWidth(200);
appVersionEditor.render(composite);
appVersionEditor.setValue(project.getAppVersion());
appVersionEditor.setEditable(false);
}
if (!project.isRemote()) {
// local project text field
localProjectEditor = new PropertyEditor(project, PropertyEditor.TYPE_TEXT);
localProjectEditor.setLabel("Workspace Project");
localProjectEditor.setWidth(200);
localProjectEditor.setReadOnly(true);
localProjectEditor.render(composite);
if (project.isCloudProject())
localProjectEditor.setValue(project.getSourceProjectName());
else
localProjectEditor.setValue(project.getEarProjectName());
if (!project.isOsgi()) {
// local project info field
localProjectInfoEditor = new PropertyEditor(project, PropertyEditor.TYPE_LINK);
localProjectInfoEditor.setLabel("Workspace Project Settings");
localProjectInfoEditor.addValueChangeListener(new ValueChangeListener() {
public void propertyValueChanged(Object newValue) {
final IProject proj = project.isCloudProject() ? project.getSourceProject() : project.getEarProject();
PropertyDialog dialog = PropertyDialog.createDialogOn(getShell(), "mdw.workflow.mdwServerConnectionsPropertyPage", proj);
if (dialog != null)
dialog.open();
}
});
localProjectInfoEditor.render(composite);
}
}
composite.layout(true);
}
Aggregations