Commit a5b3523d authored by Matija Obreza's avatar Matija Obreza
Browse files

Icons

Organized imports
parent 359e0ab4
......@@ -10,23 +10,23 @@
*******************************************************************************/
package org.eclipse.wb.swt;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
/**
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
......
......@@ -16,6 +16,14 @@
package org.genesys2.anno.gui;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.apache.log4j.Logger;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeansObservables;
......@@ -27,7 +35,15 @@ import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.databinding.viewers.ObservableMapLabelProvider;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
......@@ -47,7 +63,18 @@ import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.wb.swt.SWTResourceManager;
import org.genesys2.anno.model.ColumnDef;
import org.genesys2.anno.model.Settings;
......@@ -55,14 +82,6 @@ import org.json.JSONException;
import swing2swt.layout.BorderLayout;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AppWindow {
private static final Logger _log = Logger.getLogger(AppWindow.class);
private DataBindingContext m_bindingContext;
......@@ -161,6 +180,9 @@ public class AppWindow {
private static Image openPackageIcon;
private static Image automapColumnsIcon;
private static Image pushDataIcon;
private static Image loadWorkspaceIcon;
private static Image saveWorkspaceIcon;
private static Image settingsIcon;
private Tree filesTree;
private Display display;
private TreeViewer treeViewer;
......@@ -213,6 +235,9 @@ public class AppWindow {
AppWindow.spreadsheetIcon = ImageDescriptor.createFromURL(this.getClass().getResource("/icon/spreadsheet.png")).createImage();
AppWindow.automapColumnsIcon = ImageDescriptor.createFromURL(this.getClass().getResource("/icon/automap.png")).createImage();
AppWindow.pushDataIcon = ImageDescriptor.createFromURL(this.getClass().getResource("/icon/pushdata.png")).createImage();
AppWindow.loadWorkspaceIcon = ImageDescriptor.createFromURL(this.getClass().getResource("/icon/load.png")).createImage();
AppWindow.saveWorkspaceIcon = ImageDescriptor.createFromURL(this.getClass().getResource("/icon/save.png")).createImage();
AppWindow.settingsIcon = ImageDescriptor.createFromURL(this.getClass().getResource("/icon/settings.png")).createImage();
}
public static boolean isMac() {
......@@ -448,6 +473,36 @@ public class AppWindow {
toolBar.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
toolBar.setLayoutData(BorderLayout.NORTH);
ToolItem loadWorkSpace = new ToolItem(toolBar, SWT.NONE);
loadWorkSpace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doLoadWorkSpace();
}
});
loadWorkSpace.setText("Load");
loadWorkSpace.setImage(loadWorkspaceIcon);
ToolItem saveWorkSpace = new ToolItem(toolBar, SWT.NONE);
saveWorkSpace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doSaveWorkSpace();
}
});
saveWorkSpace.setText("Save");
saveWorkSpace.setImage(saveWorkspaceIcon);
ToolItem tltmSettings = new ToolItem(toolBar, SWT.NONE);
tltmSettings.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doSettings();
}
});
tltmSettings.setText("Settings");
tltmSettings.setImage(settingsIcon);
ToolItem tltmAddFile = new ToolItem(toolBar, SWT.NONE);
tltmAddFile.addSelectionListener(new SelectionAdapter() {
@Override
......@@ -455,7 +510,7 @@ public class AppWindow {
addSourceFile();
}
});
tltmAddFile.setText("Open");
tltmAddFile.setText("Add file");
tltmAddFile.setImage(openPackageIcon);
ToolItem tltmAutomap = new ToolItem(toolBar, SWT.NONE);
......@@ -477,72 +532,44 @@ public class AppWindow {
});
tltmPush.setText("Push");
tltmPush.setImage(pushDataIcon);
m_bindingContext = initDataBindings();
}
ToolItem saveWorkSpace = new ToolItem(toolBar, SWT.NONE);
saveWorkSpace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doSaveWorkSpace();
}
});
saveWorkSpace.setText("Save workspace");
ToolItem loadWorkSpace = new ToolItem(toolBar, SWT.NONE);
loadWorkSpace.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doLoadWorkSpace();
}
});
loadWorkSpace.setText("Load workspace");
ToolItem tltmSettings = new ToolItem(toolBar, SWT.NONE);
tltmSettings.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
doSettings();
private void doSaveWorkSpace() {
FileDialog dialog = new FileDialog(shlGenesysMagic, SWT.SAVE);
dialog.setFilterNames(new String[] { "JSON Format" });
dialog.setFilterExtensions(new String[] { "*.json" });
dialog.setFileName("workspace.json");
String path = dialog.open();
if (path != null) {
try {
builder.saveWorkspace(path, settings);
} catch (JSONException e) {
_log.error(e.getMessage());
} catch (IOException e) {
_log.error(e.getMessage());
}
});
tltmSettings.setText("Settings");
m_bindingContext = initDataBindings();
}
}
private void doSaveWorkSpace() {
FileDialog dialog = new FileDialog(shlGenesysMagic, SWT.SAVE);
dialog.setFilterNames(new String[]{"JSON Format"});
dialog.setFilterExtensions(new String[]{"*.json"});
dialog.setFileName("workspace.json");
String path = dialog.open();
if (path!=null){
try {
builder.saveWorkspace(path,settings);
} catch (JSONException e) {
_log.error(e.getMessage());
} catch (IOException e) {
_log.error(e.getMessage());
}
}
}
private void doLoadWorkSpace() {
FileDialog dialog = new FileDialog(shlGenesysMagic, SWT.MULTI);
dialog.setFilterNames(new String[]{"JSON Format"});
dialog.setFilterExtensions(new String[]{"*.json"});
String path = dialog.open();
if (path != null) {
try {
builder.loadWorkspace(path,settings);
} catch (FileNotFoundException e) {
_log.error(e.getMessage());
} catch (JSONException e) {
_log.error(e.getMessage());
}
}
treeViewer.refresh();
}
private void doLoadWorkSpace() {
FileDialog dialog = new FileDialog(shlGenesysMagic, SWT.MULTI);
dialog.setFilterNames(new String[] { "JSON Format" });
dialog.setFilterExtensions(new String[] { "*.json" });
String path = dialog.open();
if (path != null) {
try {
builder.loadWorkspace(path, settings);
} catch (FileNotFoundException e) {
_log.error(e.getMessage());
} catch (JSONException e) {
_log.error(e.getMessage());
}
}
treeViewer.refresh();
}
protected void doShutdown() {
_log.info("Shutting down.");
......
......@@ -16,6 +16,14 @@
package org.genesys2.anno.gui;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.genesys2.anno.model.Column;
import org.genesys2.anno.model.ColumnDataType;
import org.genesys2.anno.model.OAuthSettings;
......@@ -25,10 +33,6 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class DwcaBuilder extends AbstractModelObject {
private List<DataSourceFile> fileRoots = new ArrayList<DataSourceFile>();
......
package org.genesys2.anno.gui;
import java.awt.Color;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.eclipse.core.databinding.DataBindingContext;
......@@ -9,6 +7,9 @@ import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
......@@ -28,15 +29,9 @@ import org.genesys2.client.oauth.GenesysApiException;
import org.genesys2.client.oauth.GenesysClient;
import org.genesys2.client.oauth.OAuthAuthenticationException;
import org.genesys2.client.oauth.PleaseRetryException;
import org.omg.CORBA.COMM_FAILURE;
import swing2swt.layout.BorderLayout;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.wb.swt.SWTResourceManager;
public class SettingsDialog extends Dialog {
private static final Logger _log = Logger.getLogger(SettingsDialog.class);
private DataBindingContext m_bindingContext;
......@@ -62,7 +57,7 @@ public class SettingsDialog extends Dialog {
public SettingsDialog(Settings settings, Shell parent, int style) {
super(parent, style);
this.settings = settings;
setText("Preferences");
setText("Settings");
}
/**
......
package org.genesys2.anno.gui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
......@@ -19,7 +18,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;
public class VerifierDialog extends Dialog {
......
......@@ -2,7 +2,6 @@ package org.genesys2.anno.converter;
import static org.junit.Assert.assertTrue;
import org.apache.commons.lang3.ArrayUtils;
import org.junit.Test;
import com.fasterxml.jackson.core.JsonGenerationException;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment