import java.util.ArrayList;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.tizen.common.connection.preference.TizenConnectionExplorerPreferencePage;
import org.tizen.common.connection.preference.TizenLogPreferencePage;
-import org.tizen.common.connection.ui.ConnectionUIMessages;
import org.tizen.common.util.OSChecker;
-import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.log.Logger;
import org.tizen.sdblib.FileListingService.FileEntry;
import org.tizen.sdblib.IDevice;
// The shared instance
private static ConnectionPlugin plugin;
- private static boolean isConnectionExplorerOpened = false;
-
- private IDevice currentDevice;
+ private IDevice currentDevice = null;
private final ArrayList<ISelectionListener> listeners = new ArrayList<ISelectionListener>();
public int os;
public static final int LINUX = 0;
public static final int WINDOWS = 1;
+
+ public static Job ideCheckJob;
/**
* Implements for FileEntry changed status.
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
+
+ if(ideCheckJob.sleep())
+ {
+ ideCheckJob.cancel();
+ Logger.info("IDE Check Job is cancelled");
+ }
+
int deviceCnt = SmartDevelopmentBridge.getBridge().getDevices().length;
if (deviceCnt==0)
{
}
public IDevice getCurrentDevice() {
- if(!isConnectionExplorerOpened)
- {
- SWTUtil.syncExec(new Runnable()
- {
- @Override
- public void run()
- {
- MessageDialog.openError(new Shell(), ConnectionUIMessages.Explorer_Closed_Title, ConnectionUIMessages.Explorer_Closed_Message);
- }
- });
- Logger.error("ConnectionExplorer is closed");
- return null;
- }
return currentDevice;
}
- public void setConnectionExplorerOpened(boolean isOpend) {
- isConnectionExplorerOpened = isOpend;
- }
-
- public boolean getConnectionExplorerOpened() {
- return isConnectionExplorerOpened;
- }
-
public void addSelectionListener(ISelectionListener listener) {
listeners.add(listener);
}
}
}
}
+
+ public static void setIDECheckJob(Job job)
+ {
+ ideCheckJob = job;
+ }
/**
* Returns an image descriptor for the image file at the given
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Tree;
import org.tizen.common.connection.preference.TizenConnectionExplorerPreferencePage;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.util.HostUtil;
+import org.tizen.common.util.SWTUtil;
import org.tizen.common.util.log.Logger;
import org.tizen.sdblib.FileListingService.FileEntry;
import org.tizen.sdblib.IDevice;
@Override
public void partClosed(IWorkbenchPartReference partRef) {
- setOpened(partRef, false);
+ if (ConnectionPlugin.ID_CONNECTION_VIEW.equals(partRef.getId())) {
+ ConnectionPlugin.getDefault().setCurrentDevice(null);
+
+ Job job = new Job("Check IDE close"){
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ SWTUtil.syncExec(new Runnable()
+ {
+ @Override
+ public void run() {
+ MessageDialog.openWarning(new Shell(), ConnectionUIMessages.Explorer_Closed_Title, ConnectionUIMessages.Explorer_Closed_Message);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ ConnectionPlugin.getDefault().setIDECheckJob(job);
+ job.schedule(1000);
+ }
}
@Override
@Override
public void partOpened(IWorkbenchPartReference partRef) {
- setOpened(partRef, true);
}
@Override
@Override
public void partInputChanged(IWorkbenchPartReference partRef) {
}
-
- private void setOpened(IWorkbenchPartReference partRef, boolean open) {
- if (ConnectionPlugin.ID_CONNECTION_VIEW.equals(partRef.getId())) {
- ConnectionPlugin.getDefault().setConnectionExplorerOpened(open);
- }
- }
}
\ No newline at end of file
-Explorer_Closed_Title = Failed to get device information
-Explorer_Closed_Message = The Connection Explorer is closed.\nPlease open it here:\n\tWindow > Show View > Other... > Tizen > Connection Explorer
+Explorer_Closed_Title = Connection Explorer is closed
+Explorer_Closed_Message = Connection Explorer is closed\nYou can open it by Window > Show View > Connection Explorer menu.
Explorer_ConetextMenu_New = New
Explorer_ConetextMenu_File = File