use of org.eclipse.jface.viewers.CellEditor in project cubrid-manager by CUBRID.
the class ColumnDirectEditPolicy method getDirectEditCommand.
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
ERTableColumn column = (ERTableColumn) getHost().getModel();
ModifyColumnLabelCommand cmd = new ModifyColumnLabelCommand(column);
CellEditor cellEditor = request.getCellEditor();
cmd.changeNameType((String) cellEditor.getValue());
return cmd;
}
use of org.eclipse.jface.viewers.CellEditor in project cubrid-manager by CUBRID.
the class ColumnDirectEditPolicy method storeOldEditValue.
@Override
protected void storeOldEditValue(DirectEditRequest request) {
CellEditor cellEditor = request.getCellEditor();
oldValue = (String) cellEditor.getValue();
}
use of org.eclipse.jface.viewers.CellEditor in project cubrid-manager by CUBRID.
the class TableDirectEditPolicy method getDirectEditCommand.
@Override
protected Command getDirectEditCommand(DirectEditRequest request) {
ModifyTableNameCommand cmd = new ModifyTableNameCommand();
ERTable erTable = (ERTable) getHost().getModel();
cmd.setTable(erTable);
cmd.setOldName(erTable.getShownName());
CellEditor cellEditor = request.getCellEditor();
String value = (String) cellEditor.getValue();
cmd.setName(value);
return cmd;
}
use of org.eclipse.jface.viewers.CellEditor in project azure-tools-for-java by Microsoft.
the class SparkSubmissionExDialog method createContents.
@Override
protected Control createContents(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
container.setLayout(gridLayout);
GridData gridData = new GridData();
gridData.widthHint = 550;
container.setLayoutData(gridData);
Label clusterListLabel = new Label(container, SWT.LEFT);
clusterListLabel.setText("Cluster Name:");
gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
Composite composite = new Composite(container, SWT.NONE);
composite.setLayout(gridLayout);
composite.setLayoutData(gridData);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
clustersListComboBox = new Combo(composite, SWT.READ_ONLY);
clustersListComboBox.setLayoutData(gridData);
clustersListComboBox.setToolTipText("The HDInsight Spark cluster you want to submit your application to. Only Linux cluster is supported.");
for (IClusterDetail clusterDetail : cachedClusterDetails) {
// mapClusterNameToClusterDetail.put(clusterDetail.getName(), clusterDetail);
clustersListComboBox.add(clusterDetail.getName());
clustersListComboBox.setData(clusterDetail.getName(), clusterDetail);
// if (clusterComboBoxModel.getSize() == 0) {
// clusterComboBoxModel.setSelectedItem(clusterDetail.getName());
// }
}
if (cachedClusterDetails.size() > 0) {
clustersListComboBox.select(0);
}
Button clusterListButton = new Button(composite, SWT.PUSH);
clusterListButton.setToolTipText("Refresh");
clusterListButton.setImage(Activator.getImageDescriptor(CommonConst.RefreshIConPath).createImage());
String tipInfo = "The Artifact you want to use.";
Label artifactSelectLabel = new Label(container, SWT.LEFT);
artifactSelectLabel.setText("Select an Artifact to submit");
artifactSelectLabel.setToolTipText(tipInfo);
gridData = new GridData();
gridData.horizontalSpan = 2;
artifactSelectLabel.setLayoutData(gridData);
intelliJArtifactRadioButton = new Button(container, SWT.RADIO);
intelliJArtifactRadioButton.setText("Artifact from Eclipse project:");
intelliJArtifactRadioButton.setSelection(true);
intelliJArtifactRadioButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent arg0) {
selectedArtifactComboBox.setEnabled(true);
selectedArtifactTextField.setEnabled(false);
// mainClassTextField.setButtonEnabled(true);
//
// setVisibleForFixedErrorMessageLabel(2, false);
//
// if (selectedArtifactComboBox.getItemCount() == 0) {
// setVisibleForFixedErrorMessageLabel(2, true);
// }
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
}
});
gridData = new GridData();
gridData.grabExcessHorizontalSpace = true;
gridData.horizontalAlignment = SWT.FILL;
selectedArtifactComboBox = new Combo(container, SWT.READ_ONLY);
selectedArtifactComboBox.setToolTipText(tipInfo);
selectedArtifactComboBox.setLayoutData(gridData);
String[] projects = getProjects();
selectedArtifactComboBox.setItems(projects);
if (projects.length > 0) {
selectedArtifactComboBox.select(0);
}
localArtifactRadioButton = new Button(container, SWT.RADIO);
localArtifactRadioButton.setText("Artifact from hard disk:");
localArtifactRadioButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
selectedArtifactComboBox.setEnabled(false);
selectedArtifactTextField.setEnabled(true);
// mainClassTextField.setButtonEnabled(false);
//
// setVisibleForFixedErrorMessageLabel(1, false);
//
// if (StringHelper.isNullOrWhiteSpace(selectedArtifactTextField.getText())) {
// setVisibleForFixedErrorMessageLabel(2, true);
// }
}
@Override
public void widgetDefaultSelected(SelectionEvent arg0) {
// TODO Auto-generated method stub
}
});
gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
composite = new Composite(container, SWT.NONE);
composite.setLayout(gridLayout);
composite.setLayoutData(gridData);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
selectedArtifactTextField = new Text(composite, SWT.LEFT | SWT.BORDER);
selectedArtifactTextField.setLayoutData(gridData);
artifactBrowseButton = new Button(composite, SWT.PUSH);
artifactBrowseButton.setText("Browse");
artifactBrowseButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
FileDialog dialog = new FileDialog(SparkSubmissionExDialog.this.getShell());
String[] extensions = { "*.jar", "*.JAR" };
dialog.setFilterExtensions(extensions);
String file = dialog.open();
if (file != null) {
selectedArtifactTextField.setText(file);
}
}
});
Label sparkMainClassLabel = new Label(container, SWT.LEFT);
sparkMainClassLabel.setText("Main class name");
sparkMainClassLabel.setToolTipText("Application's java/spark main class");
gridLayout = new GridLayout();
gridLayout.numColumns = 2;
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
composite = new Composite(container, SWT.NONE);
composite.setLayout(gridLayout);
composite.setLayoutData(gridData);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
mainClassTextField = new Text(composite, SWT.LEFT | SWT.BORDER);
mainClassTextField.setLayoutData(gridData);
Label jobConfigurationLabel = new Label(container, SWT.LEFT);
jobConfigurationLabel.setText("Job configurations");
gridData = new GridData();
gridData.verticalAlignment = SWT.TOP;
jobConfigurationLabel.setLayoutData(gridData);
jobConfigurationTable = new Table(container, SWT.BORDER);
jobConfigurationTable.setHeaderVisible(true);
jobConfigurationTable.setLinesVisible(true);
gridData = new GridData();
gridData.heightHint = 75;
gridData.horizontalAlignment = SWT.FILL;
GridLayout gridLayoutTable = new GridLayout();
gridLayoutTable.numColumns = 2;
gridLayoutTable.marginRight = 0;
jobConfigurationTable.setLayout(gridLayoutTable);
jobConfigurationTable.setLayoutData(gridData);
TableColumn key = new TableColumn(jobConfigurationTable, SWT.FILL);
key.setText(COLUMN_NAMES[0]);
key.setWidth(150);
TableColumn value = new TableColumn(jobConfigurationTable, SWT.FILL);
value.setText(COLUMN_NAMES[1]);
value.setWidth(80);
tableViewer = new TableViewer(jobConfigurationTable);
tableViewer.setUseHashlookup(true);
tableViewer.setColumnProperties(COLUMN_NAMES);
CellEditor[] editors = new CellEditor[2];
editors[1] = new TextCellEditor(jobConfigurationTable);
tableViewer.setCellEditors(editors);
tableViewer.setContentProvider(new JobConfigurationContentProvider());
tableViewer.setLabelProvider(new JobConfigurationLabelProvider());
tableViewer.setCellModifier(new JobConfigurationCellModifier());
initializeTable();
Label label = new Label(container, SWT.LEFT);
label.setText("Command line arguments");
tipInfo = "Command line arguments used in your main class; multiple arguments should be split by space.";
label.setToolTipText(tipInfo);
commandLineTextField = new Text(container, SWT.LEFT | SWT.BORDER);
commandLineTextField.setToolTipText(tipInfo);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
commandLineTextField.setLayoutData(gridData);
tipInfo = "Files to be placed on the java classpath; The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;)";
Label referencedJarsLabel = new Label(container, SWT.LEFT);
referencedJarsLabel.setText("Referenced Jars");
referencedJarsLabel.setToolTipText(tipInfo);
referencedJarsTextField = new Text(container, SWT.BORDER | SWT.LEFT);
referencedJarsTextField.setToolTipText(tipInfo);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
referencedJarsTextField.setLayoutData(gridData);
tipInfo = "Files to be placed in executor working directory. The path needs to be a Azure Blob Storage Path (path started with wasb://); Multiple paths should be split by semicolon (;) ";
Label referencedFilesLabel = new Label(container, SWT.LEFT);
referencedFilesLabel.setText("Referenced Files");
referencedFilesLabel.setToolTipText(tipInfo);
referencedFilesTextField = new Text(container, SWT.BORDER | SWT.LEFT);
referencedFilesTextField.setToolTipText(tipInfo);
gridData = new GridData();
gridData.horizontalAlignment = SWT.FILL;
gridData.grabExcessHorizontalSpace = true;
referencedFilesTextField.setLayoutData(gridData);
return super.createContents(parent);
}
use of org.eclipse.jface.viewers.CellEditor in project cubrid-manager by CUBRID.
the class RenameDatabaseDialog method createNewDatabaseInfoComp.
/**
*
* Create database name group
*
* @param parent the parent composite
*/
private void createNewDatabaseInfoComp(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
GridData gridData = new GridData(GridData.FILL_BOTH);
comp.setLayoutData(gridData);
GridLayout layout = new GridLayout();
layout.numColumns = 3;
comp.setLayout(layout);
Label databaseNameLabel = new Label(comp, SWT.LEFT | SWT.WRAP);
databaseNameLabel.setText(Messages.lblNewDbName);
gridData = new GridData();
gridData.widthHint = 150;
databaseNameLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
databaseNameText = new Text(comp, SWT.BORDER);
databaseNameText.setTextLimit(ValidateUtil.MAX_DB_NAME_LENGTH);
databaseNameText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 2, 1, -1, -1));
exVolumePathButton = new Button(comp, SWT.LEFT | SWT.RADIO);
exVolumePathButton.setText(Messages.btnExtendedVolumePath);
exVolumePathButton.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
exVolumePathButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (exVolumePathButton.getSelection()) {
exVolumePathText.setEditable(true);
renameVolumeButton.setSelection(false);
volumeTable.setEnabled(false);
if (selectVolumeDirectoryButton != null) {
ServerInfo serverInfo = database.getServer().getServerInfo();
selectVolumeDirectoryButton.setEnabled(serverInfo != null && serverInfo.isLocalServer());
}
} else {
exVolumePathText.setEditable(false);
volumeTable.setEnabled(true);
if (selectVolumeDirectoryButton != null) {
selectVolumeDirectoryButton.setEnabled(false);
}
}
}
});
exVolumePathButton.setSelection(true);
boolean isLocalServer = database.getServer().getServerInfo().isLocalServer();
exVolumePathText = new Text(comp, SWT.BORDER);
exVolumePathText.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, isLocalServer ? 1 : 2, 1, -1, -1));
if (isLocalServer) {
selectVolumeDirectoryButton = new Button(comp, SWT.NONE);
selectVolumeDirectoryButton.setText(Messages.btnBrowse);
selectVolumeDirectoryButton.setLayoutData(CommonUITool.createGridData(1, 1, 80, -1));
selectVolumeDirectoryButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String text = exVolumePathText.getText();
if (text == null || text.trim().length() == 0) {
text = CubridManagerUIPlugin.getPluginDialogSettings().get(KEY_EXTENDED_VOLUME_PATH + database.getId());
}
if (text == null || text.trim().length() == 0) {
text = extVolumePath;
}
DirectoryDialog dlg = new DirectoryDialog(getShell());
if (text != null) {
dlg.setFilterPath(text);
}
dlg.setText(Messages.msgSelectDir);
dlg.setMessage(Messages.msgSelectDir);
String dir = dlg.open();
if (dir != null) {
exVolumePathText.setText(dir);
CubridManagerUIPlugin.getPluginDialogSettings().put(KEY_EXTENDED_VOLUME_PATH + database.getId(), dir);
}
}
});
selectVolumeDirectoryButton.setEnabled(true);
}
renameVolumeButton = new Button(comp, SWT.LEFT | SWT.RADIO);
renameVolumeButton.setText(Messages.btnRenameIndiVolume);
renameVolumeButton.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 3, 1, -1, -1));
renameVolumeButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (renameVolumeButton.getSelection()) {
volumeTable.setEnabled(true);
} else {
volumeTable.setEnabled(false);
}
}
});
final String[] columnNameArr = new String[] { Messages.tblColumnCurrVolName, Messages.tblColumnNewVolName, Messages.tblColumnCurrDirPath, Messages.tblColumnNewDirPath };
volumeTableViewer = CommonUITool.createCommonTableViewer(comp, new TableViewerSorter(), columnNameArr, CommonUITool.createGridData(GridData.FILL_BOTH, 3, 1, -1, 200));
volumeTable = volumeTableViewer.getTable();
volumeTable.setEnabled(false);
volumeTableViewer.setColumnProperties(columnNameArr);
CellEditor[] editors = new CellEditor[4];
editors[0] = null;
editors[1] = new TextCellEditor(volumeTable);
editors[2] = null;
editors[3] = new TextCellEditor(volumeTable);
volumeTableViewer.setCellEditors(editors);
volumeTableViewer.setCellModifier(new ICellModifier() {
@SuppressWarnings("unchecked")
public boolean canModify(Object element, String property) {
Map<String, String> map = (Map<String, String>) element;
String name = map.get("0");
if (property.equals(columnNameArr[0]) || property.equals(columnNameArr[2])) {
return false;
} else if (property.equals(columnNameArr[1]) && name.equals(database.getName())) {
return false;
}
return true;
}
@SuppressWarnings("unchecked")
public Object getValue(Object element, String property) {
Map<String, String> map = (Map<String, String>) element;
if (property.equals(columnNameArr[1])) {
return map.get("1");
} else if (property.equals(columnNameArr[3])) {
return map.get("3");
}
return null;
}
@SuppressWarnings("unchecked")
public void modify(Object element, String property, Object value) {
Object obj = null;
if (element instanceof Item) {
obj = ((Item) element).getData();
}
if (obj == null) {
return;
}
Map<String, String> map = (Map<String, String>) obj;
if (property.equals(columnNameArr[1])) {
map.put("1", value.toString());
} else if (property.equals(columnNameArr[3])) {
map.put("3", value.toString());
}
volumeTableViewer.refresh();
}
});
forceDelBackupVolumeButton = new Button(comp, SWT.LEFT | SWT.CHECK);
forceDelBackupVolumeButton.setText(Messages.btnForceDelBackupVolume);
forceDelBackupVolumeButton.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 3, 1, -1, -1));
}
Aggregations